deprecated/LieScalar.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/dllexport.h>
21 #include <gtsam/base/VectorSpace.h>
22 #include <iostream>
23 
24 namespace gtsam {
25 
31  struct LieScalar {
32 
33  enum { dimension = 1 };
34 
36  LieScalar() : d_(0.0) {}
37 
39  /*explicit*/ LieScalar(double d) : d_(d) {}
40 
42  double value() const { return d_; }
43 
45  operator double() const { return d_; }
46 
48  Vector1 vector() const { Vector1 v; v<<d_; return v; }
49 
52  void print(const std::string& name = "") const {
53  std::cout << name << ": " << d_ << std::endl;
54  }
55  bool equals(const LieScalar& expected, double tol = 1e-5) const {
56  return std::abs(expected.d_ - d_) <= tol;
57  }
59 
62  static LieScalar identity() { return LieScalar(0);}
63  LieScalar compose(const LieScalar& q) { return (*this)+q;}
64  LieScalar between(const LieScalar& q) { return q-(*this);}
65  LieScalar inverse() { return -(*this);}
67 
70  size_t dim() const { return 1; }
72  LieScalar retract(const Vector1& v) {return compose(LieScalar(v[0]));}
74 
77  static Vector1 Logmap(const LieScalar& p) { return p.vector();}
78  static LieScalar Expmap(const Vector1& v) { return LieScalar(v[0]);}
80 
81  private:
82  double d_;
83  };
84 
85  template<>
86  struct traits<LieScalar> : public internal::ScalarTraits<LieScalar> {};
87 
88 } // \namespace gtsam
Matrix expected
Definition: testMatrix.cpp:974
ArrayXcf v
Definition: Cwise_arg.cpp:1
bool equals(const LieScalar &expected, double tol=1e-5) const
Vector1 vector() const
size_t dim() const
LieScalar compose(const LieScalar &q)
static Vector1 Logmap(const LieScalar &p)
Vector1 localCoordinates(const LieScalar &q)
LieScalar between(const LieScalar &q)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
EIGEN_DEVICE_FUNC const Scalar & q
static LieScalar identity()
traits
Definition: chartTesting.h:28
float * p
void print(const std::string &name="") const
Annotation for function names.
Definition: attr.h:36
const G double tol
Definition: Group.h:83
LieScalar retract(const Vector1 &v)
double value() const
The matrix class, also used for vectors and row-vectors.
#define abs(x)
Definition: datatypes.h:17
static LieScalar Expmap(const Vector1 &v)


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