5#ifndef __pinocchio_serialization_eigen_matrix_hpp__ 
    6#define __pinocchio_serialization_eigen_matrix_hpp__ 
    9#include "pinocchio/math/tensor.hpp" 
   11#include <boost/serialization/split_free.hpp> 
   12#include <boost/serialization/vector.hpp> 
   13#include <boost/serialization/array.hpp> 
   19#if defined PINOCCHIO_WITH_HPP_FCL 
   20  #include <hpp/fcl/config.hh> 
   21  #if !HPP_FCL_VERSION_AT_LEAST(3, 0, 0)  
   22    #define HPP_FCL_SKIP_EIGEN_BOOST_SERIALIZATION 
   23    #include <hpp/fcl/serialization/eigen.h> 
   28      #if __GNUC__ >= 7 && __cplusplus >= 201703L 
   31  namespace serialization
 
   41    struct traits<boost::serialization::U>
 
   57    #if __GNUC__ >= 7 && __cplusplus >= 201703L 
   60  namespace serialization
 
   70    struct traits<boost::serialization::U>
 
   85#if (defined(_MSVC_LANG) && _MSVC_LANG >= 201703) 
   90    class binary_iarchive;
 
  100    struct traits<boost::archive::binary_iarchive>
 
  108    struct traits<boost::archive::xml_iarchive>
 
  116    struct traits<boost::archive::text_iarchive>
 
  129  namespace serialization
 
  142      const Eigen::Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols> & m,
 
  145      Eigen::DenseIndex rows(m.rows()), cols(m.cols());
 
  146      if (Rows == Eigen::Dynamic)
 
  147        ar & BOOST_SERIALIZATION_NVP(rows);
 
  148      if (Cols == Eigen::Dynamic)
 
  149        ar & BOOST_SERIALIZATION_NVP(cols);
 
  150      ar & make_nvp(
"data", make_array(m.data(), (
size_t)m.size()));
 
  163      Eigen::Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols> & m,
 
  166      Eigen::DenseIndex rows = Rows, cols = Cols;
 
  167      if (Rows == Eigen::Dynamic)
 
  168        ar >> BOOST_SERIALIZATION_NVP(rows);
 
  169      if (Cols == Eigen::Dynamic)
 
  170        ar >> BOOST_SERIALIZATION_NVP(cols);
 
  171      m.resize(rows, cols);
 
  172      ar >> make_nvp(
"data", make_array(m.data(), (
size_t)m.size()));
 
  185      Eigen::Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols> & m,
 
  186      const unsigned int version)
 
  188      split_free(ar, m, version);
 
  191    template<
class Archive, 
typename PlainObjectBase, 
int MapOptions, 
typename Str
ideType>
 
  194      const Eigen::Map<PlainObjectBase, MapOptions, StrideType> & m,
 
  197      Eigen::DenseIndex rows(m.rows()), cols(m.cols());
 
  198      if (PlainObjectBase::RowsAtCompileTime == Eigen::Dynamic)
 
  199        ar & BOOST_SERIALIZATION_NVP(rows);
 
  200      if (PlainObjectBase::ColsAtCompileTime == Eigen::Dynamic)
 
  201        ar & BOOST_SERIALIZATION_NVP(cols);
 
  202      ar & make_nvp(
"data", make_array(m.data(), (
size_t)m.size()));
 
  205    template<
class Archive, 
typename PlainObjectBase, 
int MapOptions, 
typename Str
ideType>
 
  208      Eigen::Map<PlainObjectBase, MapOptions, StrideType> & m,
 
  211      Eigen::DenseIndex rows = PlainObjectBase::RowsAtCompileTime,
 
  212                        cols = PlainObjectBase::ColsAtCompileTime;
 
  213      if (PlainObjectBase::RowsAtCompileTime == Eigen::Dynamic)
 
  214        ar >> BOOST_SERIALIZATION_NVP(rows);
 
  215      if (PlainObjectBase::ColsAtCompileTime == Eigen::Dynamic)
 
  216        ar >> BOOST_SERIALIZATION_NVP(cols);
 
  217      m.resize(rows, cols);
 
  218      ar >> make_nvp(
"data", make_array(m.data(), (
size_t)m.size()));
 
  221    template<
class Archive, 
typename PlainObjectBase, 
int MapOptions, 
typename Str
ideType>
 
  224      Eigen::Map<PlainObjectBase, MapOptions, StrideType> & m,
 
  225      const unsigned int version)
 
  227      split_free(ar, m, version);
 
  230#if !defined(PINOCCHIO_WITH_EIGEN_TENSOR_MODULE)                                                   \ 
  231  && ((__cplusplus <= 199711L && EIGEN_COMP_MSVC < 1900) || defined(__CUDACC__) || defined(EIGEN_AVOID_STL_ARRAY)) 
  232    template<
class Archive, 
typename _IndexType, std::
size_t _NumIndices>
 
  236      ar & make_nvp(
"array", make_array(&a.front(), _NumIndices));
 
  239    template<
class Archive, 
typename _IndexType, std::
size_t _NumIndices>
 
  243      ar >> make_nvp(
"array", make_array(&a.front(), _NumIndices));
 
  246    template<
class Archive, 
typename _IndexType, std::
size_t _NumIndices>
 
  250      split_free(ar, a, version);
 
  253    template<
class Archive, 
class T, std::
size_t N>
 
  254    void save(Archive & ar, 
const std::array<T, N> & a, 
const unsigned int version)
 
  256      typedef std::array<T, N> Array;
 
  257      serialize(ar, 
const_cast<Array &
>(a), version);
 
  260    template<
class Archive, 
class T, std::
size_t N>
 
  261    void load(Archive & ar, std::array<T, N> & a, 
const unsigned int version)
 
  263      serialize(ar, a, version);
 
  267#ifdef PINOCCHIO_WITH_EIGEN_TENSOR_MODULE 
  269    template<
class Archive, 
typename _IndexType, 
int _NumIndices>
 
  271      Archive & ar, 
const Eigen::DSizes<_IndexType, _NumIndices> & ds, 
const unsigned int version)
 
  276    template<
class Archive, 
typename _IndexType, 
int _NumIndices>
 
  277    void load(Archive & ar, Eigen::DSizes<_IndexType, _NumIndices> & ds, 
const unsigned int version)
 
  282    template<
class Archive, 
typename _IndexType, 
int _NumIndices>
 
  284    serialize(Archive & ar, Eigen::DSizes<_IndexType, _NumIndices> & ds, 
const unsigned int version)
 
  291    template<
class Archive, 
typename _Scalar, 
int _NumIndices, 
int _Options, 
typename _IndexType>
 
  294      const ::pinocchio::Tensor<_Scalar, _NumIndices, _Options, _IndexType> & t,
 
  297      typedef ::pinocchio::Tensor<_Scalar, _NumIndices, _Options, _IndexType> Tensor;
 
  298      const typename Tensor::Dimensions & dimensions = t.dimensions();
 
  300      ar & BOOST_SERIALIZATION_NVP(dimensions);
 
  301      ar & make_nvp(
"data", make_array(t.data(), (
size_t)t.size()));
 
  304    template<
class Archive, 
typename _Scalar, 
int _NumIndices, 
int _Options, 
typename _IndexType>
 
  310      typedef ::pinocchio::Tensor<_Scalar, _NumIndices, _Options, _IndexType> Tensor;
 
  311      typename Tensor::Dimensions dimensions;
 
  313      ar >> BOOST_SERIALIZATION_NVP(dimensions);
 
  314      t.resize(dimensions);
 
  316      ar >> make_nvp(
"data", make_array(t.data(), (
size_t)t.size()));
 
  319    template<
class Archive, 
typename _Scalar, 
int _NumIndices, 
int _Options, 
typename _IndexType>
 
  323      const unsigned int version)
 
  325      split_free(ar, t, version);