ESyS-Particle  2.3.2
Matrix3.h
Go to the documentation of this file.
1 
2 // //
3 // Copyright (c) 2003-2014 by The University of Queensland //
4 // Centre for Geoscience Computing //
5 // http://earth.uq.edu.au/centre-geoscience-computing //
6 // //
7 // Primary Business: Brisbane, Queensland, Australia //
8 // Licensed under the Open Software License version 3.0 //
9 // http://www.opensource.org/licenses/osl-3.0.php //
10 // //
12 
13 #ifndef __MATRIX3_H
14 #define __MATRIX3_H
15 
16 #define DO_INLINE_MATRIX3 1
17 
18 #if DO_INLINE_MATRIX3 >= 1
19 #define MATRIX3_INLINE inline
20 #else
21 #define MATRIX3_INLINE
22 #endif
23 
24 // --- IO includes ---
25 #include <iostream>
26 using std::ostream;
27 
30 {
31 public:
33  {
34  };
35 };
36 
37 
38 class Vec3 ;
47 class Matrix3
48 {
49 private:
50  double m[3][3];
51 
52 public:
54  MATRIX3_INLINE Matrix3(const Vec3&, const Vec3&,const Vec3&);
55  MATRIX3_INLINE Matrix3(const double[3][3]);
57  MATRIX3_INLINE virtual ~Matrix3();
58 
59  MATRIX3_INLINE double det();
60  Vec3 solve(const Vec3&) const;
61  Vec3 solve_homogeneous() const;
62  void invert();
64  MATRIX3_INLINE void transpose();
65  MATRIX3_INLINE Matrix3 trans() const;
66  MATRIX3_INLINE Vec3 operator *(const Vec3&) const;
67  MATRIX3_INLINE Matrix3 operator *(double) const;
68  MATRIX3_INLINE Matrix3 operator /(double) const;
73  MATRIX3_INLINE bool operator==(const Matrix3&)const;
75  MATRIX3_INLINE double trace() const;
76  MATRIX3_INLINE double norm() const;
77 
78  MATRIX3_INLINE double operator()(int i, int j) const {return m[i][j];}
79 
80  MATRIX3_INLINE double& operator()(int i, int j){return m[i][j];}
81 
82  MATRIX3_INLINE friend Matrix3 operator*(double,const Matrix3&);
83 
85  MATRIX3_INLINE friend Matrix3 star(const Vec3&);
86 
88  MATRIX3_INLINE static Matrix3 Unit();
89 
91  void eigen(Vec3&,Vec3&,Vec3&,double&,double&,double&);
92 
93  // output
94  MATRIX3_INLINE friend ostream& operator<<(ostream&,const Matrix3&);
95 };
96 
97 #if DO_INLINE_MATRIX3 >= 1
98 #include "Foundation/Matrix3.hpp"
99 #endif
100 
101 #endif //__MATRIX3_H