40 [[maybe_unused]]
const auto in_range_pred = [&](
auto x) {
return x >= 0 && x < ::smooth::dof(m_m0); };
41 assert(std::ranges::all_of(
fixed_dims, in_range_pred));
42 std::sort(m_fixed_dims.begin(), m_fixed_dims.end());
43 m_calc.setZero(::smooth::dof(m_m0));
52 const M &
m()
const {
return m_m; }
55 const M &
m0()
const {
return m_m0; }
58 const Eigen::VectorXi &
fixed_dims()
const {
return m_fixed_dims; }
61 Eigen::Index
dof()
const { return ::smooth::dof(m_m0) - m_fixed_dims.size(); }
64 template<
typename Derived>
67 assert(
dof() == a.size());
68 m_calc.setZero(::smooth::dof(m_m0));
69 for (
auto i = 0, j = 0, k = 0; i < m_calc.size(); ++i) {
73 if (k >= m_fixed_dims.size() || i != m_fixed_dims(k)) {
85 assert(m_fixed_dims.isApprox(other.
fixed_dims()));
86 assert(m_m0.isApprox(other.
m0()));
90 Eigen::Vector<typename traits::man<M>::Scalar, -1> ret;
92 for (
auto i = 0, j = 0, k = 0; i < m_calc.size(); ++i) {
96 if (k >= m_fixed_dims.size() || i != m_fixed_dims(k)) {
108 Eigen::VectorXi m_fixed_dims{};
120 using Scalar = man<M>::Scalar;
122 template<
typename NewScalar>
125 static constexpr int Dof = -1;
131 Eigen::VectorXi fixed_dims = Eigen::VectorXi::Zero(0);
135 template<
typename NewScalar>
139 man<M>::template cast<NewScalar>(m.m()), man<M>::template cast<NewScalar>(m.m0()), m.fixed_dims());
142 template<
typename Derived>
150 return m1.rminus(m2);
A Submanifold is a subspace of a manifold defined by an origin m0 and a tangent subspace.
const M & m() const
Access value in embedded space.
SubManifold< M > rplus(const Eigen::MatrixBase< Derived > &a) const
Right-plus.
SubManifold()
Construct with full tangent space.
Eigen::Index dof() const
Degrees of freedom.
SubManifold(const M &m0, Eigen::Ref< const Eigen::VectorXi > fixed_dims)
As above, but with m = m0.
const M & m0() const
Access origin in embedded space.
const Eigen::VectorXi & fixed_dims() const
Access active dimensions.
Eigen::Vector< typename traits::man< M >::Scalar, -1 > rminus(const SubManifold< M > &other) const
Right-minus.
SubManifold(const M &m0, const M &m, Eigen::Ref< const Eigen::VectorXi > fixed_dims=Eigen::VectorXi::Zero(0))
Create a sub-manifold of M defined as [ x \in M : x = x0 \oplus \sum_k \alpha_k e_{i_k},...
PlainObject< M > Default()
Default-initialized Manifold with static dof.
Eigen::Vector< Scalar< M >, Dof< M > > Tangent
Tangent as a Dof-length vector.
typename traits::man< M >::Scalar Scalar
Manifold scalar type.
Eigen::Index dof(const M &m)
Manifold degrees of freedom (tangent space dimension)
Tangent< M > rminus(const M &g1, const Mo &g2)
Manifold right-minus.
PlainObject< M > rplus(const M &m, const Eigen::MatrixBase< Derived > &a)
Manifold right-plus.
typename traits::man< M >::template CastT< NewScalar > CastT
Cast'ed type.
CastT< NewScalar, M > cast(const M &m)
Cast to different scalar type.
typename traits::man< M >::PlainObject PlainObject
Manifold default type.
Trait class for making a class a Manifold instance via specialization.