//File name : exMat2d.cc //Description: an example of 2*2 matrix usage //Modification: 23/7/98 #include #include "amma/Matrix2d.hh" #include "amma/VecMat2d.hh" #include "amma/StdMath.hh" #include "amma/StdStrm.hh" int main() { //Generate two rotation matrices double angle1 = 30./180. *3.14159265; double angle2 = 45./180. *3.14159265; Matrix2d2C rot1 (::Cos(angle1), -::Sin(angle1), ::Sin(angle1), ::Cos(angle1)); Matrix2d2C rot2 (::Cos(angle2), -::Sin(angle2), ::Sin(angle2), ::Cos(angle2)); //Generate a matrix. Matrix2d2C m1(-3, 0, 0, 5) ; //Transposition of a matrix Matrix2d2C rot1T=rot1.T(); //Multiplication of matrices Matrix2d2C m2(rot1 * m1* rot1.T()); Matrix2d2C m3(rot2 * m1* rot1.T()); //Calculate eigenvalues Matrix2d2C eV(m2.EigenValues()); //Represent eigenvalues and its eigenvectors VecMat2dC eVV(m2.EigenSystem()); //Define three matrices as the output matrice of SVD Matrix2d2C u2, s2, v2; Matrix2d2C u3, s3, v3; //Calculate two matrices m1 and m2's SVD m2.SVD(u2,s2,v2); m3.SVD(u3,s3,v3); cout <<"rot1: " <