IMSL_NORM
Syntax | Return Value | Arguments | Keywords | Discussion | Examples | Version History
The IMSL_NORM function computes various norms of a vector or the difference of two vectors.
Note
This routine requires an IDL Advanced Math and Stats license. For more information, contact your ITT Visual Information Solutions sales or technical support representative.
Syntax
Result = IMSL_NORM(x[, y] [, INDEX_MAX=variable] [, INF=value] [, ONE=value] )
Return Value
The requested norm of the input vector. If the norm cannot be computed, NaN is returned.
Arguments
x
Vector for which the norm is to be computed.
y
If present, IMSL_NORM computes the norm of (x – y).
Keywords
INDEX_MAX
Named variable into which the index of the element of x with the maximum modulus is stored. If Index_Max is used, then the keyword Inf also must be used. If the parameter y is specified, then the index of (x – y) with the maximum modulus is stored.
INF
If present and nonzero, computes the infinity norm max|xi|.
ONE
If present and nonzero, computes the 1-norm

Discussion
By default, IMSL_NORM computes the Euclidean norm as follows:

If the keyword One is set, then the 1-norm:

is returned. If the keyword Inf is set, the infinity norm max|xi| is returned. In the case of the infinity norm, the index of the element with maximum modulus also is returned.
If the parameter y is specified, the computations of the norms described above are performed on (x – y).
Examples
Example 1
In this example, the Euclidean norm of an input vector is computed.
x = [ 1.0, 3.0, -2.0, 4.0 ] n = IMSL_NORM(x) PM, n, Title = 'Euclidean norm of x:' Euclidean norm of x: 5.47723
Example 2
This example computes max | xi – yi | and prints the norm and index.
x = [1.0, 3.0, -2.0, 4.0] y = [4.0, 2.0, -1.0, -5.0] n = IMSL_NORM(x, y, /Inf, Index_Max = imax) PM, n, Title = 'Infinity norm of (x-y):' PM, imax, Title = 'Element of (x-y) with maximum modulus:' Infinity norm of (x-y): 9.00000 Element of (x-y) with maximum modulus: 3
Version History