7#include "smooth/version.hpp"
26template<
typename Derived>
29 Derived & derived()
noexcept {
return static_cast<Derived &
>(*this); }
31 const Derived & cderived()
const noexcept {
return static_cast<const Derived &
>(*this); }
40 using Impl =
typename traits::Impl;
47 static constexpr int RepSize = Impl::RepSize;
49 static constexpr int Dof = Impl::Dof;
51 static constexpr int Dim = Impl::Dim;
56 using Scalar =
typename traits::Scalar;
58 using Matrix = Eigen::Matrix<Scalar, Dim, Dim>;
60 using Tangent = Eigen::Matrix<Scalar, Dof, 1>;
64 using Hessian = Eigen::Matrix<Scalar, Dof, Dof * Dof>;
66 template<
typename NewScalar>
76 return derived().coeffs();
79 const auto &
coeffs()
const {
return cderived().coeffs(); }
86 return derived().data();
89 const auto *
data()
const {
return cderived().data(); }
94 template<
typename OtherDerived>
95 requires(
is_mutable && std::is_same_v<Impl, typename liebase_info<OtherDerived>::Impl>)
157 template<
typename OtherDerived>
158 requires(std::is_same_v<Impl, typename liebase_info<OtherDerived>::Impl>)
168 template<
typename NewScalar>
179 template<
typename OtherDerived>
180 requires(std::is_same_v<Impl, typename liebase_info<OtherDerived>::Impl>)
191 template<
typename OtherDerived>
192 requires(
is_mutable && std::is_same_v<Impl, typename liebase_info<OtherDerived>::Impl>)
195 derived().coeffs() = (*
this *
o).
coeffs();
205 Impl::inverse(cderived().
coeffs(),
ret.coeffs());
230 return TangentMap::Identity();
243 template<
typename TangentDerived>
246 return *
this *
exp(a);
254 template<
typename TangentDerived>
256 Derived &
operator+=(
const Eigen::MatrixBase<TangentDerived> & a)
noexcept
272 template<
typename OtherDerived>
273 requires(std::is_same_v<Impl, typename liebase_info<OtherDerived>::Impl>)
276 return (
xo.inverse() * *
this).
log();
284 template<
typename TangentDerived>
288 Impl::exp(a,
ret.coeffs());
301 template<
typename TangentDerived>
302 static Matrix hat(
const Eigen::MatrixBase<TangentDerived> & a)
noexcept
317 template<
typename MatrixDerived>
318 static Tangent vee(
const Eigen::MatrixBase<MatrixDerived> &
A)
noexcept
331 template<
typename TangentDerived>
332 static TangentMap ad(
const Eigen::MatrixBase<TangentDerived> & a)
noexcept
335 return TangentMap::Zero();
350 template<
typename TangentDerived1,
typename TangentDerived2>
352 lie_bracket(
const Eigen::MatrixBase<TangentDerived1> & a,
const Eigen::MatrixBase<TangentDerived2> & b)
noexcept
355 return Tangent::Zero();
366 template<
typename TangentDerived>
370 return TangentMap::Identity();
373 Impl::dr_exp(a,
ret);
383 template<
typename TangentDerived>
387 return TangentMap::Identity();
390 Impl::dr_expinv(a,
ret);
400 template<
typename TangentDerived>
411 template<
typename TangentDerived>
422 template<
typename TangentDerived>
426 return Hessian::Zero();
429 Impl::d2r_exp(a,
ret);
440 template<
typename TangentDerived>
444 return Hessian::Zero();
447 Impl::d2r_expinv(a,
ret);
457 template<
typename TangentDerived>
469 template<
typename TangentDerived>
479template<
typename Stream,
typename Derived>
482 s << static_cast<const Derived &>(g).coeffs().transpose();
496using MapDispatch = std::conditional_t<
497 std::is_base_of_v<Eigen::MatrixBase<std::remove_const_t<T>>, std::remove_const_t<T>>,
Base class for Lie group types.
bool isApprox(const LieGroupBase< OtherDerived > &o, const Scalar &eps=Eigen::NumTraits< Scalar >::dummy_precision()) const noexcept
Check if (approximately) equal to other element o.
PlainObject operator+(const Eigen::MatrixBase< TangentDerived > &a) const noexcept
Right-plus.
static constexpr int Dof
Degrees of freedom of manifold (equal to tangent space dimension).
typename traits::Scalar Scalar
Scalar type.
auto & coeffs() const
Access underlying storages.
static Tangent vee(const Eigen::MatrixBase< MatrixDerived > &A) noexcept
Lie alebra vee map.
liebase_info< Derived > traits
CRTP traits.
static TangentMap dl_expinv(const Eigen::MatrixBase< TangentDerived > &a) noexcept
Inverse of left jacobian of the exponential map.
static Hessian d2r_exp(const Eigen::MatrixBase< TangentDerived > &a) noexcept
Right Hessian of the exponential map.
static constexpr bool IsCommutative
Commutativity of group. A commutative group has a zero Lie bracket.
void setRandom() noexcept
Set to a random element.
static Hessian d2r_expinv(const Eigen::MatrixBase< TangentDerived > &a) noexcept
Right Hessian of the log map.
static Tangent lie_bracket(const Eigen::MatrixBase< TangentDerived1 > &a, const Eigen::MatrixBase< TangentDerived2 > &b) noexcept
Lie algebra bracket.
CastT< Scalar > PlainObject
Plain return type.
static constexpr bool is_mutable
True if underlying storage supports modification.
static PlainObject Random() noexcept
Construct a random element.
static PlainObject Identity() noexcept
Construct the identity element.
typename traits::Impl Impl
Group-specific Lie group implementation.
TangentMap Ad() const noexcept
Lie group adjoint.
static constexpr int Dim
Side of Lie group matrix representation.
static PlainObject exp(const Eigen::MatrixBase< TangentDerived > &a) noexcept
Lie group exponential map.
void setIdentity() noexcept
Set to group identity element.
Eigen::Matrix< Scalar, Dof, 1 > Tangent
Lie group parameterized tangent type.
Eigen::Matrix< Scalar, Dof, Dof > TangentMap
Matrix representing map between tangent elements.
auto * data() const
Access raw pointer.
static TangentMap ad(const Eigen::MatrixBase< TangentDerived > &a) noexcept
Lie algebra adjoint.
Tangent log() const noexcept
Lie group logarithm.
Eigen::Matrix< Scalar, Dof, Dof *Dof > Hessian
Plain return type with different scalar.
static Hessian d2l_exp(const Eigen::MatrixBase< TangentDerived > &a) noexcept
Left Hessian of the exponential map.
PlainObject inverse() const noexcept
Group inverse operation.
static constexpr int RepSize
Number of scalars in internal representation.
static TangentMap dr_exp(const Eigen::MatrixBase< TangentDerived > &a) noexcept
Right jacobian of the exponential map.
CastT< NewScalar > cast() const noexcept
Cast to different scalar type.
static Matrix hat(const Eigen::MatrixBase< TangentDerived > &a) noexcept
Lie algebra hat map.
const auto & coeffs() const
Const access underlying storages.
const auto * data() const
Const access raw pointer.
static TangentMap dl_exp(const Eigen::MatrixBase< TangentDerived > &a) noexcept
Left jacobian of the exponential map.
Matrix matrix() const noexcept
Return as matrix Lie group element in .
Eigen::Index dof() const noexcept
Dynamic size (degrees of freedom).
static Hessian d2l_expinv(const Eigen::MatrixBase< TangentDerived > &a) noexcept
Left Hessian of the log map.
Eigen::Matrix< Scalar, Dim, Dim > Matrix
Lie group matrix type.
static TangentMap dr_expinv(const Eigen::MatrixBase< TangentDerived > &a) noexcept
Inverse of right jacobian of the exponential map.
typename traits::template PlainObject< NewScalar > CastT
Plain return type with different scalar.
Memory mapping of internal Lie group types.
Eigen::Vector< Scalar< M >, Dof< M > > Tangent
Tangent as a Dof-length vector.
Type trait that maps a type to Lie group operations.