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 mtxvg_c

Table of contents

Procedure Abstract Required_Reading Keywords Brief_I/O Detailed_Input | Detailed_Output Parameters Exceptions Files Particulars Examples | Restrictions Literature_References Author_and_Institution Version Index_Entries

#### Procedure

       mtxvg_c ( Matrix transpose times vector, general dimension )

       void mtxvg_c ( const void   * m1,
                      const void   * v2,
                      SpiceInt       nc1,
                      SpiceInt       nr1r2,
                      void         * vout   )

#### Abstract

       Multiply the transpose of a matrix and a vector of arbitrary size.

#### Required_Reading

       None.

#### Keywords

       MATRIX
       VECTOR

#### Brief_I/O

       VARIABLE  I/O  DESCRIPTION
       --------  ---  --------------------------------------------------
       m1         I   Left-hand matrix to be multiplied.
       v2         I   Right-hand vector to be multiplied.
       nc1        I   Column dimension of `m1' and length of `vout'.
       nr1r2      I   Row dimension of `m1' and length of `v2'.
       vout       O   Product vector `m1' transpose times `v2'.

#### Detailed_Input

       m1          is a double precision matrix of arbitrary size which
                   forms the left-hand matrix of the multiplication.

       v2          is a double precision vector on the right of the
                   multiplication.

       nc1         is the column dimension of `m1' and length of `vout'.

       nr1r2       is the row dimension of `m1' and length of `v2'.

#### Detailed_Output

       vout        is the double precision vector which results from
                   the multiplication

                                 t
                      vout = (m1)  x  v2

                   where the superscript `t' denotes the transpose of a matrix.
                   `vout' has length `nc1'.

                   `vout' may overwrite `m1' or `v2'.

#### Parameters

       None.

#### Exceptions

       1)  If memory cannot be allocated to create the temporary matrix
           required for the execution of the routine, the error
           SPICE(MALLOCFAILED) is signaled.

#### Files

       None.

#### Particulars

       The code reflects precisely the following mathematical expression

       For each value of the subscript `i' from 1 to `nc1',

          vout(i) = Summation from k=1 to nr1r2 of  ( m1(k,i) * v2(k) )

#### Examples

       The numerical results shown for this example may differ across
       platforms. The results depend on the SPICE kernels used as
       input, the compiler and supporting libraries, and the machine
       specific arithmetic implementation.

       1) Given a 3x2 matrix and a 3-vector, multiply the transpose of
          the matrix by the vector.

          Example code begins here.

          /.
             Program mtxvg_ex1
          ./
          #include <stdio.h>
          #include "SpiceUsr.h"

          int main( )
          {

             /.
             Local variables.
             ./
             SpiceDouble          vout   [2];

             /.
             Define `m' and `vin'.
             ./
             SpiceDouble          m      [3][2] = { { 1.0,  2.0 },
                                                    { 1.0,  3.0 },
                                                    { 1.0,  4.0 } };

             SpiceDouble          vin    [3] = { 1.0, 2.0, 3.0 };

             /.
             Multiply the transpose of `m' by `vin'.
             ./
             mtxvg_c ( m, vin, 2, 3, vout );

             printf( "Transpose of M times VIN:\n" );
             printf( "%10.3f %9.3f\n", vout[0], vout[1] );

             return ( 0 );
          }

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

          Transpose of M times VIN:
               6.000    20.000

#### Restrictions

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

#### Literature_References

       None.

#### Author_and_Institution

       N.J. Bachman        (JPL)
       J. Diaz del Rio     (ODC Space)

#### Version

       -CSPICE Version 1.3.0, 06-AUG-2021 (JDR)

           Changed the input argument name "ncol1" "nc1" for consistency
           with other routines.

           Updated short error message for consistency within CSPICE wrapper
           interface: MEMALLOCFAILED -> MALLOCFAILED.

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

       -CSPICE Version 1.2.0, 28-AUG-2001 (NJB)

           Const-qualified input arrays.

       -CSPICE Version 1.1.0, 08-FEB-1998 (NJB)

           Corrected a comment describing the local macro INDEX. Made
           miscellaneous code format corrections.

           Based on SPICELIB Version 1.0.1, 10-MAR-1992 (WLT)

#### Index_Entries

       matrix transpose times n-dimensional vector

#### Link to routine mtxvg_c source file mtxvg_c.c

    Fri Dec 31 18:41:09 2021