Table of contents
CSPICE_MTXV calculates transpose of a 3x3 matrix by a 3-vector
using the classic definition of the matrix multiplication,
returning a 3-vector as output. All components of the vectors
and matrix are double precision values.
Given:
m an arbitrary 3x3 double precision matrix.
help, m
DOUBLE = Array[3,3]
Typically, `m' will be a rotation matrix since then its
transpose is its inverse (but this is NOT a requirement).
vin an arbitrary 3-dimensional double precision vector.
help, vin
DOUBLE = Array[3]
the call:
cspice_mtxv, m, vin, vout
returns:
vout a 3-dimensional double precision vector.
help, vout
DOUBLE = Array[3]
`vout' is the product vout = (m**t) x (vin). `vout' can
overwrite `vin'.
`vout' has the form of an IDL row vector, i.e.:
vout = [ vout1, vout2, vout3 ]
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 matrix and a 3-vector, multiply the transpose of
the matrix by the vector.
Example code begins here.
PRO mtxv_ex1
;;
;; Define `m' and `vin'.
;;
m = [[1.0, 1.0, 0.0], [-1.0, 1.0, 0.0], [0.0, 0.0, 1.0]]
vin = [ 5.0, 10.0, 15.0 ]
;;
;; Multiply the transpose of `m' by `vin'.
;;
cspice_mtxv, m, vin, vout
print, format='(A)', 'Transpose of M1 times VIN:'
print, format='(3F10.3)', vout
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
Transpose of M1 times VIN:
-5.000 15.000 15.000
Note that typically the matrix `m' will be a rotation matrix.
Because the transpose of an orthogonal matrix is equivalent to
its inverse, applying the rotation to the vector is
accomplished by multiplying the vector by the transpose of the
matrix.
Let
-1
m * vin = vout
If `m' is an orthogonal matrix, then (m**T) * vin = vout.
The native IDL code to calculate the same matrix result:
vecout = transpose(mat) ## vec
returns a column-3 vector, an IDL 1x3 matrix. Another operation:
vecout = mat # vec
returns an IDL row-3 vector.
The code reflects precisely the following mathematical expression
For each value of the subscript `i' from 0 to 2:
2
.-----
\
vout[i] = ) m[i,k] * vin[k]
/
'-----
k=0
Note that the reversal of the `k' and `i' subscripts in the left-hand
matrix `m' is what makes `vout' the product of the TRANSPOSE of
and not simply of `m' itself.
1) If any of the input arguments, `m' or `vin', is undefined, an
error is signaled by the IDL error handling system.
2) If any of the input arguments, `m' or `vin', is not of the
expected type, or it does not have the expected dimensions and
size, an error is signaled by the Icy interface.
3) If the output argument `vout' is not a named variable, an
error is signaled by the Icy interface.
None.
1) The user is responsible for checking the magnitudes of the
elements of `m' and `vin' so that a floating point overflow does
not occur.
ICY.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.1.0, 25-AUG-2021 (JDR)
Changed the input argument name "mat", "vec", and "vecout" to
"m", "vin", and "vout" for compliancy with other routines.
Edited the header to comply with NAIF standard. Added complete code
example.
Added -Parameters, -Particulars, -Exceptions, -Files, -Restrictions,
-Literature_References and -Author_and_Institution sections.
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)
matrix_transpose times 3-dimensional vector
|