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_trace

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


Abstract


   CSPICE_TRACE returns a scalar double describing the trace
   of a 3x3 double precision matrix.

I/O


   Given:

      matrix   a double precision 3x3 matrix.

               help, matrix
                  DOUBLE = Array[3,3]

   the call:

      trace = cspice_trace( matrix )

   returns:

      trace    the double precision scalar trace of `matrix', i.e. it is the
               sum of the diagonal elements of `matrix'.

               help, trace
                  DOUBLE = Scalar

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 3x3 double precision matrix, compute its trace.


      Example code begins here.


      PRO trace_ex1

         ;;
         ;; Define `matrix'.
         ;;
         matrix = [ [ 3.D0,  5.D0,  7.D0 ],                                  $
                    [ 0.D0, -2.D0,  8.D0 ],                                  $
                    [ 4.D0,  0.D0, -1.D0 ] ]

         print, format='(A)', 'MATRIX:'
         print, format='(3F6.1)', matrix

         ;;
         ;; Compute the trace of `matrix' and display the result.
         ;;
         print
         print, format='(A,F4.1)', 'Trace: ', cspice_trace( matrix )

      END


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


      MATRIX:
         3.0   5.0   7.0
         0.0  -2.0   8.0
         4.0   0.0  -1.0

      Trace:  0.0


Particulars


   The code reflects precisely the following mathematical
   expression:

                       2
                     .----
                      \
      cspice_trace =   )  matrix[i,i]
                      /
                     '----
                      i=0

   No error detection or correction is implemented within this
   function.

   Native IDL code to calculate the same scalar result:

      trace = TRACE( mat )

   The IDL TRACE function accepts an arbitrary size NxN matrix.

Exceptions


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

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

Files


   None.

Restrictions


   1)  No checking is performed to guard against floating point
       overflow or underflow. This routine should probably not be
       used if the input matrix is expected to have large double
       precision numbers along the diagonal.

Required_Reading


   ICY.REQ

Literature_References


   None.

Author_and_Institution


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

Version


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

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

       Edited the header to comply with NAIF standard. Added complete
       code example.

       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.

   -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)

Index_Entries


   trace of a 3x3_matrix



Fri Dec 31 18:43:08 2021