opnorm — find the (p,q) operator norm of a real matrix using the algorithm of S. W. Drury.


#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);


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 header float.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.


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.


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)).


J. J. Green



S. W. Drury, A counterexample to a conjecture of Matsaev, Lin. Alg. Appl., 435 (2011) 323–329.