LieGroup.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_GROUP_H
11 #define EIGEN_LGSM_LIE_GROUP_H
12 
13 /***************************************************************************
14 * Definition/implementation of LieGroupBase<G, Derived>
15 ***************************************************************************/
16 
31 namespace internal {
32  template<class G, class Derived>
33  struct traits<LieGroupBase<G, Derived> > {
35  };
36 }
37 
38 
39 template<class G, class Derived> class LieGroupBase {
40 public:
41  /* List of typedef */
43  typedef typename Derived::Coefficients Coefficients;
45  typedef typename internal::traits<Derived>::Scalar Scalar;
47  typedef G BaseType;
49  typedef typename internal::traits<Derived>::PlainObject PlainObject;
51  typedef typename Derived::AdjointMatrix AdjointMatrix;
53  typedef typename Derived::Algebra Algebra;
55  typedef typename Derived::CoAlgebra CoAlgebra;
56 
58  PlainObject inverse() const;
60  static PlainObject Identity();
62  template<class OtherDerived> PlainObject operator*(const LieGroupBase<G, OtherDerived>& other) const;
63 
65  AdjointMatrix adjoint(void) const;
67  Algebra adjoint(const Algebra& ) const;
69  CoAlgebra adjointTr(const CoAlgebra& ) const;
70 
74  Algebra log(const Scalar precision = 1e-6) const;
75 
77  template<class OtherDerived> LieGroupBase& operator=(const LieGroupBase<G, OtherDerived>& );
78 
80  inline const Derived& derived() const { return *static_cast<const Derived*>(this); }
82  inline Derived& derived() { return *static_cast<Derived*>(this); }
83 
85  inline Coefficients& get();
87  inline const Coefficients& get() const;
88 };
89 
90 /***************************************************************************
91 * Definition of LieGroup<G>
92 ***************************************************************************/
93 
94 namespace internal {
95  template<class G>
96  struct traits<LieGroup<G> > : public traits<LieGroupBase<G, LieGroup<G> > >
97  {
98  typedef G Coefficients;
99  typedef typename G::Scalar Scalar;
100  };
101 }
102 
117 template<class G> class LieGroup : public LieGroupBase<G, LieGroup<G> > {
118 protected:
121 public:
122  // inherit assignement operator
123  EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(LieGroup)
124 
125 
126  typedef typename internal::traits<LieGroup<G> >::Coefficients Coefficients;
127 
129  inline LieGroup(const LieGroup&) {};
131  inline LieGroup() {};
132 
134  inline Coefficients& get() { return m_coeffs; }
136  inline const Coefficients& get() const { return m_coeffs; }
137 
138 protected:
141 };
142 
143 /***************************************************************************
144 * Definition/implementation of Map<LieGroup< >
145 ***************************************************************************/
146 
147 
148 namespace internal {
149  template<class G, int MapOptions, typename StrideType>
150  struct traits<Map<LieGroup<G>, MapOptions, StrideType> > : public traits<LieGroupBase<G, Map<LieGroup<G>, MapOptions, StrideType> > >
151  {
152  typedef Map<G, MapOptions, StrideType> Coefficients;
153  typedef typename G::Scalar Scalar;
154  };
155 
156  template<class G, int MapOptions, typename StrideType>
157  struct traits<Map<const LieGroup<G>, MapOptions, StrideType> > : public traits<LieGroupBase<G, Map<const LieGroup<G>, MapOptions, StrideType> > >
158  {
159  typedef Map<const G, MapOptions, StrideType> Coefficients;
160  typedef typename G::Scalar Scalar;
161  };
162 }
163 
178 template<class G, int MapOptions, typename StrideType> class Map<LieGroup<G>, MapOptions, StrideType> : public LieGroupBase<G, Map<LieGroup<G>, MapOptions, StrideType> > {
179  protected:
181  typedef LieGroupBase<G, Map<LieGroup<G>, MapOptions, StrideType > > Base;
182  public:
183  // inherit assignement operator
184  EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Map)
186  typedef typename internal::traits<Map<LieGroup<G>, MapOptions, StrideType> >::Scalar Scalar;
188  typedef typename internal::traits<Map<LieGroup<G>, MapOptions, StrideType> >::Coefficients Coefficients;
189 
191  inline Map(const G& g) : m_coeffs(g) {};
193  template<int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
194  inline Map(Array<Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>& g) : m_coeffs(g.data()) {};
196  inline Map(Scalar* data) : m_coeffs(data) {};
198  inline Map(const Map& m) : m_coeffs(m.get()) {};
199 
201  inline Coefficients& get() { return m_coeffs; }
203  inline const Coefficients& get() const { return m_coeffs; }
204 
205  protected:
208 };
209 
210 template<class G, int MapOptions, typename StrideType> class Map<const LieGroup<G>, MapOptions, StrideType> : public LieGroupBase<G, Map<const LieGroup<G>, MapOptions, StrideType> > {
211  protected:
213  typedef LieGroupBase<G, Map<const LieGroup<G>, MapOptions, StrideType > > Base;
214  public:
215  // inherit assignement operator
216  EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Map)
218  typedef typename internal::traits<Map<const LieGroup<G>, MapOptions, StrideType> >::Scalar Scalar;
220  typedef typename internal::traits<Map<const LieGroup<G>, MapOptions, StrideType> >::Coefficients Coefficients;
221 
223  inline Map(const G& g) : m_coeffs(g) {};
225  template<int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
226  inline Map(Array<Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>& g) : m_coeffs(g.data()) {};
228  inline Map(const Scalar* data) : m_coeffs(data) {};
230  inline Map(const Map& m) : m_coeffs(m.get()) {};
231 
233  inline Coefficients& get() { return m_coeffs; }
235  inline const Coefficients& get() const { return m_coeffs; }
236 
237  protected:
240 };
241 
242 #endif
243 
244 
Derived::CoAlgebra CoAlgebra
Definition: LieGroup.h:55
Derived::Algebra Algebra
Definition: LieGroup.h:53
Derived::AdjointMatrix AdjointMatrix
Definition: LieGroup.h:51
internal::traits< LieGroup< G > >::Coefficients Coefficients
Definition: LieGroup.h:126
internal::traits< Map< LieGroup< G >, MapOptions, StrideType > >::Coefficients Coefficients
Definition: LieGroup.h:188
LieGroupBase< G, LieGroup< G > > Base
Definition: LieGroup.h:120
Map(Array< Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &g)
Definition: LieGroup.h:226
const Derived & derived() const
Definition: LieGroup.h:80
Coefficients m_coeffs
Definition: LieGroup.h:140
Derived & derived()
Definition: LieGroup.h:82
LieGroupBase< G, Map< LieGroup< G >, MapOptions, StrideType > > Base
Definition: LieGroup.h:181
LieGroup()
Definition: LieGroup.h:131
Base class for all Lie Group class.
Definition: LieGroup.h:39
internal::traits< Derived >::PlainObject PlainObject
Definition: LieGroup.h:49
Map(Array< Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &g)
Definition: LieGroup.h:194
LieGroupBase< G, Map< const LieGroup< G >, MapOptions, StrideType > > Base
Definition: LieGroup.h:213
internal::traits< Map< const LieGroup< G >, MapOptions, StrideType > >::Scalar Scalar
Definition: LieGroup.h:218
Base class for all Lie Algebra class.
Definition: Displacement.h:139
internal::traits< Map< LieGroup< G >, MapOptions, StrideType > >::Scalar Scalar
Definition: LieGroup.h:186
Class describing an element of a Lie Group.
Definition: LieGroup.h:117
internal::traits< Map< const LieGroup< G >, MapOptions, StrideType > >::Coefficients Coefficients
Definition: LieGroup.h:220
internal::traits< Derived >::Scalar Scalar
Definition: LieGroup.h:45
Derived::Coefficients Coefficients
Definition: LieGroup.h:43


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