Index of Functions: A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X 
Index Page
cspice_invert

Table of contents
Abstract
I/O
Parameters
Examples
Particulars
Exceptions
Files
Restrictions
Required_Reading
Literature_References
Author_and_Institution
Version
Index_Entries


Abstract


   CSPICE_INVERT calculates the inverse of a double precision 3x3
   matrix.

I/O


   Given:

      m        an arbitrary 3x3 double precision matrix.

               help, m
                  DOUBLE = Array[3,3]

               The limits on the size of elements of `m' 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.

   the call:

      cspice_invert, m, mout

   returns:

      mout     the double precision matrix, inverse of `m' and is calculated
               explicitly using the matrix of cofactors.

               help, mout
                  DOUBLE = Array[3,3]

               `mout' is set to be the zero matrix if `m' is singular.

Parameters


   None.

Examples


   Any numerical results shown for this example may differ between
   platforms as the results depend on the SPICE kernels used as input
   and the machine specific arithmetic implementation.

   1) Given a double precision 3x3 matrix, compute its inverse. Check
      that the original matrix times the computed inverse produces
      the identity matrix.


      Example code begins here.


      PRO invert_ex1

         ;;
         ;; Define a simple matrix to invert.
         ;;
         m = [ [ 0, -1, 0], [ 0.5d, 0, 0], [ 0, 0, 1] ]

         ;;
         ;; Invert the matrix, then output.
         ;;
         cspice_invert, m, mout
         print,'Inverse matrix: '
         print, mout
         print, ''

         ;;
         ;; Check the `m' times `mout' produces the identity matrix.
         ;;
         print, 'Original times inverse: '
         print, m ## mout

      END


      When this program was executed on a Mac/Intel/IDL8.x/64-bit
      platform, the output was:


      Inverse matrix:
             0.0000000       2.0000000      -0.0000000
            -1.0000000       0.0000000      -0.0000000
             0.0000000      -0.0000000       1.0000000

      Original times inverse:
             1.0000000       0.0000000       0.0000000
             0.0000000       1.0000000       0.0000000
             0.0000000       0.0000000       1.0000000


Particulars


   First the determinant is explicitly calculated using the
   fundamental definition of the determinant. If this value is less
   that 10**-16 then the matrix is deemed to be singular and the
   output value is filled with zeros. Otherwise, the output matrix
   is calculated an element at a time by generating the cofactor of
   each element. Finally, each element in the matrix of cofactors
   is multiplied by the reciprocal of the determinant and the result
   is the inverse of the original matrix.

   NO INTERNAL CHECKING ON THE INPUT MATRIX `m' 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.

Exceptions


   1)  If `m' is singular, `mout' is set to be the zero matrix.

   2)  If the input argument `m' is undefined, an error is signaled
       by the IDL error handling system.

   3)  If the input argument `m' is not of the expected type, or it
       does not have the expected dimensions and size, an error is
       signaled by the Icy interface.

   4)  If the output argument `mout' is not a named variable, an
       error is signaled by the Icy interface.

Files


   None.

Restrictions


   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.

Required_Reading


   ICY.REQ

Literature_References


   None.

Author_and_Institution


   J. Diaz del Rio     (ODC Space)
   E.D. Wright         (JPL)

Version


   -Icy Version 1.1.0, 10-AUG-2021 (JDR)

       Changed the argument names "m1" and "m2" to "m" and "mout" for
       consistency with other routines.

       Edited the -Examples section to comply with NAIF standard. Added
       example's problem statement and reformatted example's output.

       Added -Parameters, -Exceptions, -Files, -Restrictions,
       -Literature_References and -Author_and_Institution sections, and
       completed -Particulars section.

       Removed reference to the routine's corresponding CSPICE header from
       -Abstract section.

       Added arguments' type and size information in the -I/O section.

   -Icy Version 1.0.1, 13-JUN-2011 (EDW)

       Edits to comply with NAIF standard for Icy headers. Expanded
       variable descriptions in -I/O section.

   -Icy Version 1.0.0, 16-JUN-2003 (EDW)

Index_Entries


   invert a 3x3 matrix



Fri Dec 31 18:43:05 2021