Visible to Intel only — GUID: GUID-124411FD-81C3-4469-9D89-3001215C43E3
Visible to Intel only — GUID: GUID-124411FD-81C3-4469-9D89-3001215C43E3
NORM2
Transformational Intrinsic Function (Generic): Returns the L2 norm of an array.
result = NORM2 (x)
result = NORM2 (x, dim)
x |
(Input) Must be a real array. |
dim |
(Input) Must be a scalar integer with a value in the range 1 <= dim <= n, where n is the rank of x. |
Results
The result is of the same type and kind parameters as x.
The result is a scalar if dim is not specified; 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.
Example
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].