LieAlgebra.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2009-2013 CEA LIST (DIASI/LSI) <xde-support@saxifrage.cea.fr>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 #ifndef EIGEN_LGSM_LIE_ALGEBRA_H
11 #define EIGEN_LGSM_LIE_ALGEBRA_H
12 
13 /***************************************************************************
14 * Definition/implementation of LieAlgebraBase<A, Derived>
15 ***************************************************************************/
16 
29 namespace internal {
30  template<class A, class Derived>
31  struct traits<LieAlgebraBase<A, Derived> > : public traits<A> {};
32 }
33 
34 template<class A, class Derived> class LieAlgebraBase : public MatrixBase<Derived> {
35 protected:
37  typedef MatrixBase<Derived> Base;
38 public:
39  // inherit MatrixBase interface
40  EIGEN_DENSE_PUBLIC_INTERFACE(LieAlgebraBase)
41  // inherit operator=
42  EIGEN_INHERIT_ASSIGNMENT_OPERATORS(LieAlgebraBase)
43  // accessor needed for MatrixBase inheritance
44  LIE_INHERIT_MATRIX_BASE(A::RowsAtCompileTime, A::ColsAtCompileTime)
45 
47  typedef A BaseType;
49  typedef typename internal::traits<Derived>::Coefficients Coefficients;
51  typedef LieAlgebra<BaseType> PlainObject;
53  typedef LieAlgebraDual<BaseType> AlgebraDual;
55  typedef typename Derived::LieGroup Group;
56 
57 
59  template<class OtherDerived> inline PlainObject bracket(const LieAlgebraBase<BaseType, OtherDerived>& a) const;
61  template<class OtherDerived> inline const PlainObject adjoint(const LieAlgebraBase<BaseType, OtherDerived>& a) const;
62 
65  Group exp(Scalar precision = 1.e-6) const;
66 
68  inline const Derived& derived() const { return *static_cast<const Derived*>(this); }
70  inline Derived& derived() { return *static_cast<Derived*>(this); }
71 
73  inline Coefficients& get();
75  inline const Coefficients& get() const;
76 };
77 
78 /***************************************************************************
79 * Definition/implementation of LieAlgebraDualBase<A, Derived>
80 ***************************************************************************/
81 
94 namespace internal {
95  template<class A, class Derived>
96  struct traits<LieAlgebraDualBase<A, Derived> > : public traits<A> {};
97 }
98 
99 template<class A, class Derived> class LieAlgebraDualBase : public MatrixBase<Derived > {
100 protected:
102  typedef MatrixBase<Derived> Base;
103 public:
104  // inherit MatrixBase interface
105  EIGEN_DENSE_PUBLIC_INTERFACE(LieAlgebraDualBase)
106  // inherit operator=
107  //EIGEN_INHERIT_ASSIGNMENT_OPERATORS(LieAlgebraDualBase)
108  // accessor needed for MatrixBase inheritance
109  LIE_INHERIT_MATRIX_BASE(A::RowsAtCompileTime, A::ColsAtCompileTime)
110 
111 
113  EIGEN_STRONG_INLINE LieAlgebraDualBase& operator=(const LieAlgebraDualBase& other) {
114  this->get() = other.get();
115  return *this;
116  }
118  template<class BaseType, class OtherDerived> EIGEN_STRONG_INLINE Derived& operator=(const LieAlgebraDualBase<BaseType, OtherDerived>& other) {
119  this->get() = other.get();
120  return derived();
121  }
122 
124  typedef A BaseType;
126  typedef typename internal::traits<Derived>::Coefficients Coefficients;
132  typedef typename internal::traits<Derived>::Group Group;
133 
135  inline const Derived& derived() const { return *static_cast<const Derived*>(this); }
137  inline Derived& derived() { return *static_cast<Derived*>(this); }
138 
140  inline Coefficients& get() {return this->derived().get(); }
142  inline const Coefficients& get() const {return this->derived().get(); }
143 };
144 
145 
146 /***************************************************************************
147 * Definition of LieAlgebra<A>
148 ***************************************************************************/
149 
150 namespace internal {
151  template<class A>
152  struct traits<LieAlgebra<A> > : public traits<LieAlgebraBase<A, LieAlgebra<A> > >
153  {
154  typedef A Coefficients;
155  };
156 }
157 
168 template<class A> class LieAlgebra : public LieAlgebraBase<A, LieAlgebra<A> > {
169 protected:
172 public:
173  // inherit MatrixBase operator
174  EIGEN_DENSE_PUBLIC_INTERFACE(LieAlgebra)
175  // inherit assignement operator
176  EIGEN_INHERIT_ASSIGNMENT_OPERATORS(LieAlgebra)
177 
179  typedef typename internal::traits<LieAlgebra<A> >::Coefficients Coefficients;
180 
182  inline LieAlgebra(const LieAlgebra&);
183 
185  inline Coefficients& get() { return m_coeffs; }
187  inline const Coefficients& get() const { return m_coeffs; }
188 
189 protected:
192 };
193 
194 /***************************************************************************
195 * Definition of LieAlgebraDual<A>
196 ***************************************************************************/
197 
198 namespace internal {
199  template<class A>
200  struct traits<LieAlgebraDual<A> > : public traits<LieAlgebraDualBase<A, LieAlgebraDual<A> > >
201  {
202  typedef A Coefficients;
203  };
204 }
205 
216 template<class A> class LieAlgebraDual : public LieAlgebraDualBase<A, LieAlgebraDual<A> > {
217 protected:
220 public:
221  // inherit MatrixBase operator
222  EIGEN_DENSE_PUBLIC_INTERFACE(LieAlgebraDual)
223  // inherit assignement operator
224  EIGEN_INHERIT_ASSIGNMENT_OPERATORS(LieAlgebraDual)
225 
227  typedef typename internal::traits<LieAlgebraDual<A> >::Coefficients Coefficients;
228 
230  inline LieAlgebraDual(const LieAlgebraDual&);
231 
233  inline Coefficients& get() { return m_coeffs; }
235  inline const Coefficients& get() const { return m_coeffs; }
236 protected:
239 };
240 
241 
242 /***************************************************************************
243 * Definition of Map<LieAlgebra<A> >
244 ***************************************************************************/
245 
246 namespace internal {
247  template<class A, int MapOptions, typename StrideType>
248  struct traits<Map<LieAlgebra<A>, MapOptions, StrideType> > : public traits<LieAlgebraBase<A, Map<LieAlgebra<A>, MapOptions, StrideType> > >
249  {
250  typedef Map<A, MapOptions, StrideType> Coefficients;
251  };
252 }
253 
254 namespace internal {
255  template<class A, int MapOptions, typename StrideType>
256  struct traits<Map<const LieAlgebra<A>, MapOptions, StrideType> > : public traits<LieAlgebraBase<A, Map<const LieAlgebra<A>, MapOptions, StrideType> > >
257  {
258  typedef Map<const A, MapOptions, StrideType> Coefficients;
259  };
260 }
261 
276 template<class A, int MapOptions, typename StrideType>
277 class Map<LieAlgebra<A>, MapOptions, StrideType> : public LieAlgebraBase<A, Map<LieAlgebra<A>, MapOptions, StrideType> > {
278  protected:
280  typedef LieAlgebraBase<A, Map<LieAlgebra<A>, MapOptions, StrideType> > Base;
281  public:
282  // inherit MatrixBase operator
283  EIGEN_DENSE_PUBLIC_INTERFACE(Map)
284  // inherit assignement operator
285  EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Map)
286 
288  typedef typename internal::traits<Map<LieAlgebra<A>, MapOptions, StrideType> >::Coefficients Coefficients;
289 
291  Map(const A& a) : m_coeffs(a.data()) {};
293  Map(Scalar* data) : m_coeffs(data) {};
295  Map(const Map& m) : m_coeffs(m.get()) {};
296 
298  Coefficients& get() { return m_coeffs; }
300  const Coefficients& get() const { return m_coeffs; }
301 
302  protected:
305 };
306 
307 template<class A, int MapOptions, typename StrideType>
308 class Map<const LieAlgebra<A>, MapOptions, StrideType> : public LieAlgebraBase<A, Map<const LieAlgebra<A>, MapOptions, StrideType> > {
309  protected:
311  typedef LieAlgebraBase<A, Map<const LieAlgebra<A>, MapOptions, StrideType> > Base;
312  public:
313  // inherit MatrixBase operator
314  EIGEN_DENSE_PUBLIC_INTERFACE(Map)
315 
316 
317  typedef typename internal::traits<Map<const LieAlgebra<A>, MapOptions, StrideType> >::Coefficients Coefficients;
318 
320  Map(const A& a) : m_coeffs(a.data()) {};
322  Map(const Scalar* data) : m_coeffs(data) {};
324  Map(const Map& m) : m_coeffs(m.get()) {};
325 
327  Coefficients& get() { return m_coeffs; }
329  const Coefficients& get() const { return m_coeffs; }
330 
331  protected:
334 };
335 
336 
337 /***************************************************************************
338  * Definition of Map<LieAlgebraDual<A> >
339  ***************************************************************************/
340 
341 namespace internal {
342  template<class A, int MapOptions, typename StrideType>
343  struct traits<Map<LieAlgebraDual<A>, MapOptions, StrideType> > : public traits<LieAlgebraDualBase<A, Map<LieAlgebraDual<A>, MapOptions, StrideType> > >
344  {
345  typedef Map<A, MapOptions, StrideType> Coefficients;
346  };
347 
348  template<class A, int MapOptions, typename StrideType>
349  struct traits<Map<const LieAlgebraDual<A>, MapOptions, StrideType> > : public traits<LieAlgebraDualBase<A, Map<const LieAlgebraDual<A>, MapOptions, StrideType> > >
350  {
351  typedef Map<A, MapOptions, StrideType> Coefficients;
352  };
353 
354 }
369 template<class A, int MapOptions, typename StrideType>
370 class Map<LieAlgebraDual<A>, MapOptions, StrideType> : public LieAlgebraDualBase<A, Map<LieAlgebraDual<A>, MapOptions, StrideType> > {
371  protected:
373  typedef LieAlgebraDualBase<A, Map<LieAlgebraDual<A>, MapOptions, StrideType> > Base;
374  public:
375  // inherit MatrixBase operator
376  EIGEN_DENSE_PUBLIC_INTERFACE(Map)
377  // inherit assignement operator
378  EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Map)
379 
381  typedef typename internal::traits<Map<LieAlgebraDual<A>, MapOptions, StrideType> >::Coefficients Coefficients;
382 
384  Map(const A& a) : m_coeffs(a) {};
386  Map(Scalar* data) : m_coeffs(data) {};
388  Map(const Map& m) : m_coeffs(m.get()) {};
389 
391  Coefficients& get() { return m_coeffs; }
393  const Coefficients& get() const { return m_coeffs; }
394 
395  protected:
398 };
399 
400 template<class A, int MapOptions, typename StrideType>
401 class Map<const LieAlgebraDual<A>, MapOptions, StrideType> : public LieAlgebraDualBase<A, Map<const LieAlgebraDual<A>, MapOptions, StrideType> > {
402  protected:
404  typedef LieAlgebraDualBase<A, Map<const LieAlgebraDual<A>, MapOptions, StrideType> > Base;
405  public:
406  // inherit MatrixBase operator
407  EIGEN_DENSE_PUBLIC_INTERFACE(Map)
408 
409 
410  typedef typename internal::traits<Map<const LieAlgebraDual<A>, MapOptions, StrideType> >::Coefficients Coefficients;
411 
413  Map(const A& a) : m_coeffs(a) {};
415  Map(const Scalar* data) : m_coeffs(data) {};
417  Map(const Map& m) : m_coeffs(m.get()) {};
418 
420  Coefficients& get() { return m_coeffs; }
422  const Coefficients& get() const { return m_coeffs; }
423 
424  protected:
427 };
428 
429 #endif
430 
LieAlgebraBase< A, LieAlgebra< A > > Base
Definition: LieAlgebra.h:171
Derived & derived()
Definition: LieAlgebra.h:70
internal::traits< Map< LieAlgebra< A >, MapOptions, StrideType > >::Coefficients Coefficients
Definition: LieAlgebra.h:288
LieAlgebraBase< A, Map< LieAlgebra< A >, MapOptions, StrideType > > Base
Definition: LieAlgebra.h:280
Class describing an element of a Lie Algebra.
Definition: LieAlgebra.h:168
Coefficients m_coeffs
Definition: LieAlgebra.h:238
LieAlgebraDualBase< A, LieAlgebraDual< A > > Base
Definition: LieAlgebra.h:218
LieAlgebraDualBase< A, Map< LieAlgebraDual< A >, MapOptions, StrideType > > Base
Definition: LieAlgebra.h:373
internal::traits< Derived >::Group Group
Definition: LieAlgebra.h:132
MatrixBase< Derived > Base
Definition: LieAlgebra.h:37
Derived & derived()
Definition: LieAlgebra.h:137
internal::traits< Derived >::Coefficients Coefficients
Definition: LieAlgebra.h:126
internal::traits< LieAlgebra< A > >::Coefficients Coefficients
Definition: LieAlgebra.h:179
internal::traits< Map< const LieAlgebra< A >, MapOptions, StrideType > >::Coefficients Coefficients
Definition: LieAlgebra.h:317
EIGEN_STRONG_INLINE Derived & operator=(const LieAlgebraDualBase< BaseType, OtherDerived > &other)
Definition: LieAlgebra.h:118
const Derived & derived() const
Definition: LieAlgebra.h:135
internal::traits< LieAlgebraDual< A > >::Coefficients Coefficients
Definition: LieAlgebra.h:227
LieAlgebraDualBase< A, Map< const LieAlgebraDual< A >, MapOptions, StrideType > > Base
Definition: LieAlgebra.h:404
LieAlgebraDual< BaseType > PlainObject
Definition: LieAlgebra.h:128
Coefficients m_coeffs
Definition: LieAlgebra.h:191
LieAlgebra< BaseType > Algebra
Definition: LieAlgebra.h:130
#define LIE_INHERIT_MATRIX_BASE(r, c)
Definition: Macros.h:13
internal::traits< Map< const LieAlgebraDual< A >, MapOptions, StrideType > >::Coefficients Coefficients
Definition: LieAlgebra.h:410
MatrixBase< Derived > Base
Definition: LieAlgebra.h:102
Base class for all Lie Algebra class.
Definition: Displacement.h:139
internal::traits< Map< LieAlgebraDual< A >, MapOptions, StrideType > >::Coefficients Coefficients
Definition: LieAlgebra.h:381
LieAlgebraBase< A, Map< const LieAlgebra< A >, MapOptions, StrideType > > Base
Definition: LieAlgebra.h:311
Coefficients & get()
Definition: LieAlgebra.h:140
Class describing an element of a Lie Group.
Definition: LieGroup.h:117
Class describing an element of a Lie algebra dual.
Definition: LieAlgebra.h:216


lgsm
Author(s): Roberto Martín-Martín
autogenerated on Mon Jun 10 2019 14:05:58