|
IDL Analyst Reference Guide: Math and Statistics Utilities |
|
The IMSL_NORM function computes various norms of a vector or the difference of two vectors.
| Note This routine requires an IDL Analyst license. For more information, contact your ITT Visual Information Solutions sales or technical support representative. |
Result = IMSL_NORM(x[, y] [, INDEX_MAX=variable] [, INF=value] [, ONE=value] )
The requested norm of the input vector. If the norm cannot be computed, NaN is returned.
Vector for which the norm is to be computed.
If present, IMSL_NORM computes the norm of (x – y).
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.
If present and nonzero, computes the infinity norm max|xi|.
If present and nonzero, computes the 1-norm

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).
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
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
IDL Online Help (March 06, 2007)