mtxvg_c |

Table of contents## Proceduremtxvg_c ( Matrix transpose times vector, general dimension ) void mtxvg_c ( const void * m1, const void * v2, SpiceInt nc1, SpiceInt nr1r2, void * vout ) ## AbstractMultiply the transpose of a matrix and a vector of arbitrary size. ## Required_ReadingNone. ## KeywordsMATRIX VECTOR ## Brief_I/OVARIABLE 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_Inputm1 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_Outputvout 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'. ## ParametersNone. ## Exceptions1) If memory cannot be allocated to create the temporary matrix required for the execution of the routine, the error SPICE(MALLOCFAILED) is signaled. ## FilesNone. ## ParticularsThe 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) ) ## ExamplesThe 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'. ./ ## Restrictions1) 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_ReferencesNone. ## Author_and_InstitutionN.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_Entriesmatrix transpose times n-dimensional vector |

Fri Dec 31 18:41:09 2021