Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

MatMulVec.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Matrix_MatMulVec_h
00002 #define Impala_Core_Matrix_MatMulVec_h
00003 
00004 #include "Core/Matrix/MatFunc.h"
00005 #include "Core/Array/Element/Vec3Real64.h"
00006 
00007 namespace Impala
00008 {
00009 namespace Core
00010 {
00011 namespace Matrix
00012 {
00013 
00014 
00015 template<class ArrayT>
00016 inline Array::Element::Vec3Real64
00017 MatMulVec(ArrayT* m, Array::Element::Vec3Real64 b)
00018 {
00019     if ((MatNrRow(m) != 3) || (MatNrCol(m) != 3))
00020     {
00021         std::cerr << "nonconformant MatMulVec operands." << std::endl;
00022         return Array::Element::Vec3Real64(0, 0, 0);
00023     }
00024     double v[3];
00025     for (int i=0 ; i<MatNrRow(m) ; i++)
00026     {
00027         v[i] = *MatE(m, i, 0) * b.X() +
00028                *MatE(m, i, 1) * b.Y() +
00029                *MatE(m, i, 2) * b.Z();
00030     }
00031     return Array::Element::Vec3Real64(v[0], v[1], v[2]);
00032 }
00033 
00034 } // namespace Matrix
00035 } // namespace Core
00036 } // namespace Impala
00037 
00038 #endif

Generated on Fri Mar 19 09:31:16 2010 for ImpalaSrc by  doxygen 1.5.1