aimstil  5.0.5
symmatrix3tools.h
Go to the documentation of this file.
1 #ifndef TIL_SYMMATRIX3_TOOLS_H
2 #define TIL_SYMMATRIX3_TOOLS_H
3 
5 
6 // includes from TIL
7 #include "til/eigen3D.h"
8 #include "til/numeric_array.h"
9 
10 // Namespace
11 
12 namespace til
13 {
14  //namespace linalg {
15 
16 // Computes the eigenvalues of a SymMatrix3
17 
18 template < class T >
19 void eigen3D(const SymMatrix3<T> & mat, numeric_array<T,3> & vec)
20 {
21  T v1, v2, v3;
22 
23  eigen3D(mat(0,0), mat(0,1), mat(0,2), mat(1,1), mat(1,2), mat(2,2),
24  v1, v2, v3);
25 
26  vec[0] = v1;
27  vec[1] = v2;
28  vec[2] = v3;
29 }
30 
31 
32 // Computes the eigenvalues of a SymMatrix3
33 
34 template < class T >
35 void eigen3D(const SymMatrix3<T> & mat, T & v1, T & v2, T & v3)
36 {
37  eigen3D(mat(0,0), mat(0,1), mat(0,2), mat(1,1), mat(1,2), mat(2,2),
38  v1, v2, v3);
39 }
40 
41 
42 template < typename T1, typename T2 >
43 INLINE void add(const SymMatrix3<T1> & mat1,
44  SymMatrix3<T2> & mat2)
45 {
46  for (std::size_t j = 0; j < 3; ++j)
47  {
48  for (std::size_t i = j; j < 3; ++j)
49  {
50  mat2(i,j) += mat1(i,j);
51  }
52  }
53 }
54 
55  //} // namespace linalg
56 } // namespace til
57 
58 
59 #endif
60 
61 
A class to store a 3*3 symetric matrix.
Definition: SymMatrix3.h:23
Belongs to package Box Do not include directly, include til/Box.h instead.
Definition: Accumulator.h:10
TRes add(T1 x, T2 y)
Definition: functors.h:394
#define INLINE
Definition: til_common.h:26
void eigen3D(T A11, T A12, T A13, T A22, T A23, T A33, T &ev1, T &ev2, T &ev3)
Definition: eigen3D.h:74