void mxmt_c ( ConstSpiceDouble m1 [3][3],
ConstSpiceDouble m2 [3][3],
SpiceDouble mout[3][3] )
Multiply a 3x3 matrix and the transpose of another 3x3 matrix.
None.
MATRIX
VARIABLE I/O DESCRIPTION
-------- --- --------------------------------------------------
m1 I 3x3 double precision matrix.
m2 I 3x3 double precision matrix.
mout O The product m1 times m2 transpose .
m1 is an arbitrary 3x3 double precision matrix.
m2 is an arbitrary 3x3 double precision matrix.
Typically, m2 will be a rotation matrix since
then its transpose is its inverse (but this is
NOT a requirement).
mout is a 3x3 double precision matrix. mout is the
product
t
mout = m1 m2
mout may overwrite either m1 or m2.
None.
Error free.
None
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[i][k] * m2[j][k]
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 = | 0.0 1.0 0.0 |
| |
| -1.0 0.0 0.0 |
| |
| 0.0 0.0 1.0 |
m2 = | 0.0 1.0 0.0 |
| |
| -1.0 0.0 0.0 |
| |
| 0.0 0.0 1.0 |
then the call
mxmt_c ( m1, m2, mout );
produces the matrix
mout = | 1.0 0.0 0.0 |
| |
| 0.0 1.0 0.0 |
| |
| 0.0 0.0 1.0 |
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.)
None.
W.M. Owen (JPL)
E.D. Wright (JPL)
-CSPICE Version 1.0.0, 16-APR-1999 (EDW)
matrix times matrix_transpose 3x3_case
Link to routine mxmt_c source file mxmt_c.c
|