Table of contents
CSPICE_DET computes the determinant of a double precision 3x3 matrix.
Given:
m1 an arbitrary 3x3 double precision matrix.
help, m1
DOUBLE = Array[3,3]
the call:
det = cspice_det( m1 )
returns:
det the value of the determinant found by direct application of the
definition of the determinant.
help, det
DOUBLE = Scalar
None.
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 3x3 double precision matrix, compute its determinant.
Example code begins here.
PRO det_ex1
;;
;; Set `m1' and `m2'.
;;
m1 = [[1.D0, 2.D0, 3.D0], $
[4.D0, 5.D0, 6.D0], $
[7.D0, 8.D0, 9.D0]]
m2 = [[1.D0, 2.D0, 3.D0], $
[0.D0, 5.D0, 6.D0], $
[0.D0, 0.D0, 9.D0]]
;;
;; Display the determinant of `m1' and `m2'.
;;
print, format='(A,F6.2)', 'Determinant of M1:', cspice_det( m1 )
print, format='(A,F6.2)', 'Determinant of M2:', cspice_det( m2 )
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
Determinant of M1: 0.00
Determinant of M2: 45.00
cspice_det calculates the determinant of `m1' in a single arithmetic
expression which is, effectively, the expansion of `m1' about its
first row. Since the calculation of the determinant involves
the multiplication of numbers whose magnitudes are unrestricted,
there is the possibility of floating point overflow or underflow.
NO error checking or recovery is implemented in this routine.
The native IDL code to calculate the same scalar result is:
det = determ( m1 )
or
det = la_determ( m1 )
The IDL functions accepts an arbitrary size NxN matrix.
1) If the input argument `m1' is undefined, an error is signaled
by the IDL error handling system.
2) If the input argument `m1' is not of the expected type, or it
does not have the expected dimensions and size, an error is
signaled by the Icy interface.
None.
1) No checking is implemented to determine whether `m1' will cause
overflow or underflow in the process of calculating the
determinant. In most cases, this will not pose a problem.
The user is required to determine if `m1' is suitable matrix
for cspice_det to operate on.
ICY.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.0.3, 10-AUG-2021 (JDR)
Changed input argument name "mat" to "m1" for consistency with other
routines.
Edited the header to comply with NAIF standard. Added complete
code example based on existing fragment.
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.2, 13-JUN-2011 (EDW)
Edits to comply with NAIF standard for Icy headers.
-Icy Version 1.0.1, 09-DEC-2005 (EDW)
Added -Examples section.
-Icy Version 1.0.0, 16-JUN-2003 (EDW)
determinant of a d.p. 3x3_matrix
|