3 #include <yaml-cpp/yaml.h> 7 template<
class _Scalar,
int _Rows,
int _Cols,
int _Options,
int _MaxRows,
int _MaxCols>
8 struct convert<
Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>> {
10 static Node
encode(
const Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> & M) {
11 YAML::Node matrixnode;
12 for (
int r = 0; r < M.rows(); r++) {
14 for (
int c = 0;
c < M.cols();
c++) {
17 matrixnode[r] = rownode;
22 static bool decode(
const Node& matrixnode, Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> & M) {
23 if (matrixnode.size() != (std::size_t)M.rows())
throw std::runtime_error(
"Matrix row size mismatch.");
24 for (
int r = 0; r < M.rows(); r++) {
25 YAML::Node
const& rownode = matrixnode[r];
26 if (rownode.size() != (std::size_t)M.cols())
throw std::runtime_error(
"Matrix col size mismatch.");
27 for (
int c = 0;
c < M.cols();
c++) {
28 M(r,
c) = rownode[
c].as<_Scalar>();
static bool decode(const Node &matrixnode, Eigen::Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &M)
Definition: matrix.hpp:22
Basis< N, D, 1 > Eigen
Collection of types associated with a matrix potential in eigen basis.
Definition: bases.hpp:47
var c
Definition: jquery.js:23
Definition: complex.hpp:10
static Node encode(const Eigen::Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &M)
Definition: matrix.hpp:10