gtsam  3.2.1
gtsam
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Lie.h
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
20 #pragma once
21 
22 #include <gtsam/base/Manifold.h>
23 #include <gtsam/base/Group.h>
24 
25 namespace gtsam {
26 
33 template<class T>
34 inline T between_default(const T& l1, const T& l2) {return l1.inverse().compose(l2);}
35 
37 template<class T>
38 inline Vector logmap_default(const T& l0, const T& lp) {return T::Logmap(l0.between(lp));}
39 
41 template<class T>
42 inline T expmap_default(const T& t, const Vector& d) {return t.compose(T::Expmap(d));}
43 
77 template <class T>
78 class LieConcept {
79 private:
81  static T concept_check(const T& t) {
82 
84  T t2 = t;
85 
89  size_t dim_ret = t.dim();
90 
92  T expmap_identity_ret = T::Expmap(gtsam::zero(dim_ret));
93 
95  Vector logmap_identity_ret = T::Logmap(t);
96 
98  T between_ret = expmap_identity_ret.between(t2);
99 
100  return between_ret;
101  }
102 
103 };
104 
112 template<class T>
114 T BCH(const T& X, const T& Y) {
115  static const double _2 = 1. / 2., _12 = 1. / 12., _24 = 1. / 24.;
116  T X_Y = bracket(X, Y);
117  return X + Y + _2 * X_Y + _12 * bracket(X - Y, X_Y) - _24 * bracket(Y,
118  bracket(X, X_Y));
119 }
120 
125 template <class T> Matrix wedge(const Vector& x);
126 
133 template <class T>
134 T expm(const Vector& x, int K=7) {
135  Matrix xhat = wedge<T>(x);
136  return T(expm(xhat,K));
137 }
138 
139 } // namespace gtsam
140 
149 #define GTSAM_CONCEPT_LIE_INST(T) \
150  template class gtsam::ManifoldConcept<T>; \
151  template class gtsam::GroupConcept<T>; \
152  template class gtsam::LieConcept<T>;
153 
154 #define GTSAM_CONCEPT_LIE_TYPE(T) \
155  typedef gtsam::ManifoldConcept<T> _gtsam_ManifoldConcept_##T; \
156  typedef gtsam::GroupConcept<T> _gtsam_GroupConcept_##T; \
157  typedef gtsam::LieConcept<T> _gtsam_LieConcept_##T;
T BCH(const T &X, const T &Y)
Three term approximation of the Baker�Campbell�Hausdorff formula In non-commutative Lie groups...
Definition: Lie.h:114
Vector logmap_default(const T &l0, const T &lp)
Log map centered at l0, s.t.
Definition: Lie.h:38
T expm(const Vector &x, int K=7)
Exponential map given exponential coordinates class T needs a wedge<> function and a constructor from...
Definition: Lie.h:134
Base class and basic functions for Manifold types.
bool zero(const Vector &v)
check if all zero
Definition: Vector.cpp:39
T between_default(const T &l1, const T &l2)
These core global functions can be specialized by new Lie types for better performance.
Definition: Lie.h:34
T expmap_default(const T &t, const Vector &d)
Exponential map centered at l0, s.t.
Definition: Lie.h:42
Concept check class for variable types with Group properties.
Concept check class for Lie group type.
Definition: Lie.h:78
Matrix wedge(const Vector &x)
Declaration of wedge (see Murray94book) used to convert from n exponential coordinates to n*n element...