Intel® Fortran Compiler 16.0 User and Reference Guide
Transformational Intrinsic Function (Generic): Returns the L2 norm of an array.
result = NORM2 (x [, dim])
x |
(Input) Must be a real array. |
dim |
(Input; optional) Must be a scalar integer with a value in the range 1 <= dim <= n, where n is the rank of x. The corresponding actual argument must not be an optional dummy argument. |
The result is of the same type and kind parameters as x.
The result is a scalar if dim is omitted; otherwise, the result has rank n - 1 and shape [d1, d2, ..., ddim-1, ddim+1, ..., dn], where n is the rank of x and [d1, d2, ..., dn] is the shape of x.
The result of NORM2 (x) has a value equal to a processor-dependent approximation to the generalized L2 norm of x, which is the square root of the sum of the squares of the elements of x.
The result of NORM2 (x, DIM=dim) has a value equal to that of NORM2 (x) if x has rank one.
Otherwise, the value of element (s1, s2, .., sdim-1, sdim+1, ... sn) of the result is equal to NORM2 (x (s1, s2, .., sdim-1, :, sdim+1, ... sn)).
It is recommended that the processor compute the result without undue overflow or underflow.
The value of NORM2 ([3.0, 4.0]) is 5.0 (approximately).
If X has the value:
[ 1.0 2.0 ] [ 3.0 4.0 ]
then the value of NORM2 (X, DIM=1) is approximately [3.162, 4.472] and the value of NORM2 (X, DIM=2) is approximately [2.236,5.0].