mirror of
https://github.com/nasa/trick.git
synced 2024-12-22 22:42:26 +00:00
Update matrix_macros.h with MxMxV macro. ref #385
This commit is contained in:
parent
31f0ea95ad
commit
d19374020d
@ -300,4 +300,23 @@ Print matrix M to stderr.
|
|||||||
fprintf( stderr, "%f %f %f\n" , mat[2][0] , mat[2][1] , mat[2][2] ) ; \
|
fprintf( stderr, "%f %f %f\n" , mat[2][0] , mat[2][1] , mat[2][2] ) ; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@page MATRIX_MACROS Matrix Macros
|
||||||
|
\b MxMxV(P, A, B, V)
|
||||||
|
Assigns the product of A, B, and V to P.
|
||||||
|
\f[
|
||||||
|
p_i = \sum_{j=0}^{2} A_{i,j} \left( \sum_{k=0}^{2} B_{j,k} \cdot v_i \right) : i\in 0..2
|
||||||
|
\f]
|
||||||
|
*/
|
||||||
|
#define MxMxV(prod, mat1, mat2, v ) { \
|
||||||
|
prod[0] = mat1[0][0] *(mat2[0][0] * vect[0] + mat2[0][1] * vect[1] + mat2[0][2] * vect[2])+\
|
||||||
|
mat1[0][1] *(mat2[1][0] * vect[0] + mat2[1][1] * vect[1] + mat2[1][2] * vect[2])+\
|
||||||
|
mat1[0][2] *(mat2[2][0] * vect[0] + mat2[2][1] * vect[1] + mat2[2][2] * vect[2]);\
|
||||||
|
prod[1] = mat1[1][0] *(mat2[0][0] * vect[0] + mat2[0][1] * vect[1] + mat2[0][2] * vect[2])+\
|
||||||
|
mat1[1][1] *(mat2[1][0] * vect[0] + mat2[1][1] * vect[1] + mat2[1][2] * vect[2])+\
|
||||||
|
mat1[1][2] *(mat2[2][0] * vect[0] + mat2[2][1] * vect[1] + mat2[2][2] * vect[2]);\
|
||||||
|
prod[2] = mat1[2][0] *(mat2[0][0] * vect[0] + mat2[0][1] * vect[1] + mat2[0][2] * vect[2])+\
|
||||||
|
mat1[2][1] *(mat2[1][0] * vect[0] + mat2[1][1] * vect[1] + mat2[1][2] * vect[2])+\
|
||||||
|
mat1[2][2] *(mat2[2][0] * vect[0] + mat2[2][1] * vect[1] + mat2[2][2] * vect[2]);\
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user