6 #ifndef ECHELON_EIGEN3_HPP 7 #define ECHELON_EIGEN3_HPP 9 #include <echelon/hdf5/container_adaption.hpp> 11 #include <Eigen/Dense> 19 template <
typename Scalar,
int Rows,
int Cols,
int Options,
int MaxRows,
int MaxCols>
20 inline std::vector<std::size_t>
21 shape(
const Eigen::Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>& container, adl_enabler)
23 return {
static_cast<std::size_t
>(container.rows()), static_cast<std::size_t>(container.cols())};
26 template <
typename Scalar,
int Options,
int MaxRows,
int MaxCols>
27 inline void reshape(Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic, Options, MaxRows, MaxCols>& container,
28 const std::vector<std::size_t>& new_shape, adl_enabler)
30 assert(new_shape.size() == 2);
32 container.resize(new_shape[0], new_shape[1]);
35 template <
typename Scalar,
int Cols,
int Options,
int MaxRows,
int MaxCols>
36 inline void reshape(Eigen::Matrix<Scalar, Eigen::Dynamic, Cols, Options, MaxRows, MaxCols>& container,
37 const std::vector<std::size_t>& new_shape, adl_enabler)
39 assert(new_shape.size() == 1);
41 container.resize(new_shape[0], Eigen::NoChange);
44 template <
typename Scalar,
int Rows,
int Options,
int MaxRows,
int MaxCols>
45 inline void reshape(Eigen::Matrix<Scalar, Rows, Eigen::Dynamic, Options, MaxRows, MaxCols>& container,
46 const std::vector<std::size_t>& new_shape, adl_enabler)
48 assert(new_shape.size() == 1);
50 container.resize(Eigen::NoChange, new_shape[0]);
echelon's core namespace
Definition: attribute.cpp:10
auto reshape(C &container, const std::vector< std::size_t > &new_shape) -> decltype(reshape(container, new_shape, adl_enabler
Reshapes the container.
Definition: container_adaption.hpp:64