13template <
typename _Scalar>
21 std::vector<polymorphic<Base>> m_components;
26 inline std::size_t
numComponents()
const {
return m_components.size(); }
28 template <
class Concrete>
inline void addComponent(
const Concrete &c) {
30 std::is_base_of_v<Base, Concrete> ||
31 std::is_same_v<Concrete, polymorphic<Base>>,
32 "Input type should either be derived from ManifoldAbstractTpl or be "
33 "polymorphic<ManifoldAbstractTpl>.");
34 m_components.emplace_back(c);
38 for (
const auto &c : other.m_components) {
50 : m_components(components) {}
53 : m_components(components) {}
61 inline int nx()
const {
64 r += m_components[i]->nx();
69 inline int ndx()
const {
72 r += m_components[i]->ndx();
82 template <
class VectorType,
class U = std::remove_const_t<VectorType>>
83 std::vector<U> split_impl(VectorType &x)
const;
85 template <
class VectorType,
class U = std::remove_const_t<VectorType>>
86 std::vector<U> split_vector_impl(VectorType &v)
const;
89 std::vector<VectorRef>
split(VectorRef x)
const {
90 return split_impl<VectorRef>(x);
93 std::vector<ConstVectorRef>
split(
const ConstVectorRef &x)
const {
94 return split_impl<const ConstVectorRef>(x);
98 return split_vector_impl<VectorRef>(v);
101 std::vector<ConstVectorRef>
split_vector(
const ConstVectorRef &v)
const {
102 return split_vector_impl<const ConstVectorRef>(v);
105 VectorXs
merge(
const std::vector<VectorXs> &xs)
const;
110 VectorRef out)
const;
113 VectorRef out)
const;
116 MatrixRef Jout,
int arg)
const;
119 MatrixRef Jout,
int arg)
const;
122 MatrixRef Jout,
int arg)
const;
157#include "proxsuite-nlp/modelling/spaces/cartesian-product.hxx"
159#ifdef PROXSUITE_NLP_ENABLE_TEMPLATE_INSTANTIATION
160#include "proxsuite-nlp/modelling/spaces/cartesian-product.txx"
#define PROXSUITE_NLP_DYNAMIC_TYPEDEFS(Scalar)
auto operator*(const polymorphic< ManifoldAbstractTpl< T > > &left, const polymorphic< ManifoldAbstractTpl< T > > &right)
The cartesian product of two or more manifolds.
std::size_t numComponents() const
std::vector< ConstVectorRef > split(const ConstVectorRef &x) const
void difference_impl(const ConstVectorRef &x0, const ConstVectorRef &x1, VectorRef out) const
Implementation of the manifold retraction operation.
CartesianProductTpl()=default
CartesianProductTpl(CartesianProductTpl &&)=default
CartesianProductTpl & operator=(const CartesianProductTpl &)=default
CartesianProductTpl(const CartesianProductTpl &)=default
void addComponent(const CartesianProductTpl &other)
std::vector< VectorRef > split(VectorRef x) const
bool isNormalized(const ConstVectorRef &x) const
Check if the input vector x is a viable element of the manifold.
int ndx() const
Get manifold tangent space dimension.
VectorXs merge_vector(const std::vector< VectorXs > &vs) const
int nx() const
Get manifold representation dimension.
CartesianProductTpl(const polymorphic< Base > &left, const polymorphic< Base > &right)
CartesianProductTpl & operator=(CartesianProductTpl &&)=default
VectorXs neutral() const
Get the neutral element from the manifold (if this makes sense).
VectorXs merge(const std::vector< VectorXs > &xs) const
CartesianProductTpl(const std::vector< polymorphic< Base > > &components)
std::vector< VectorRef > split_vector(VectorRef v) const
const Base & getComponent(std::size_t i) const
void JintegrateTransport(const ConstVectorRef &x, const ConstVectorRef &v, MatrixRef Jout, int arg) const
Perform the parallel transport operation.
CartesianProductTpl(std::initializer_list< polymorphic< Base > > components)
std::vector< ConstVectorRef > split_vector(const ConstVectorRef &v) const
void Jdifference_impl(const ConstVectorRef &x0, const ConstVectorRef &x1, MatrixRef Jout, int arg) const
void integrate_impl(const ConstVectorRef &x, const ConstVectorRef &v, VectorRef out) const
Perform the manifold integration operation.
void addComponent(const Concrete &c)
VectorXs rand() const
Sample a random point on the manifold.
void Jintegrate_impl(const ConstVectorRef &x, const ConstVectorRef &v, MatrixRef Jout, int arg) const