mat-calc.hpp

Go to the documentation of this file.
00001 //=============================================================================
00002 /*! return its determinant */
00003 inline double det(const mat& m)
00004 {
00005   return
00006     m.xx*m.yy*m.zz + m.xy*m.yz*m.zx + m.xz*m.yx*m.zy
00007     -m.xx*m.yz*m.zy -m.xy*m.yx*m.zz -m.xz*m.yy*m.zx;
00008 }
00009 
00010 //=============================================================================
00011 /*! return its inverse matrix */
00012 inline mat inv(const mat& m)
00013 {
00014   double d( det(m) );
00015   return mat
00016     (
00017      (m.yy*m.zz-m.yz*m.zy)/d, (m.xz*m.zy-m.xy*m.zz)/d, (m.xy*m.yz-m.xz*m.yy)/d,
00018      (m.yz*m.zx-m.yx*m.zz)/d, (m.xx*m.zz-m.xz*m.zx)/d, (m.xz*m.yx-m.xx*m.yz)/d,
00019      (m.yx*m.zy-m.yy*m.zx)/d, (m.xy*m.zx-m.xx*m.zy)/d, (m.xx*m.yy-m.xy*m.yx)/d
00020      );
00021 }

Generated on Tue Mar 15 16:02:38 2005 for QVM by  doxygen 1.4.1