Generate the inverse of a 3x3 matrix.
VARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- m1 I Matrix to be inverted. mout O Inverted matrix (m1)**-1. If m1 is singular, then mout will be the zero matrix. mout can overwrite m1.
m1 An arbitrary 3x3 matrix. The limits on the size of elements of m1 are determined by the process of calculating the cofactors of each element of the matrix. For a 3x3 matrix this amounts to the differencing of two terms, each of which consists of the multiplication of two matrix elements. This multiplication must not exceed the range of double precision numbers or else an overflow error will occur.
mout is the inverse of m1 and is calculated explicitly using the matrix of cofactors. mout is set to be the zero matrix if m1 is singular.
A temporary matrix is used to compute the result, so the output matrix may overwrite the input matrix.
Suppose that m1 is given by the following matrix equation: | 0 -1 0 | m1 = | 0.5 0 0 | | 0 0 1 | If invert_c is called as shown invert_c (m1, m1); then m1 will be set to be: | 0 2 0 | m1 = |-1 0 0 | | 0 0 1 |
The input matrix must be such that generating the cofactors will not cause a floating point overflow or underflow. The strictness of this condition depends, of course, on the computer installation and the resultant maximum and minimum values of double precision numbers.
1) No internal checking on the input matrix m1 is performed except on the size of its determinant. Thus it is possible to generate a floating point overflow or underflow in the process of calculating the matrix of cofactors. 2) If the determinant is less than 10**-16, the matrix is deemed to be singular and the output matrix is filled with zeros.
W.M. Owen (JPL)
-CSPICE Version 1.0.0, 13-SEP-1999 (NJB) (WMO)
invert a 3x3_matrix