#include #ifndef USE_SSE2 // Matrix class without SIMD instructions class DMatrix2x4{ public: DMatrix2x4(){ for (unsigned int i=0;i<2;i++){ for (unsigned int j=0;j<4;j++){ mA[i][j]=0.; } } } DMatrix2x4(double c11, double c12, double c13, double c14, double c21, double c22, double c23, double c24){ mA[0][0]=c11; mA[0][1]=c12; mA[0][2]=c13; mA[0][3]=c14; mA[1][0]=c21; mA[1][1]=c22; mA[1][2]=c23; mA[1][3]=c24; } ~DMatrix2x4(){}; // Assignment DMatrix2x4& operator=(const DMatrix2x4 &m2){ for (unsigned int i=0;i<4;i++){ mA[0][i]=m2(0,i); mA[1][i]=m2(1,i); } return *this; } double &operator() (int row, int col){ return mA[row][col]; } double operator() (int row, int col) const{ return mA[row][col]; } // matrix multiplication: (2x4)x(4x2) DMatrix2x2 operator*(const DMatrix4x2 &m2){ return DMatrix2x2(mA[0][0]*m2(0,0)+mA[0][1]*m2(1,0)+mA[0][2]*m2(2,0)+mA[0][3]*m2(3,0), mA[0][0]*m2(0,1)+mA[0][1]*m2(1,1)+mA[0][2]*m2(2,1)+mA[0][3]*m2(3,1), mA[1][0]*m2(0,0)+mA[1][1]*m2(1,0)+mA[1][2]*m2(2,0)+mA[1][3]*m2(3,0), mA[1][0]*m2(0,1)+mA[1][1]*m2(1,1)+mA[1][2]*m2(2,1)+mA[1][3]*m2(3,1)); } // Matrix multiplication: (2x4) x (4x4) DMatrix2x4 operator*(const DMatrix4x4 &m2){ return DMatrix2x4(mA[0][0]*m2(0,0)+mA[0][1]*m2(1,0)+mA[0][2]*m2(2,0)+mA[0][3]*m2(3,0), mA[0][0]*m2(0,1)+mA[0][1]*m2(1,1)+mA[0][2]*m2(2,1)+mA[0][3]*m2(3,1), mA[0][0]*m2(0,2)+mA[0][1]*m2(1,2)+mA[0][2]*m2(2,2)+mA[0][3]*m2(3,2), mA[0][0]*m2(0,3)+mA[0][1]*m2(1,3)+mA[0][2]*m2(2,3)+mA[0][3]*m2(3,3), mA[1][0]*m2(0,0)+mA[1][1]*m2(1,0)+mA[1][2]*m2(2,0)+mA[1][3]*m2(3,0), mA[1][0]*m2(0,1)+mA[1][1]*m2(1,1)+mA[1][2]*m2(2,1)+mA[1][3]*m2(3,1), mA[1][0]*m2(0,2)+mA[1][1]*m2(1,2)+mA[1][2]*m2(2,2)+mA[1][3]*m2(3,2), mA[1][0]*m2(0,3)+mA[1][1]*m2(1,3)+mA[1][2]*m2(2,3)+mA[1][3]*m2(3,3)); } void Print(){ cout << "DMatrix2x4:" <