00001
00002
00003 inline double det(const dsymat2& A)
00004 {VERBOSE_REPORT;
00005 return A(0,0)*A(1,1) -A(1,0)*A(1,0);
00006 }
00007
00008
00009
00010 inline dsymat2 inv(const dsymat2& A)
00011 {VERBOSE_REPORT;
00012 const double Adet( det(A) );
00013 dsymat2 Ainv;
00014 Ainv(0,0)= A(1,1)/Adet;
00015 Ainv(1,0)=-A(1,0)/Adet; Ainv(1,1)= A(0,0)/Adet;
00016 return Ainv;
00017 }
00018
00019
00020
00021 inline dsymat2 rotate(const dsymat2& m, const double& theta)
00022 {VERBOSE_REPORT;
00023 double c(cos(theta)), s(sin(theta));
00024 double cc(c*c), cs(c*s), ss(s*s);
00025 dsymat2 mat;
00026 mat(0,0) =m(0,0)*cc -2.*m(1,0)*cs +m(1,1)*ss;
00027 mat(1,0) =m(1,0)*cc +(m(0,0)-m(1,1))*cs -m(1,0)*ss;
00028 mat(1,1) =m(1,1)*cc +2.*m(1,0)*cs +m(0,0)*ss;
00029 return mat;
00030 }
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 inline double det(const dsymat3& A)
00045 {VERBOSE_REPORT;
00046 return
00047 +A(0,0)*A(1,1)*A(2,2) -A(0,0)*A(2,1)*A(2,1)
00048 +A(1,0)*A(2,1)*A(2,0) -A(1,0)*A(1,0)*A(2,2)
00049 +A(2,0)*A(1,0)*A(2,1) -A(2,0)*A(1,1)*A(2,0);
00050 }
00051
00052
00053
00054 inline dsymat3 inv(const dsymat3& A)
00055 {VERBOSE_REPORT;
00056 const double Adet( det(A) );
00057 dsymat3 Ainv;
00058 Ainv(0,0) =(A(1,1)*A(2,2)-A(2,1)*A(2,1))/Adet;
00059 Ainv(1,0) =(A(2,1)*A(2,0)-A(1,0)*A(2,2))/Adet;
00060 Ainv(1,1) =(A(0,0)*A(2,2)-A(2,0)*A(2,0))/Adet;
00061 Ainv(2,0) =(A(1,0)*A(2,1)-A(1,1)*A(2,0))/Adet;
00062 Ainv(2,1) =(A(1,0)*A(2,0)-A(0,0)*A(2,1))/Adet;
00063 Ainv(2,2) =(A(0,0)*A(1,1)-A(1,0)*A(1,0))/Adet;
00064 return Ainv;
00065 }
00066
00067
00068
00069 inline dsymat3 rotate(const dsymat3& m, const dquater& q)
00070 {VERBOSE_REPORT;
00071 dgemat3 R =q2m(q);
00072 dgemat3 Rm =R*m;
00073
00074 dsymat3 RmRT;
00075 RmRT.zero();
00076 for(long i=0; i<3; i++){
00077 for(long j=0; j<=i; j++){
00078 for(long k=0; k<3; k++){
00079 RmRT(i,j) +=Rm(i,k)*R(j,k);
00080 }
00081 }
00082 }
00083 return RmRT;
00084 }