22#ifndef EOS_EIGEN_MATRIX_BINARY_CEREALISATION_HPP
23#define EOS_EIGEN_MATRIX_BINARY_CEREALISATION_HPP
25#include "cereal/cereal.hpp"
52template <
class Archive,
class _Scalar,
int _Rows,
int _Cols,
int _Options,
int _MaxRows,
int _MaxCols>
54typename std::enable_if<traits::is_output_serializable<BinaryData<_Scalar>, Archive>::value,
void>::type
55save(Archive& ar,
const Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>& matrix)
57 const std::int32_t rows =
static_cast<std::int32_t
>(matrix.rows());
58 const std::int32_t cols =
static_cast<std::int32_t
>(matrix.cols());
61 ar(binary_data(matrix.data(), rows * cols *
sizeof(_Scalar)));
72template <
class Archive,
class _Scalar,
int _Rows,
int _Cols,
int _Options,
int _MaxRows,
int _MaxCols>
74typename std::enable_if<traits::is_input_serializable<BinaryData<_Scalar>, Archive>::value,
void>::type
75load(Archive& ar, Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>& matrix)
82 matrix.resize(rows, cols);
84 ar(binary_data(matrix.data(),
static_cast<std::size_t
>(rows * cols *
sizeof(_Scalar))));
Serialisation of Eigen matrices for the serialisation library cereal (http://uscilab....
Definition: eigen_cerealisation.hpp:41
std::enable_if< traits::is_input_serializable< BinaryData< _Scalar >, Archive >::value, void >::type load(Archive &ar, Eigen::Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &matrix)
De-serialise an Eigen::Matrix using cereal.
Definition: eigen_cerealisation.hpp:75
std::enable_if< traits::is_output_serializable< BinaryData< _Scalar >, Archive >::value, void >::type save(Archive &ar, const Eigen::Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &matrix)
Serialise an Eigen::Matrix using cereal.
Definition: eigen_cerealisation.hpp:55