deprecated/LieVector.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 
18 #pragma once
19 
20 #include <gtsam/base/VectorSpace.h>
21 #include <cstdarg>
22 
23 namespace gtsam {
24 
30 struct LieVector : public Vector {
31 
33 
35  LieVector() {}
36 
38  LieVector(const Vector& v) : Vector(v) {}
39 
40  template <class V>
41  LieVector(const V& v) : Vector(v) {}
42 
43 // Currently TMP constructor causes ICE on MSVS 2013
44 #if (_MSC_VER < 1800)
45 
46  template<int N>
48 #endif
49 
51  LieVector(double d) : Vector((Vector(1) << d).finished()) {}
52 
54  LieVector(size_t m, const double* const data) : Vector(m) {
55  for (size_t i = 0; i < m; i++) (*this)(i) = data[i];
56  }
57 
60  void print(const std::string& name="") const {
62  }
63  bool equals(const LieVector& expected, double tol=1e-5) const {
64  return gtsam::equal(vector(), expected.vector(), tol);
65  }
67 
70  LieVector compose(const LieVector& q) { return (*this)+q;}
71  LieVector between(const LieVector& q) { return q-(*this);}
72  LieVector inverse() { return -(*this);}
74 
77  Vector localCoordinates(const LieVector& q) { return between(q).vector();}
78  LieVector retract(const Vector& v) {return compose(LieVector(v));}
80 
83  static Vector Logmap(const LieVector& p) {return p.vector();}
84  static LieVector Expmap(const Vector& v) { return LieVector(v);}
86 
89 
91  Vector vector() const {
92  return static_cast<Vector>(*this);
93  }
94 
96  size_t dim() const { return this->size(); }
97 
99  static LieVector identity() {
100  throw std::runtime_error("LieVector::identity(): Don't use this function");
101  return LieVector();
102  }
103 
105 
106 private:
107 
108  // Serialization function
110  template<class Archive>
111  void serialize(Archive & ar, const unsigned int /*version*/) {
112  ar & boost::serialization::make_nvp("Vector",
113  boost::serialization::base_object<Vector>(*this));
114  }
115 };
116 
117 
118 template<>
119 struct traits<LieVector> : public internal::VectorSpace<LieVector> {};
120 
121 } // \namespace gtsam
void print(const Matrix &A, const string &s, ostream &stream)
Definition: Matrix.cpp:155
Matrix3f m
LieVector(const Eigen::Matrix< double, N, 1 > &v)
LieVector(size_t m, const double *const data)
LieVector compose(const LieVector &q)
Vector localCoordinates(const LieVector &q)
VectorSpace provides both Testable and VectorSpaceTraits.
Definition: VectorSpace.h:207
Matrix expected
Definition: testMatrix.cpp:974
friend class boost::serialization::access
ArrayXcf v
Definition: Cwise_arg.cpp:1
static Vector Logmap(const LieVector &p)
LieVector retract(const Vector &v)
Vector vector() const
Scalar Scalar int size
Definition: benchVecAdd.cpp:17
bool equals(const LieVector &expected, double tol=1e-5) const
Eigen::VectorXd Vector
Definition: Vector.h:38
int data[]
Array< double, 1, 3 > e(1./3., 0.5, 2.)
void serialize(Archive &ar, const unsigned int)
EIGEN_DEVICE_FUNC const Scalar & q
static LieVector Expmap(const Vector &v)
void print(const std::string &name="") const
traits
Definition: chartTesting.h:28
LieVector(const Vector &v)
float * p
size_t dim() const
LieVector between(const LieVector &q)
Annotation for function names.
Definition: attr.h:36
const G double tol
Definition: Group.h:83
const int Dynamic
Definition: Constants.h:21
bool equal(const T &obj1, const T &obj2, double tol)
Definition: Testable.h:83
static LieVector identity()


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:42:31