mxv_c |

Table of contents## Proceduremxv_c ( Matrix times vector, 3x3 ) void mxv_c ( ConstSpiceDouble m [3][3], ConstSpiceDouble vin [3], SpiceDouble vout[3] ) ## AbstractMultiply a 3x3 double precision matrix with a 3-dimensional double precision vector. ## Required_ReadingNone. ## KeywordsMATRIX VECTOR ## Brief_I/OVARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- m I 3x3 double precision matrix. vin I 3-dimensional double precision vector. vout O 3-dimensional double precision vector. `vout' is the product m*vin. ## Detailed_Inputm is an arbitrary 3x3 double precision matrix. vin is an arbitrary 3-dimensional double precision vector. ## Detailed_Outputvout is a 3-dimensional double precision vector. `vout' is the product m * v. `vout' may overwrite `vin'. ## ParametersNone. ## ExceptionsError free. ## FilesNone. ## ParticularsThe code reflects precisely the following mathematical expression For each value of the subscript `i' from 0 to 2: 2 .----- \ vout[i] = ) m[i][k] * 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. ## 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 3x3 matrix and a 3-vector, multiply the matrix by the vector. Example code begins here. /. Program mxv_ex1 ./ #include <stdio.h> #include "SpiceUsr.h" int main( ) { /. Local variables. ./ SpiceDouble vout [3]; /. Define `m' and `vin'. ./ SpiceDouble m [3][3] = { { 0.0, 1.0, 0.0}, {-1.0, 0.0, 0.0}, { 0.0, 0.0, 1.0} }; SpiceDouble vin [3] = { 1.0, 2.0, 3.0 }; /. Multiply `m' by `vin'. ./ ## Restrictions1) The user is responsible for checking the magnitudes of the elements of `m' and `vin' so that a floating point overflow does not occur. ## Literature_ReferencesNone. ## Author_and_InstitutionJ. Diaz del Rio (ODC Space) E.D. Wright (JPL) ## Version-CSPICE Version 1.1.0, 13-AUG-2021 (JDR) Changed input argument name "m1" to "m" for consistency with other routines. Edited the header to comply with NAIF standard. Added complete code example based on the existing example. Updated -Particulars section. -CSPICE Version 1.0.0, 16-APR-1999 (EDW) ## Index_Entriesmatrix times 3-dimensional vector |

Fri Dec 31 18:41:09 2021