We can categorically state that we have not released man-eating badgers into the area
Synopsis
#include <opnorm.h>
extern int opnorm( |
const double * M, |
majority_t majority, | |
size_t m, | |
size_t n, | |
double p, | |
double q, | |
opnorm_opt_t opt, | |
double * norm, | |
double * vmax, | |
opnorm_stats_t * stats) ; |
extern const char * opnorm_strerror( |
int errorcode) ; |
DESCRIPTION
The opnorm
function calculates the (p
,q
)-operator norm of the m
×n
matrix M
.
The matrix is specified as a one-dimensional array M
of
(m
×n
) doubles, interpreted as being row- or column-major depending on the value of the
majority
argument (which is an enumerated type majority_t, one of row_major or column_major).
The opt
argument is a structure opnorm_opt_t containing the fields:
- double
eps
-
The maximum relative error of the estimate of the norm — the value should be greater than
DBL_EPSILON
(defined in the standard headerfloat.h
), preferably by two or three orders of magnitude; - size_t
fifomax
-
The maximum size of the FIFO queue used in the algorithm — a value of zero means unlimited.
On success, the norm is assigned to the double at the address of
the norm
argument. A maximising vector is assigned to the array of
(n
) doubles given by the vmax
argument, and some runtime statistics are assigned to the argument
stats
; a pointer to a structure of type opnorm_stats_t having fields:
- unsigned long
neval
-
The number of matrix-vector multiplications;
- unsigned long
nfifo
-
The throughput of the FIFO;
- unsigned long
fifomax
-
The maximum size of the FIFO;
- unsigned int
nthread
-
The number of threads used.
RETURN VALUE
In the case of success, zero is returned and the values described in the previous section are assigned.
In the case of failure, a positive errorcode is returned and the return values are not
assigned. The errorcode can be passed to the opnorm_strerror
function to obtain a string which describes the nature of the error.
ENVIRONMENT
In the case that the library was compiled with POSIX threading support, the number of
threads to be used can be controlled by defining the variable OPNORM_NTHREAD
to the required positive integer. Otherwise the number of threads
used will equal the number of processors detected (as determined by sysconf(3)).