#include #ifndef USE_SSE2 // Matrix class without SIMD instructions class DMatrix4x2{ public: DMatrix4x2(){ for (unsigned int i=0;i<2;i++){ for (unsigned int j=0;j<4;j++){ mA[i][j]=0.; } } } DMatrix4x2(double A1, double A2, double B1, double B2, double C1, double C2, double D1, double D2){ mA[0][0]=A1; mA[0][1]=A2; mA[1][0]=B1; mA[1][1]=B2; mA[2][0]=C1; mA[2][1]=C2; mA[3][0]=D1; mA[3][1]=D2; } ~DMatrix4x2(){}; double &operator() (int row,int col){ return mA[row][col]; } double operator() (int row,int col) const{ return mA[row][col]; } // Assignment operator DMatrix4x2 &operator=(const DMatrix4x2 &m2){ for (unsigned int i=0;i<4;i++){ mA[i][0]=m2(i,0); mA[i][1]=m2(i,1); } return *this; } // Matrix multiplication: (4x2) x (2x1) DMatrix4x1 operator*(const DMatrix2x1 &m2){ return DMatrix4x1(mA[0][0]*m2(0)+mA[0][1]*m2(1), mA[1][0]*m2(0)+mA[1][1]*m2(1), mA[2][0]*m2(0)+mA[2][1]*m2(1), mA[3][0]*m2(0)+mA[3][1]*m2(1) ); } // Matrix multiplication: (4x2) x (2x2) DMatrix4x2 operator*(const DMatrix2x2 &m2){ return DMatrix4x2(mA[0][0]*m2(0,0)+mA[0][1]*m2(1,0), mA[0][0]*m2(0,1)+mA[0][1]*m2(1,1), mA[1][0]*m2(0,0)+mA[1][1]*m2(1,0), mA[1][0]*m2(0,1)+mA[1][1]*m2(1,1), mA[2][0]*m2(0,0)+mA[2][1]*m2(1,0), mA[2][0]*m2(0,1)+mA[2][1]*m2(1,1), mA[3][0]*m2(0,0)+mA[3][1]*m2(1,0), mA[3][0]*m2(0,1)+mA[3][1]*m2(1,1) ); } void Print(){ cout << "DMatrix4x2:" <