15  using Scalar = _Scalar;
 
   21  std::vector<polymorphic<Base>> m_components;
 
   24  const Base &getComponent(std::size_t i)
 const { 
return *m_components[i]; }
 
   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);
 
   37  inline void addComponent(
const CartesianProductTpl &other) {
 
   38    for (
const auto &c : other.m_components) {
 
   39      this->addComponent(c);
 
   43  CartesianProductTpl() = 
default;
 
   44  CartesianProductTpl(
const CartesianProductTpl &) = 
default;
 
   45  CartesianProductTpl &operator=(
const CartesianProductTpl &) = 
default;
 
   46  CartesianProductTpl(CartesianProductTpl &&) = 
default;
 
   47  CartesianProductTpl &operator=(CartesianProductTpl &&) = 
default;
 
   49  CartesianProductTpl(
const std::vector<polymorphic<Base>> &components)
 
   50      : m_components(components) {}
 
   52  CartesianProductTpl(std::initializer_list<polymorphic<Base>> components)
 
   53      : m_components(components) {}
 
   55  CartesianProductTpl(
const polymorphic<Base> &left,
 
   56                      const polymorphic<Base> &right) {
 
   61  inline int nx()
 const {
 
   63    for (std::size_t i = 0; i < numComponents(); i++) {
 
   64      r += m_components[i]->nx();
 
 
   69  inline int ndx()
 const {
 
   71    for (std::size_t i = 0; i < numComponents(); i++) {
 
   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);
 
   97  std::vector<VectorRef> split_vector(VectorRef v)
 const {
 
   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;
 
  107  VectorXs merge_vector(
const std::vector<VectorXs> &vs) 
const;
 
  110                      VectorRef out) 
const;
 
  113                       VectorRef out) 
const;
 
  115  void Jintegrate_impl(
const ConstVectorRef &x, 
const ConstVectorRef &v,
 
  116                       MatrixRef Jout, 
int arg) 
const;
 
  119                           MatrixRef Jout, 
int arg) 
const;
 
  121  void Jdifference_impl(
const ConstVectorRef &x0, 
const ConstVectorRef &x1,
 
  122                        MatrixRef Jout, 
int arg) 
const;