|
IDL Reference Guide: Procedures and Functions |
|
The NORM function computes the norm of a vector or a two-dimensional array.
By default, NORM computes the L2 (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.
Result = NORM( A [, /DOUBLE] [, LNORM={0 | 1 | 2 | n}])
Returns the Euclidean or infinity norm of a vector or an array. This function always returns a float or double value.
A can be either a real or complex vector, or a real or complex two-dimensional array.
Set this keyword to force the result to be returned as double precision. The default is to return a single-precision result if the input is single precision, or double precision otherwise. Internally, all computations are done using double-precision arithmetic.
Set this keyword to indicate which norm to compute. If A is a vector, then the possible values of this keyword are:
If A is a two-dimensional array, then the possible values of this keyword are:
; Define an n-element complex vector A: A = [COMPLEX(1, 0), COMPLEX(2,-2), COMPLEX(-3,1)] ; Compute the Euclidean norm of A and print: PRINT, 'Euclidian Norm of A =', NORM(A) ; Define an m by n complex array B: B = [[COMPLEX(1, 0), COMPLEX(2,-2), COMPLEX(-3,1)], $ [COMPLEX(1,-2), COMPLEX(2, 2), COMPLEX(1, 0)]] ;Compute the Infinity norm of B and print. PRINT, 'Infinity Norm of B =', NORM(B, /DOUBLE)
IDL prints: