trick/trick_source/trick_utils/math/src/dmtxm.c

31 lines
1.3 KiB
C
Raw Normal View History

/*
2015-02-26 15:02:31 +00:00
PURPOSE: (Matrix transpose times matrix)
ASSUMPTIONS AND LIMITATIONS: ((3x3 Matrix implementation))
PROGRAMMERS: (((Les Quiocho) (NASA/JSC) (Jan 1990) (v1.0) (Init Release))) */
#include "trick/trick_math.h"
2015-02-26 15:02:31 +00:00
void dmtxm(double prod[3][3], /* Out: product of the two matrices */
double mat1[3][3], /* In: matrix 1 */
double mat2[3][3])
{ /* In: matrix 2 */
double trans[3][3];
dm_trans(trans, mat1);
prod[0][0] = trans[0][0] * mat2[0][0] + trans[0][1] * mat2[1][0] + trans[0][2] * mat2[2][0];
prod[0][1] = trans[0][0] * mat2[0][1] + trans[0][1] * mat2[1][1] + trans[0][2] * mat2[2][1];
prod[0][2] = trans[0][0] * mat2[0][2] + trans[0][1] * mat2[1][2] + trans[0][2] * mat2[2][2];
prod[1][0] = trans[1][0] * mat2[0][0] + trans[1][1] * mat2[1][0] + trans[1][2] * mat2[2][0];
prod[1][1] = trans[1][0] * mat2[0][1] + trans[1][1] * mat2[1][1] + trans[1][2] * mat2[2][1];
prod[1][2] = trans[1][0] * mat2[0][2] + trans[1][1] * mat2[1][2] + trans[1][2] * mat2[2][2];
prod[2][0] = trans[2][0] * mat2[0][0] + trans[2][1] * mat2[1][0] + trans[2][2] * mat2[2][0];
prod[2][1] = trans[2][0] * mat2[0][1] + trans[2][1] * mat2[1][1] + trans[2][2] * mat2[2][1];
prod[2][2] = trans[2][0] * mat2[0][2] + trans[2][1] * mat2[1][2] + trans[2][2] * mat2[2][2];
return;
}