CPPLapack
 All Classes Files Functions Variables Friends
zhematrix_small-specialized.hpp
Go to the documentation of this file.
00001 //=============================================================================
00002 /*! calculate determinant */
00003 inline comple det(const zhemat2& A)
00004 {VERBOSE_REPORT;
00005   return A(0,0)*A(1,1) -A(1,0)*A(1,0);
00006 }
00007 
00008 //=============================================================================
00009 /*! calculate inverse */
00010 inline zhemat2 inv(const zhemat2& A)
00011 {VERBOSE_REPORT;
00012   const comple Adet( det(A) );
00013   zhemat2 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 ///////////////////////////////////////////////////////////////////////////////
00022 
00023 //=============================================================================
00024 /*! calculate determinant */
00025 inline comple det(const zhemat3& A)
00026 {VERBOSE_REPORT;
00027   return
00028     +A(0,0)*A(1,1)*A(2,2) -A(0,0)*A(2,1)*A(2,1)
00029     +A(1,0)*A(2,1)*A(2,0) -A(1,0)*A(1,0)*A(2,2)
00030     +A(2,0)*A(1,0)*A(2,1) -A(2,0)*A(1,1)*A(2,0);
00031 }
00032 
00033 //=============================================================================
00034 /*! calculate inverse */
00035 inline zhemat3 inv(const zhemat3& A)
00036 {VERBOSE_REPORT;
00037   const comple Adet( det(A) );
00038   zhemat3 Ainv;
00039   Ainv(0,0) =(A(1,1)*A(2,2)-A(2,1)*A(2,1))/Adet;
00040   Ainv(1,0) =(A(2,1)*A(2,0)-A(1,0)*A(2,2))/Adet;
00041   Ainv(1,1) =(A(0,0)*A(2,2)-A(2,0)*A(2,0))/Adet;
00042   Ainv(2,0) =(A(1,0)*A(2,1)-A(1,1)*A(2,0))/Adet;
00043   Ainv(2,1) =(A(1,0)*A(2,0)-A(0,0)*A(2,1))/Adet;
00044   Ainv(2,2) =(A(0,0)*A(1,1)-A(1,0)*A(1,0))/Adet;
00045   return Ainv;
00046 }
 All Classes Files Functions Variables Friends