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_vdotg

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


Abstract


   CSPICE_VDOTG computes the dot product of two vectors of arbitrary
   dimension.

I/O


   Given:

      v1,
      v2       two arbitrary double precision n-dimensional vectors.

               help, v1
                  DOUBLE = Array[N]
               help, v2
                  DOUBLE = Array[N]

   the call:

      vdotg = cspice_vdotg( v1, v2 )

   returns:

      vdotg    the value of the dot product (inner product)
               of `v1' and `v2':

                  < v1, v2 >

               help, vdotg
                  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) Suppose that you have a set of double precision n-dimensional
      vectors. Check if they are orthogonal to the Z-axis in
      n-dimensional space.


      Example code begins here.


      PRO vdotg_ex1

         ;;
         ;; Local parameters.
         ;;
         SETSIZ =   5L

         ;;
         ;; Define the vector set.
         ;;
         v1     = [ [ 1.D0,  0.D0,  0.D0, 0.D0 ],                            $
                    [ 0.D0,  1.D0,  0.D0, 3.D0 ],                            $
                    [ 0.D0,  0.D0, -6.D0, 0.D0 ],                            $
                    [10.D0,  0.D0, -1.D0, 0.D0 ],                            $
                    [ 0.D0,  0.D0,  0.D0, 1.D0 ] ]

         z      = [   0.D0,  0.D0,  1.D0, 0.D0 ]

         ;;
         ;; Check the orthogonality with respect to `z' of each
         ;; vector in `v1'.
         ;;
         for i=0L, SETSIZ-1L do begin

            print
            print, format='(A,4F6.1)', 'Input vector (V1): ', v1[*,i]

            if ( cspice_vdotg( v1[*,i], z ) eq 0.D0 ) then begin

               print, format='(A)', 'V1 and Z are orthogonal.'

            endif else begin

               print, format='(A)', 'V1 and Z are NOT orthogonal.'

            endelse

         endfor

      END


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


      Input vector (V1):    1.0   0.0   0.0   0.0
      V1 and Z are orthogonal.

      Input vector (V1):    0.0   1.0   0.0   3.0
      V1 and Z are orthogonal.

      Input vector (V1):    0.0   0.0  -6.0   0.0
      V1 and Z are NOT orthogonal.

      Input vector (V1):   10.0   0.0  -1.0   0.0
      V1 and Z are NOT orthogonal.

      Input vector (V1):    0.0   0.0   0.0   1.0
      V1 and Z are orthogonal.


Particulars


   cspice_vdotg calculates the dot product of `v1' and `v2' by a simple
   application of the definition:

                       ndim-1
                      .------
                       \
      cspice_vdotg  =   )  v1[i] * v2[i]
                       /
                      '------
                         i=0

   No error checking is performed to prevent or recover from numeric
   overflow.

   Native IDL code to calculate the same scalar result:

      vdotg = transpose(v1) # v2
      vdotg = v2 ## transpose(v1)

   The native IDL functions also accept arbitrary sized N vectors.

Exceptions


   1)  If any of the input arguments, `v1' or `v2', is undefined, an
       error is signaled by the IDL error handling system.

   2)  If any of the input arguments, `v1' or `v2', is not of the
       expected type, or it does not have the expected dimensions and
       size, an error is signaled by the Icy interface.

   3)  If the input vector arguments `v1' and `v2' do not have the
       same dimension (N), an error is signaled by the Icy interface.

Files


   None.

Restrictions


   1)  The user is responsible for determining that the vectors `v1'
       and `v2' are not so large as to cause numeric overflow. In
       most cases this will not present a problem.

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.2, 10-AUG-2021 (JDR)

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

       Added -Parameters, -Exceptions, -Files, -Restrictions,
       -Literature_References and -Author_and_Institution sections, and
       completed -Particulars section. Moved the contents of the existing
       -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.1, 09-DEC-2005 (EDW)

       Added -Examples section.

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

Index_Entries


   dot product of n-dimensional vectors



Fri Dec 31 18:43:08 2021