LieGroup.h
Go to the documentation of this file.
00001 // This file is part of Eigen, a lightweight C++ template library
00002 // for linear algebra.
00003 //
00004 // Copyright (C) 2009-2013 CEA LIST (DIASI/LSI) <xde-support@saxifrage.cea.fr>
00005 //
00006 // This Source Code Form is subject to the terms of the Mozilla
00007 // Public License v. 2.0. If a copy of the MPL was not distributed
00008 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
00009 
00010 #ifndef EIGEN_LGSM_LIE_GROUP_H
00011 #define EIGEN_LGSM_LIE_GROUP_H
00012 
00013 /***************************************************************************
00014 * Definition/implementation of LieGroupBase<G, Derived>
00015 ***************************************************************************/
00016 
00031 namespace internal {
00032   template<class G, class Derived>
00033   struct traits<LieGroupBase<G, Derived> > {
00034     typedef LieGroup<G> PlainObject;
00035   };
00036 }
00037 
00038 
00039 template<class G, class Derived> class LieGroupBase {
00040 public:
00041   /* List of typedef */
00043   typedef typename Derived::Coefficients Coefficients;
00045   typedef typename internal::traits<Derived>::Scalar Scalar;
00047   typedef G BaseType;
00049   typedef typename internal::traits<Derived>::PlainObject PlainObject;
00051   typedef typename Derived::AdjointMatrix AdjointMatrix;
00053   typedef typename Derived::Algebra Algebra;
00055   typedef typename Derived::CoAlgebra CoAlgebra;
00056 
00058   PlainObject inverse() const;
00060   static PlainObject Identity();
00062   template<class OtherDerived> PlainObject operator*(const LieGroupBase<G, OtherDerived>& other) const;
00063 
00065   AdjointMatrix adjoint(void) const;
00067   Algebra adjoint(const Algebra& ) const;
00069   CoAlgebra adjointTr(const CoAlgebra& ) const;
00070 
00074   Algebra log(const Scalar precision = 1e-6) const;
00075 
00077   template<class OtherDerived> LieGroupBase& operator=(const LieGroupBase<G, OtherDerived>& );
00078 
00080   inline const Derived& derived() const { return *static_cast<const Derived*>(this); }
00082   inline Derived& derived() { return *static_cast<Derived*>(this); }
00083 
00085   inline Coefficients& get();
00087   inline const Coefficients& get() const;
00088 };
00089 
00090 /***************************************************************************
00091 * Definition of LieGroup<G>
00092 ***************************************************************************/
00093 
00094 namespace internal {
00095   template<class G>
00096     struct traits<LieGroup<G> > : public traits<LieGroupBase<G, LieGroup<G> > >
00097     {
00098       typedef G Coefficients;
00099       typedef typename G::Scalar Scalar;
00100     };
00101 }
00102 
00117 template<class G> class LieGroup : public LieGroupBase<G, LieGroup<G> > {
00118 protected:
00120   typedef LieGroupBase<G, LieGroup<G> > Base;
00121 public:
00122   // inherit assignement operator
00123   EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(LieGroup)
00124 
00125   
00126   typedef typename internal::traits<LieGroup<G> >::Coefficients Coefficients;
00127 
00129   inline LieGroup(const LieGroup&) {};
00131   inline LieGroup() {};
00132     
00134   inline Coefficients& get() { return m_coeffs; }
00136   inline const Coefficients& get() const { return m_coeffs; }
00137 
00138 protected:
00140   Coefficients m_coeffs;
00141 };
00142 
00143 /***************************************************************************
00144 * Definition/implementation of Map<LieGroup< >
00145 ***************************************************************************/
00146 
00147 
00148 namespace internal {
00149   template<class G, int MapOptions, typename StrideType>
00150     struct traits<Map<LieGroup<G>, MapOptions, StrideType> > : public traits<LieGroupBase<G, Map<LieGroup<G>, MapOptions, StrideType> > >
00151     {
00152       typedef Map<G, MapOptions, StrideType> Coefficients;
00153       typedef typename G::Scalar Scalar;
00154     };
00155 
00156   template<class G, int MapOptions, typename StrideType>
00157     struct traits<Map<const LieGroup<G>, MapOptions, StrideType> > : public traits<LieGroupBase<G, Map<const LieGroup<G>, MapOptions, StrideType> > >
00158     {
00159       typedef Map<const G, MapOptions, StrideType> Coefficients;
00160       typedef typename G::Scalar Scalar;
00161     };
00162 }
00163 
00178 template<class G, int MapOptions, typename StrideType> class Map<LieGroup<G>, MapOptions, StrideType> : public LieGroupBase<G, Map<LieGroup<G>, MapOptions, StrideType> > {
00179   protected:
00181     typedef LieGroupBase<G, Map<LieGroup<G>, MapOptions, StrideType > > Base;
00182   public:
00183     // inherit assignement operator
00184     EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Map)
00186       typedef typename internal::traits<Map<LieGroup<G>, MapOptions, StrideType> >::Scalar Scalar;
00188     typedef typename internal::traits<Map<LieGroup<G>, MapOptions, StrideType> >::Coefficients Coefficients;
00189 
00191     inline Map(const G& g) : m_coeffs(g) {};
00193     template<int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols> 
00194       inline Map(Array<Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>& g) : m_coeffs(g.data()) {};
00196     inline Map(Scalar* data) : m_coeffs(data) {};
00198     inline Map(const Map& m) : m_coeffs(m.get()) {};
00199 
00201     inline Coefficients& get() { return m_coeffs; }
00203     inline const Coefficients& get() const { return m_coeffs; }
00204 
00205   protected:
00207     Coefficients m_coeffs;
00208 };
00209 
00210 template<class G, int MapOptions, typename StrideType> class Map<const LieGroup<G>, MapOptions, StrideType> : public LieGroupBase<G, Map<const LieGroup<G>, MapOptions, StrideType> > {
00211   protected:
00213     typedef LieGroupBase<G, Map<const LieGroup<G>, MapOptions, StrideType > > Base;
00214   public:
00215     // inherit assignement operator
00216     EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Map)
00218       typedef typename internal::traits<Map<const LieGroup<G>, MapOptions, StrideType> >::Scalar Scalar;
00220     typedef typename internal::traits<Map<const LieGroup<G>, MapOptions, StrideType> >::Coefficients Coefficients;
00221 
00223     inline Map(const G& g) : m_coeffs(g) {};
00225     template<int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols> 
00226       inline Map(Array<Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>& g) : m_coeffs(g.data()) {};
00228     inline Map(const Scalar* data) : m_coeffs(data) {};
00230     inline Map(const Map& m) : m_coeffs(m.get()) {};
00231 
00233     inline Coefficients& get() { return m_coeffs; }
00235     inline const Coefficients& get() const { return m_coeffs; }
00236 
00237   protected:
00239     Coefficients m_coeffs;
00240 };
00241 
00242 #endif
00243 
00244 


lgsm
Author(s): Roberto Martín-Martín
autogenerated on Sat Jun 8 2019 18:26:30