ESyS-Particle
4.0.1
|
00001 00002 // // 00003 // Copyright (c) 2003-2011 by The University of Queensland // 00004 // Earth Systems Science Computational Centre (ESSCC) // 00005 // http://www.uq.edu.au/esscc // 00006 // // 00007 // Primary Business: Brisbane, Queensland, Australia // 00008 // Licensed under the Open Software License version 3.0 // 00009 // http://www.opensource.org/licenses/osl-3.0.php // 00010 // // 00012 00013 #ifndef __MATRIX3_H 00014 #define __MATRIX3_H 00015 00016 #define DO_INLINE_MATRIX3 1 00017 00018 #if DO_INLINE_MATRIX3 >= 1 00019 #define MATRIX3_INLINE inline 00020 #else 00021 #define MATRIX3_INLINE 00022 #endif 00023 00024 // --- IO includes --- 00025 #include <iostream> 00026 using std::ostream; 00027 00029 class MatSingularError 00030 { 00031 public: 00032 MATRIX3_INLINE MatSingularError() 00033 { 00034 }; 00035 }; 00036 00037 00038 class Vec3 ; 00047 class Matrix3 00048 { 00049 private: 00050 double m[3][3]; 00051 00052 public: 00053 MATRIX3_INLINE Matrix3(); 00054 MATRIX3_INLINE Matrix3(const Vec3&, const Vec3&,const Vec3&); 00055 MATRIX3_INLINE Matrix3(const double[3][3]); 00056 MATRIX3_INLINE Matrix3(const Matrix3&); 00057 MATRIX3_INLINE virtual ~Matrix3(); 00058 00059 MATRIX3_INLINE double det(); 00060 Vec3 solve(const Vec3&) const; 00061 Vec3 solve_homogeneous() const; 00062 void invert(); 00063 MATRIX3_INLINE Matrix3 inv(); 00064 MATRIX3_INLINE void transpose(); 00065 MATRIX3_INLINE Matrix3 trans() const; 00066 MATRIX3_INLINE Vec3 operator *(const Vec3&) const; 00067 MATRIX3_INLINE Matrix3 operator *(double) const; 00068 MATRIX3_INLINE Matrix3 operator /(double) const; 00069 MATRIX3_INLINE Matrix3 operator *(const Matrix3&) const; 00070 MATRIX3_INLINE Matrix3& operator +=(const Matrix3&); 00071 MATRIX3_INLINE Matrix3 operator +(const Matrix3&)const; 00072 MATRIX3_INLINE Matrix3 operator -(const Matrix3&)const; 00073 MATRIX3_INLINE bool operator==(const Matrix3&)const; 00074 MATRIX3_INLINE Matrix3 &operator=(const Matrix3&); 00075 MATRIX3_INLINE double trace() const; 00076 MATRIX3_INLINE double norm() const; 00077 00078 MATRIX3_INLINE double operator()(int i, int j) const {return m[i][j];} 00079 00080 MATRIX3_INLINE double& operator()(int i, int j){return m[i][j];} 00081 00082 MATRIX3_INLINE friend Matrix3 operator*(double,const Matrix3&); 00083 00085 MATRIX3_INLINE friend Matrix3 star(const Vec3&); 00086 00088 MATRIX3_INLINE static Matrix3 Unit(); 00089 00091 void eigen(Vec3&,Vec3&,Vec3&,double&,double&,double&); 00092 00093 // output 00094 MATRIX3_INLINE friend ostream& operator<<(ostream&,const Matrix3&); 00095 }; 00096 00097 #if DO_INLINE_MATRIX3 >= 1 00098 #include "Foundation/Matrix3.hpp" 00099 #endif 00100 00101 #endif //__MATRIX3_H