Table of contents
CSPICE_VTMV multiplies the transpose of a 3-dimensional column vector,
a 3x3 matrix, and a 3-dimensional column vector.
Given:
v1 any double precision 3-dimensional column vector.
help, v1
DOUBLE = Array[3]
matrix any double precision 3x3 matrix.
help, matrix
DOUBLE = Array[3,3]
v2 any double precision 3-dimensional column vector.
help, v2
DOUBLE = Array[3]
the call:
vtmv = cspice_vtmv( v1, matrix, v2 )
returns:
vtmv the double precision value of the equation
T
v1 * matrix * v2
Notice that cspice_vtmv is actually the dot product of the
vector resulting from multiplying the transpose of `v1' and
`matrix' and the vector `v2'.
help, vtmv
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) Compute the multiplication of the transpose of a 3-dimensional
column vector, a 3x3 matrix, and a second 3-dimensional column
vector.
Example code begins here.
PRO vtmv_ex1
;;
;; Define `v1', `matrix' and `v2'.
;;
v1 = [ 2.D0, 4.D0, 6.D0 ]
matrix = [[ 0.D0, 1.D0, 0.D0 ], $
[-1.D0, 0.D0, 0.D0 ], $
[ 0.D0, 0.D0, 1.D0]]
v2 = [ 1.D0, 1.D0, 1.D0 ]
print, format='(A)', 'V1:'
print, format='(F6.1)', v1
print
print, format='(A)', 'MATRIX:'
print, format='(3F6.1)', matrix
print
print, format='(A)', 'V2:'
print, format='(F6.1)', v2
;;
;; Compute the transpose of `v1' times `matrix' times `v2'.
;;
print
print, format='(A,F6.1)', 'Transpose of V1 times MATRIX times V2:', $
cspice_vtmv( v1, matrix, v2 )
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
V1:
2.0
4.0
6.0
MATRIX:
0.0 1.0 0.0
-1.0 0.0 0.0
0.0 0.0 1.0
V2:
1.0
1.0
1.0
Transpose of V1 times MATRIX times V2: 4.0
This routine implements the following vector/matrix/vector
multiplication:
T
cspice_vtmv = v1 * matrix * v2
`v1' is a column vector which becomes a row vector when transposed.
`v2' is a column vector.
No checking is performed to determine whether floating point
overflow has occurred.
Native IDL code to calculate the same matrix result:
vtmv = v1 ## ( matrix ## v2 )
or
vtmv = transpose(v1) # ( transpose(matrix) # v2 )
1) If any of the input arguments, `v1', `matrix' or `v2', is
undefined, an error is signaled by the IDL error handling
system.
2) If any of the input arguments, `v1', `matrix' or `v2', 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.
None.
ICY.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.0.2, 10-AUG-2021 (JDR)
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. Moved the existing contents of -Examples
section to -Particulars.
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, 09-DEC-2005 (EDW)
Added -Examples section.
-Icy Version 1.0.0, 16-JUN-2003 (EDW)
3-dimensional vector_transpose times matrix times vector
|