Multiply the transpose of a 3x3 matrix and a 3x3 matrix.
VARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- m1 I 3x3 double precision matrix. m2 I 3x3 double precision matrix. mout O The produce m1 transpose times m2.
m1 is any 3x3 double precision matrix. Typically, m1 will be a rotation matrix since then its transpose is its inverse (but this is not a requirement). m2 is any 3x3 double precision matrix.
mout is a 3x3 double precision matrix. mout is the product t mout = m1 m2 mout may overwrite either m1 or m2.
The code reflects precisely the following mathematical expression For each value of the subscripts i and j from 0 to 2: 2 __ \ mout[i][j] = /_ m1[k][i] * m2[k][j] k=0 Note that the reversal of the k and i subscripts in the left-hand matrix m1 is what makes mout the product of the TRANSPOSE of M1 and not simply of m1 itself. Also, the intermediate results of the operation above are buffered in a temporary matrix which is later moved to the output matrix. Thus mout can be actually be m1 or m2 if desired without interfering with the computations.
Let m1 = | 1. 2. 3. | | | | 4. 5. 6. | | | | 7. 8. 9. | m2 = | 1. 1. 0. | | | | -1. 1. 0. | | | | 0. 0. 1. | then the call mtxm_c ( m1, m2, mout ); produces the matrix mout = | -3. 5. 7. | | | | -3. 7. 8. | | | | -3. 9. 9. |
The user is responsible for checking the magnitudes of the elements of m1 and m2 so that a floating point overflow does not occur. (In the typical use where m1 and m2 are rotation matrices, this not a risk at all.)
W.M. Owen (JPL) E.D Wright (JPL)
-CSPICE Version 1.0.0, 16-APR-1999 (EDW)
matrix_transpose times matrix 3x3_case