Index of Functions: A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X 
Index Page
cspice_vnorm

Table of contents
Abstract
I/O
Parameters
Examples
Particulars
Exceptions
Files
Restrictions
Required_Reading
Literature_References
Author_and_Institution
Version
Index_Entries


Abstract


   CSPICE_VNORM computes the magnitude of a double precision 3-dimensional
   vector.

I/O


   Given:

      v1       any double precision 3-dimensional vector.

               help, v1
                  DOUBLE = Array[3]

   the call:

      vnorm = cspice_vnorm( v1 )

   returns:

      vnorm    the magnitude of `v1' calculated in a numerically stable way.

               help, vnorm
                  DOUBLE = Scalar

Parameters


   None.

Examples


   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 set of 3-dimensional vectors and compute the
      magnitude of each vector within.


      Example code begins here.


      PRO vnorm_ex1

         ;;
         ;; Local parameters.
         ;;
         SETSIZ =   3L

         ;;
         ;; Define a set of 3-dimensional vectors.
         ;;
         v1     = [ [ 1.D0,   2.D0,  2.D0  ],                                $
                    [ 5.D0,  12.D0,  0.D0  ],                                $
                    [-5.D-17, 0.D0, 12.D-17] ]

         ;;
         ;; Calculate the magnitude of each vector
         ;;
         for i=0L, SETSIZ-1L do begin

            print, format='(A,3E10.2)', 'Input vector: ', v1[*,i]
            print, format='(A,F24.20)', 'Magnitude   : ',                    $
                                        cspice_vnorm( v1[*,i] )
            print

         endfor

      END


      When this program was executed on a Mac/Intel/IDL8.x/64-bit
      platform, the output was:


      Input vector:   1.00E+00  2.00E+00  2.00E+00
      Magnitude   :   3.00000000000000000000

      Input vector:   5.00E+00  1.20E+01  0.00E+00
      Magnitude   :  13.00000000000000000000

      Input vector:  -5.00E-17  0.00E+00  1.20E-16
      Magnitude   :   0.00000000000000013000


Particulars


   cspice_vnorm takes care to avoid overflow while computing the norm of the
   input vector `v1'. cspice_vnorm finds the component of `v1' whose magnitude
   is the largest. Calling this magnitude `v1max', the norm is computed
   using the formula:

                             ||    1         ||
      cspice_vnorm = v1max * || ------- * v1 ||
                             ||  v1max       ||

   where the notation ||x|| indicates the norm of the vector `x'.

   Native IDL code to calculate the same scalar result:

      vnorm = norm( v1 )

   The IDL norm function accepts an arbitrary size N vector.

Exceptions


   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.

Files


   None.

Restrictions


   None.

Required_Reading


   ICY.REQ

Literature_References


   None.

Author_and_Institution


   J. Diaz del Rio     (ODC Space)
   E.D. Wright         (JPL)

Version


   -Icy Version 1.0.4, 10-AUG-2021 (JDR)

       Edited the header to comply with NAIF standard. Added complete
       code example.

       Added -Parameters, -Exceptions, -Files, -Restrictions,
       -Literature_References and -Author_and_Institution sections. Moved the
       existing contents of -Examples section to -Particulars.

       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.3, 13-JUN-2011 (EDW)

       Edits to comply with NAIF standard for Icy headers.

   -Icy Version 1.0.2, 23-SEP-2008 (EDW)

       Eliminated English error.

   -Icy Version 1.0.1, 09-DEC-2005 (EDW)

       Added -Examples section.

   -Icy Version 1.0.0, 16-JUN-2003 (EDW)

Index_Entries


   norm of 3-dimensional vector



Fri Dec 31 18:43:08 2021