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
mtxv_c

 Procedure Abstract Required_Reading Keywords Brief_I/O Detailed_Input Detailed_Output Parameters Exceptions Files Particulars Examples Restrictions Literature_References Author_and_Institution Version Index_Entries

#### Procedure

```   mtxv_c ( Matrix transpose times vector, 3x3 )

void mtxv_c ( ConstSpiceDouble     m   [3][3],
ConstSpiceDouble     vin [3],
SpiceDouble          vout[3]   )

```

#### Abstract

```   Multiply the transpose of a 3x3 matrix on the left with a vector
on the right.
```

```   None.
```

#### Keywords

```   MATRIX
VECTOR

```

#### Brief_I/O

```   VARIABLE  I/O  DESCRIPTION
--------  ---  --------------------------------------------------
m          I   3x3 double precision matrix.
vin        I   3-dimensional double precision vector.
vout       O   3-dimensional double precision vector. `vout' is
the product m**t * vin.
```

#### Detailed_Input

```   m           is an arbitrary 3x3 double precision matrix.
Typically, `m' will be a rotation matrix since
then its transpose is its inverse (but this is NOT
a requirement).

vin         is an arbitrary 3-dimensional double precision
vector.
```

#### Detailed_Output

```   vout        is a 3-dimensional double precision vector. `vout' is
the product vout = (m**t)  x (vin). `vout' can
overwrite `vin'.
```

#### Parameters

```   None.
```

#### Exceptions

```   Error free.
```

#### Files

```   None.
```

#### Particulars

```   The code reflects precisely the following mathematical expression

For each value of the subscript `i' from 0 to 2:

2
.-----
\
vout(i) =   )  m[k][i] * 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.
```

#### Examples

```   The numerical results shown for this example may differ across
platforms. The results depend on the SPICE kernels used as
input, the compiler and supporting libraries, 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.

/.
Program mtxv_ex1
./
#include <stdio.h>
#include "SpiceUsr.h"

int main( )
{

/.
Local variables.
./
SpiceDouble          vout   [3];

/.
Define `m' and `vin'.
./
SpiceDouble          m      [3][3] = { { 1.0,  1.0,  0.0},
{-1.0,  1.0,  0.0},
{ 0.0,  0.0,  1.0} };

SpiceDouble          vin    [3] = { 5.0,  10.0,  15.0 };

/.
Multiply the transpose of `m' by `vin'.
./
mtxv_c ( m, vin, vout );

printf( "Transpose of M times VIN:\n" );
printf( "%10.3f %9.3f %9.3f\n", vout[0], vout[1], vout[2] );

return ( 0 );
}

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

Transpose of M 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.
```

#### Restrictions

```   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.
```

#### Literature_References

```   None.
```

#### Author_and_Institution

```   J. Diaz del Rio     (ODC Space)
W.M. Owen           (JPL)
E.D. Wright         (JPL)
```

#### Version

```   -CSPICE Version 1.1.0, 25-AUG-2021 (JDR)

Changed input argument name "m1" to "m" for consistency with
other routines.

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

-CSPICE Version 1.0.1, 10-NOV-2006 (EDW)

```   matrix_transpose times 3-dimensional vector
`Fri Dec 31 18:41:09 2021`