19 template<
typename T>
struct traits;
24 template<
class Class,
int N>
35 ChartJacobian H1 = {}, ChartJacobian H2 = {}) {
36 if (H1) *H1 = - Jacobian::Identity();
37 if (H2) *H2 = Jacobian::Identity();
43 ChartJacobian H1 = {}, ChartJacobian H2 = {}) {
44 if (H1) *H1 = Jacobian::Identity();
45 if (H2) *H2 = Jacobian::Identity();
54 static TangentVector
Logmap(
const Class&
m, ChartJacobian Hm = {}) {
55 if (Hm) *Hm = Jacobian::Identity();
59 static Class Expmap(
const TangentVector& v, ChartJacobian Hv = {}) {
60 if (Hv) *Hv = Jacobian::Identity();
65 ChartJacobian H2 = {}) {
66 if (H1) *H1 = Jacobian::Identity();
67 if (H2) *H2 = Jacobian::Identity();
72 ChartJacobian H2 = {}) {
73 if (H1) *H1 = - Jacobian::Identity();
74 if (H2) *H2 = Jacobian::Identity();
79 if (
H) *
H = - Jacobian::Identity();
104 int dim = GetDimension(m);
105 return Eigen::MatrixXd::Identity(dim, dim);
109 ChartJacobian H1 = {}, ChartJacobian H2 = {}) {
110 if (H1) *H1 = - Eye(origin);
111 if (H2) *H2 = Eye(other);
117 ChartJacobian H1 = {}, ChartJacobian H2 = {}) {
118 if (H1) *H1 = Eye(origin);
119 if (H2) *H2 = Eye(origin);
128 static TangentVector
Logmap(
const Class& m, ChartJacobian Hm = {}) {
129 if (Hm) *Hm = Eye(m);
133 static Class Expmap(
const TangentVector& v, ChartJacobian Hv = {}) {
141 ChartJacobian H2 = {}) {
142 if (H1) *H1 = Eye(v1);
143 if (H2) *H2 = Eye(v2);
148 ChartJacobian H2 = {}) {
149 if (H1) *H1 = - Eye(v1);
150 if (H2) *H2 = Eye(v2);
163 template<
class Class>
184 template<
class Class>
206 template<
class Class>
211 template<
typename Scalar>
235 enum { dimension = 1 };
240 ChartJacobian H1 = {}, ChartJacobian H2 = {}) {
241 if (H1) (*H1)[0] = -1.0;
242 if (H2) (*H2)[0] = 1.0;
249 ChartJacobian H1 = {}, ChartJacobian H2 = {}) {
250 if (H1) (*H1)[0] = 1.0;
251 if (H2) (*H2)[0] = 1.0;
252 return origin + v[0];
259 if (
H) (*H)[0] = 1.0;
264 if (
H) (*H)[0] = 1.0;
282 template<
int M,
int N,
int Options,
int MaxRows,
int MaxCols>
285 Eigen::Matrix<double, M, N, Options, MaxRows, MaxCols>, M * N> {
292 static void Print(
const Fixed& m,
const std::string&
str =
"") {
295 static bool Equals(
const Fixed& v1,
const Fixed& v2,
double tol = 1
e-8) {
308 enum { dimension =
M*
N};
314 static TangentVector
Local(
const Fixed& origin,
const Fixed& other,
315 ChartJacobian H1 = {}, ChartJacobian H2 = {}) {
316 if (H1) (*H1) = -Jacobian::Identity();
317 if (H2) (*H2) = Jacobian::Identity();
323 static Fixed
Retract(
const Fixed& origin,
const TangentVector& v,
324 ChartJacobian H1 = {}, ChartJacobian H2 = {}) {
325 if (H1) (*H1) = Jacobian::Identity();
326 if (H2) (*H2) = Jacobian::Identity();
333 static TangentVector
Logmap(
const Fixed& m, ChartJacobian
H = {}) {
334 if (
H) *
H = Jacobian::Identity();
340 static Fixed
Expmap(
const TangentVector& v, ChartJacobian
H = {}) {
343 if (
H) *
H = Jacobian::Identity();
353 template<
int M,
int N,
int Options,
int MaxRows,
int MaxCols>
361 static void Print(
const Dynamic& m,
const std::string&
str =
"") {
364 static bool Equals(
const Dynamic& v1,
const Dynamic& v2,
374 throw std::runtime_error(
"Identity not defined for dynamic types");
390 static Jacobian
Eye(
const Dynamic& m) {
391 int dim = GetDimension(m);
395 static TangentVector
Local(
const Dynamic& m,
const Dynamic& other,
396 ChartJacobian H1 = {}, ChartJacobian H2 = {}) {
397 if (H1) *H1 = -Eye(m);
398 if (H2) *H2 = Eye(m);
399 TangentVector
v(GetDimension(m));
404 static Dynamic
Retract(
const Dynamic& m,
const TangentVector& v,
405 ChartJacobian H1 = {}, ChartJacobian H2 = {}) {
406 if (H1) *H1 = Eye(m);
407 if (H2) *H2 = Eye(m);
414 static TangentVector
Logmap(
const Dynamic& m, ChartJacobian
H = {}) {
416 TangentVector
result(GetDimension(m));
421 static Dynamic
Expmap(
const TangentVector& , ChartJacobian
H = {}) {
422 static_cast<void>(
H);
423 throw std::runtime_error(
"Expmap not defined for dynamic types");
426 static Dynamic
Inverse(
const Dynamic& m, ChartJacobian
H = {}) {
431 static Dynamic
Compose(
const Dynamic& v1,
const Dynamic& v2,
432 ChartJacobian H1 = {}, ChartJacobian H2 = {}) {
433 if (H1) *H1 = Eye(v1);
434 if (H2) *H2 = Eye(v1);
438 static Dynamic
Between(
const Dynamic& v1,
const Dynamic& v2,
439 ChartJacobian H1 = {}, ChartJacobian H2 = {}) {
440 if (H1) *H1 = -Eye(v1);
441 if (H2) *H2 = Eye(v1);
451 template<
int Options,
int MaxRows,
int MaxCols>
457 template<
int Options,
int MaxRows,
int MaxCols>
458 struct traits<Eigen::
Matrix<double, -1, 1, Options, MaxRows, MaxCols> > :
463 template<
int Options,
int MaxRows,
int MaxCols>
464 struct traits<Eigen::
Matrix<double, 1, -1, Options, MaxRows, MaxCols> > :
478 "This type's trait does not assert it as a vector space (or derived)");
void print(const Matrix &A, const string &s, ostream &stream)
static Class Between(const Class &v1, const Class &v2, ChartJacobian H1, ChartJacobian H2={})
Requirements on type to pass it to Manifold template below.
static Dynamic Retract(const Dynamic &m, const TangentVector &v, ChartJacobian H1={}, ChartJacobian H2={})
Matrix< RealScalar, Dynamic, Dynamic > M
EIGEN_DEVICE_FUNC Derived & setZero(Index size)
static Class Inverse(const Class &v, ChartJacobian H)
#define GTSAM_CONCEPT_ASSERT(concept)
BOOST_CONCEPT_USAGE(IsVectorSpace)
static bool Equals(const Dynamic &v1, const Dynamic &v2, double tol=1e-8)
static int GetDimension(const Class &m)
VectorSpace provides both Testable and VectorSpaceTraits.
static Dynamic Identity()
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size set origin
static int GetDimension(const Class &)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar * data() const
Eigen::Matrix< double, N, N > Jacobian
tag to assert a type is a Lie group
A matrix or vector expression mapping an existing array of data.
Eigen::Matrix< double, M, N, Options, MaxRows, MaxCols > Dynamic
static Dynamic Expmap(const TangentVector &, ChartJacobian H={})
Eigen::Matrix< double, dimension, 1 > TangentVector
Eigen::VectorXd TangentVector
OptionalJacobian< N, N > ChartJacobian
static Class Compose(const Class &v1, const Class &v2, ChartJacobian H1, ChartJacobian H2={})
Namespace containing all symbols from the Eigen library.
Eigen::Matrix< double, M, N, Options, MaxRows, MaxCols > Fixed
static bool Equals(Scalar v1, Scalar v2, double tol=1e-8)
static Class Inverse(const Class &m)
static TangentVector Logmap(const Class &m, ChartJacobian Hm={})
static Dynamic Inverse(const Dynamic &m, ChartJacobian H={})
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size set set xzeroaxis lt lw set x2zeroaxis lt lw set yzeroaxis lt lw set y2zeroaxis lt lw set tics in set ticslevel set tics set mxtics default set mytics default set mx2tics default set my2tics default set xtics border mirror norotate autofreq set ytics border mirror norotate autofreq set ztics border nomirror norotate autofreq set nox2tics set noy2tics set timestamp bottom norotate set rrange [*:*] noreverse nowriteback set trange [*:*] noreverse nowriteback set urange [*:*] noreverse nowriteback set vrange [*:*] noreverse nowriteback set xlabel matrix size set x2label set timefmt d m y n H
static TangentVector Local(const Dynamic &m, const Dynamic &other, ChartJacobian H1={}, ChartJacobian H2={})
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
static TangentVector Logmap(const Fixed &m, ChartJacobian H={})
static Class Compose(const Class &v1, const Class &v2, ChartJacobian H1={}, ChartJacobian H2={})
static Fixed Retract(const Fixed &origin, const TangentVector &v, ChartJacobian H1={}, ChartJacobian H2={})
Eigen::Matrix< double, N, 1 > TangentVector
additive_group_tag group_flavor
static int GetDimension(const Dynamic &m)
static Scalar Expmap(const TangentVector &v, ChartJacobian H={})
static TangentVector Logmap(Scalar m, ChartJacobian H={})
OptionalJacobian< Eigen::Dynamic, Eigen::Dynamic > ChartJacobian
static Class Between(const Class &v1, const Class &v2)
traits< T >::structure_category structure_category_tag
static TangentVector Logmap(const Class &m, ChartJacobian Hm={})
static Class Between(const Class &v1, const Class &v2, ChartJacobian H1={}, ChartJacobian H2={})
static bool Equals(const Fixed &v1, const Fixed &v2, double tol=1e-8)
Array< int, Dynamic, 1 > v
static TangentVector Local(const Class &origin, const Class &other, ChartJacobian H1={}, ChartJacobian H2={})
additive_group_tag group_flavor
Array< double, 1, 3 > e(1./3., 0.5, 2.)
OptionalJacobian< dimension, dimension > ChartJacobian
EIGEN_DEVICE_FUNC const Scalar & q
static Class Retract(const Class &origin, const TangentVector &v, ChartJacobian H1={}, ChartJacobian H2={})
static Dynamic Compose(const Dynamic &v1, const Dynamic &v2, ChartJacobian H1={}, ChartJacobian H2={})
static void Print(Scalar m, const std::string &str="")
Eigen::VectorXd TangentVector
OptionalJacobian< dimension, dimension > ChartJacobian
Base class and basic functions for Lie types.
bool equal_with_abs_tol(const Eigen::DenseBase< MATRIX > &A, const Eigen::DenseBase< MATRIX > &B, double tol=1e-9)
additive_group_tag group_flavor
VectorSpaceTraits Implementation for Fixed sizes.
tag to assert a type is a vector space
Eigen::Matrix< double, 1, 1 > TangentVector
vector_space_tag structure_category
const Vector3 & vector() const
static TangentVector Local(const Class &origin, const Class &other, ChartJacobian H1={}, ChartJacobian H2={})
static Class Compose(const Class &v1, const Class &v2)
static TangentVector Local(const Fixed &origin, const Fixed &other, ChartJacobian H1={}, ChartJacobian H2={})
static TangentVector Local(Scalar origin, Scalar other, ChartJacobian H1={}, ChartJacobian H2={})
vector_space_tag structure_category
static Class Expmap(const TangentVector &v, ChartJacobian Hv={})
static Jacobian Eye(const Dynamic &m)
OptionalJacobian< 1, 1 > ChartJacobian
static Dynamic Between(const Dynamic &v1, const Dynamic &v2, ChartJacobian H1={}, ChartJacobian H2={})
additive_group_tag group_flavor
static Class Expmap(const TangentVector &v, ChartJacobian Hv={})
static void Print(const Dynamic &m, const std::string &str="")
BOOST_CONCEPT_USAGE(HasVectorSpacePrereqs)
static Class Inverse(const Class &v, ChartJacobian H={})
static Class Retract(const Class &origin, const TangentVector &v, ChartJacobian H1={}, ChartJacobian H2={})
vector_space_tag structure_category
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
static Eigen::MatrixXd Eye(const Class &m)
static Scalar Retract(Scalar origin, const TangentVector &v, ChartJacobian H1={}, ChartJacobian H2={})
vector_space_tag structure_category
static TangentVector Logmap(const Dynamic &m, ChartJacobian H={})
static Fixed Expmap(const TangentVector &v, ChartJacobian H={})
static void Print(const Fixed &m, const std::string &str="")
Eigen::Matrix< double, dimension, dimension > Jacobian