Xped
Loading...
Searching...
No Matches
EigenPlugins.hpp
Go to the documentation of this file.
1#ifndef XPED_EIGEN_DENSE_BASE_ADDONS_H_
2#define XPED_EIGEN_DENSE_BASE_ADDONS_H_
3
4#define EIGEN_STAN_MATRIXBASE_PLUGIN
5
6template <typename Ar>
7void serialize(Ar& ar) const
8{
9 derived().eval();
10 const std::size_t rows = derived().rows(), cols = derived().cols();
11 std::vector<double> data(derived().data(), derived().data() + derived().size());
12 ar& YAS_OBJECT_NVP("Matrix", ("data", data), ("rows", rows), ("cols", cols));
13}
14
15template <typename Ar>
16void serialize(Ar& ar)
17{
18 // derived().eval();
19 std::size_t rows, cols;
20 std::vector<double> data;
21 ar& YAS_OBJECT_NVP("Matrix", ("data", data), ("rows", rows), ("cols", cols));
22 derived().resize(rows, cols);
23 Eigen::Map<Derived> m(data.data(), rows, cols);
24 derived() = m;
25}
26
27#include "stan/math/prim/eigen_plugins.h"
28
29#endif
void serialize(Ar &ar) const
Definition: EigenPlugins.hpp:7