Table of contents
CSPICE_VNORMG returns a scalar double describing the vector norm
of an N vector where the vector norm is defined as the magnitude of
the vector.
Given:
v1 any double precision vector of arbitrary dimension, whose
magnitude is to be found.
help, v1
DOUBLE = Array[N]
the call:
vnormg = cspice_vnormg( v1 )
returns:
vnormg the magnitude of `v1' calculated in a numerically stable way.
help, vnormg
DOUBLE = Scalar
None.
Any numerical results shown for this example may differ between
platforms as the results depend on the SPICE kernels used as input
and the machine specific arithmetic implementation.
1) Define a four-dimensional vector and calculate its magnitude.
Example code begins here.
PRO vnormg_ex1
v1 = [ 12.3d, -4.32d, 76.d, 1.87d ]
print, 'Magnitude of v1:', cspice_vnormg( v1 )
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
Magnitude of v1: 77.132673
Note, the native IDL code to calculate the same scalar result:
vnormg = norm( vec )
The IDL function accepts an arbitrary size N-vectors.
cspice_vnormg finds the component of `v1' whose magnitude is the largest.
If the absolute magnitude of that component indicates that a
numeric overflow would occur when it is squared, or if it
indicates that an underflow would occur when squared (falsely
giving a magnitude of zero) then the following expression is
used:
cspice_vnormg = v1max * MAGNITUDE OF [ (1/v1max)*v1 ]
Otherwise a simpler expression is used:
cspice_vnormg = MAGNITUDE OF [ v1 ]
Beyond the logic described above, no further checking of the
validity of the input is performed.
1) If the input argument `v1' is undefined, an error is signaled
by the IDL error handling system.
2) If the input argument `v1' is not of the expected type, or it
does not have the expected dimensions and size, an error is
signaled by the Icy interface.
None.
None.
ICY.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.0.3, 10-AUG-2021 (JDR)
Edited the -I/O section to comply with NAIF standard.
Added -Examples, -Particulars and -Parameters sections.
Removed reference to the routine's corresponding CSPICE header from
-Abstract section.
Added arguments' type and size information in the -I/O section.
-Icy Version 1.0.2, 23-SEP-2008 (EDW)
Eliminated error in English.
-Icy Version 1.0.1, 09-DEC-2005 (EDW)
Added -Examples section.
-Icy Version 1.0.0, 16-JUN-2003 (EDW)
norm of n-dimensional vector
|