NORM
The NORM function computes the norm of a vector or a twodimensional array.
By default, NORM computes the L_{2} (Euclidean) norm for vectors, and the L_{•} norm for arrays. You may use the LNORM keyword to specify different norms.
This routine is written in the IDL language. Its source code can be found in the file norm.pro in the lib subdirectory of the IDL distribution.
Examples
A = [COMPLEX(1, 0), COMPLEX(2,2), COMPLEX(3,1)]
PRINT, 'Euclidian Norm of A =', NORM(A)
B = [[COMPLEX(1, 0), COMPLEX(2,2), COMPLEX(3,1)], $
[COMPLEX(1,2), COMPLEX(2, 2), COMPLEX(1, 0)]]
PRINT, 'Infinity Norm of B =', NORM(B, /DOUBLE)
IDL prints:
Euclidian Norm of A = 4.35890
Infinity Norm of B = 6.9907048
Syntax
Result = NORM( A [, /DOUBLE] [, LNORM={0  1  2  n}])
Return Value
Returns the Euclidean or infinity norm of a vector or an array. This function always returns a float or double value.
Arguments
A
A can be either a real or complex vector, or a real or complex twodimensional array.
Keywords
DOUBLE
Set this keyword to force the result to be returned as double precision. The default is to return a singleprecision result if the input is single precision, or double precision otherwise. Internally, all computations are done using doubleprecision arithmetic.
LNORM
Set this keyword to indicate which norm to compute. If A is a vector, then the possible values of this keyword are:
Value

Description

0

Compute the L_{α} norm, defined as MAX(ABS(A)).

1

Compute the L_{1} norm, defined as TOTAL(ABS(A)).

2

Compute the L_{2} norm, defined as SQRT(TOTAL(ABS(A)^2)). This is the default.

n

Compute the L_{n} norm, defined as (TOTAL(ABS(A)^n))^(1/n) where n is any number, floatpoint or integer.

If A is a twodimensional array, then the possible values of this keyword are:
Value

Description

0

Compute the L_{α} norm (the maximum absolute row sum norm),
Defined as MAX(TOTAL(ABS(A), 1)). This is the default.

1

Compute the L_{1} norm (the maximum absolute column sum norm), defined as MAX(TOTAL(ABS(A), 2)).

2

Compute the L_{2} norm (the spectral norm) defined as the largest singular value, computed from LA_SVD.

Version History
See Also
COND, LA_SVD