Geomi
LieAlgebraBase.hpp
1 #ifndef DEF_COMMON_LIEALGEBRABASE
2 #define DEF_COMMON_LIEALGEBRABASE
3 
28 template <typename T_DERIVED, typename T_GROUP, unsigned int T_DOF, typename T_SCALAR_TYPE>
29 class LieAlgebraBase : public CRTP<T_DERIVED>
30 {
31 public:
32  static const unsigned int DOF = T_DOF;
33 
34 public:
35  /* Group operations */
36 
42  T_DERIVED
43  inverse ( ) const;
44 
49  void
51  { this->underlying() = this->underlying().inverse(); }
52 
59  void
60  operator+= (const T_DERIVED& g);
61 
66  T_DERIVED
67  operator+ (const T_DERIVED& g) const
68  {
69  T_DERIVED res(this->underlying());
70  res += g;
71  return res;
72  }
73 
77  T_DERIVED
78  operator- (const T_DERIVED& g) const
79  {
80  T_DERIVED res(this->underlying());
81  res += g.inverse();
82  return res;
83  }
84 
90  static T_DERIVED
91  Zero ( );
92 
99  void
100  operator*= (T_SCALAR_TYPE s);
101 
106  T_DERIVED
107  operator* (const T_SCALAR_TYPE& s) const
108  {
109  T_DERIVED res(this->underlying());
110  res *= s;
111  return res;
112  }
113 
119  T_DERIVED
120  bracket (const T_DERIVED& g) const;
121 
126  // TODO: static_ added because the compiler doesn't seem to see this method
127  // when T_DERIVED already exists
128  static T_DERIVED
129  static_bracket (const T_DERIVED& g1, const T_DERIVED& g2)
130  { return g1.bracket(g2); }
131 
132  /* I didn't go further for the documentation */
133 
134  T_DERIVED
135  Ad (const T_GROUP& g) const;
136 
137  static T_DERIVED
138  static_Ad (const T_DERIVED& a, const T_GROUP& g)
139  { return a.Ad(g); }
140 
141  T_DERIVED
142  Ad_star (const T_GROUP& g) const;
143 
144  static T_DERIVED
145  static_Ad_star (const T_GROUP& g, const T_DERIVED& a)
146  { return a.Ad_star(g); }
147 
148  /* Other operations */
149 
150  T_SCALAR_TYPE
151  norm () const;
152 
156  T_GROUP
157  exp ( ) const;
158 
159  static T_GROUP
160  exp (const T_DERIVED& g)
161  { return g.exp(); }
162 
164  toNOXVector ( ) const;
165 
166  static const unsigned int
167  dof ()
168  { return DOF; }
169 };
170 
171 /*
172  * Faire quelque chose à propos de ça (friend?)
173  *
174 template <typename T_DERIVED, typename T_SCALAR_TYPE>
175 const T_DERIVED
176 operator* (T_SCALAR_TYPE s, const T_DERIVED g)
177 {
178  return g*s;
179 }
180 */
181 
182 #endif
T_DERIVED inverse() const
T_DERIVED operator-(const T_DERIVED &g) const
Definition: LieAlgebraBase.hpp:78
T_DERIVED operator*(const T_SCALAR_TYPE &s) const
Definition: LieAlgebraBase.hpp:107
static T_DERIVED static_bracket(const T_DERIVED &g1, const T_DERIVED &g2)
Definition: LieAlgebraBase.hpp:129
T_DERIVED bracket(const T_DERIVED &g) const
void inverted()
Definition: LieAlgebraBase.hpp:50
T_DERIVED operator+(const T_DERIVED &g) const
Definition: LieAlgebraBase.hpp:67
Definition: utils.hpp:42
Definition: LieAlgebraBase.hpp:29
void operator*=(T_SCALAR_TYPE s)
T_GROUP exp() const
void operator+=(const T_DERIVED &g)
static T_DERIVED Zero()
Definition: NOXVector.hpp:14