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_mxv

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


Abstract


   CSPICE_MXV calculates the product of a 3x3 double precision
   matrix and a  3-vector (a classic 3x1 matrix) using the
   classic definition of the matrix multiplication. An error
   signals for any input non 3x3 matrix and any non 3-vector.

I/O


   Given:

      m        an arbitrary 3x3 double precision matrix.

               help, m
                  DOUBLE = Array[3,3]

      vin      an arbitrary 3-dimensional double precision vector.

               help, vin
                  DOUBLE = Array[3]

   the call:

      cspice_mxv, m, vin, vout

   returns:

      vout     a 3-dimensional double precision vector.

               help, vout
                  DOUBLE = Array[3]

               `vout' is the product vout = m * vin. `vout' may overwrite
               `vin'.

               `vout' has the form of an IDL row  vector,  i.e.:

                  vout = [ vout1, vout2, vout3 ]

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) Given a 3x3 matrix and a 3-vector, multiply the matrix by
      the vector.


      Example code begins here.


      PRO mxv_ex1

         ;;
         ;; Define `m' and `vin'.
         ;;
         m   = [[0.0,  1.0,  0.0], [-1.0, 0.0,  0.0], [0.0,  0.0,  1.0]]
         vin = [ 1.0,  2.0,  3.0 ]

         ;;
         ;; Multiply `m' by `vin'.
         ;;
         cspice_mxv, m, vin, vout

         print, format='(A)', 'M1 times VIN:'
         print, format='(3F10.3)', vout

      END


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


      M1 times VIN:
           2.000    -1.000     3.000


Particulars


   The code reflects precisely the following mathematical expression

      For each value of the subscript `i' from 0 to 2:

                      2
                   .-----
                    \
         vout[i] =   )  m[k,i] * vin[k]
                    /
                   '-----
                     k=0

   The intermediate results of the operation performed by this routine
   are buffered in a temporary vector which is later moved to the output
   vector.  Thus `vout' can be actually be `vin' if desired without
   interfering with the computation.

   Native IDL code to calculate the same result:

      vout = m ## vin

   returns a column 3 vector, an IDL 1x3 matrix.

   Another operation:

      vout = transpose(m) # vin

   returns an IDL row 3 vector.

Exceptions


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

   2)  If any of the input arguments, `m' or `vin', 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 output argument `vout' is not a named variable, an
       error is signaled by the Icy interface.

Files


   None.

Restrictions


   1)  The user is responsible for checking the magnitudes of the
       elements of `m' and `vin' so that a floating point overflow does
       not occur.

Required_Reading


   ICY.REQ

Literature_References


   None.

Author_and_Institution


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

Version


   -Icy Version 1.1.0, 25-AUG-2021 (JDR)

       Changed the input argument name "mat", "vec", and "vecout" to
       "m", "vin", and "vout" for compliancy with other routines.

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

       Added -Parameters, -Exceptions, -Files, -Restrictions,
       -Literature_References and -Author_and_Institution sections, and
       completed -Particulars section.

       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


   matrix times 3-dimensional vector



Fri Dec 31 18:43:06 2021