21 #ifndef __MATRIXARRAY_H__
22 #define __MATRIXARRAY_H__
33 namespace serialization {
94 MatrixArray ( std::string name_, std::initializer_list<std::tuple<std::string, size_t, size_t> > args_) :
array_name ( name_ ) {
108 std::string tmp_name = i.first;
126 std::string tmp_name = i.first;
141 void add ( std::initializer_list<std::tuple<std::string, size_t, size_t> > params_ ) {
142 for (
auto i : params_ ) {
152 void add ( std::tuple<std::string, size_t, size_t> param_ ) {
163 void add ( std::string name_,
size_t input_,
size_t output_) {
185 throw std::range_error(
"MatrixArray " +
array_name +
" size is smaller than: " + std::to_string(number_));
214 throw std::range_error(
"MatrixArray " +
array_name +
" does not have a key " + key_);
216 return ( *
this ) [std::string ( 1, key_ )];
226 throw std::range_error(
"MatrixArray " +
array_name +
" does not have a key " + key_);
241 os_ <<
"(" << i.second <<
") [" << i.first <<
"]:\n";
242 os_ << (*obj_.
matrices[i.second]) << std::endl;
252 for (
size_t i = 0; i <
matrices.size(); i++ )
266 std::map<std::string, size_t>
keys() {
297 template<
class Archive>
298 void save(Archive & ar,
const unsigned int version)
const {
315 template<
class Archive>
316 void load(Archive & ar,
const unsigned int version) {
322 for (
size_t i=0; i <
size; i++) {
323 std::string tmp_name;
336 BOOST_SERIALIZATION_SPLIT_MEMBER()
345 BOOST_CLASS_VERSION(mic::types::MatrixArray<
short>, 1)
346 BOOST_CLASS_VERSION(mic::types::MatrixArray<
int>, 1)
347 BOOST_CLASS_VERSION(mic::types::MatrixArray<
long>, 1)
348 BOOST_CLASS_VERSION(mic::types::MatrixArray<
float>, 1)
349 BOOST_CLASS_VERSION(mic::types::MatrixArray<
double>, 1)
void save(Archive &ar, const unsigned int version) const
void load(Archive &ar, const unsigned int version)
void add(std::string name_, std::shared_ptr< mic::types::Matrix< T > > matrix_ptr_)
MatrixArray(const MatrixArray &other)
Contains definition of basic matrix datatypes derived from Eigen.
std::string array_name
Name of the given vector of matrices.
std::vector< mic::types::MatrixPtr< T > > matrices
Vector of matrices.
MatrixArray(std::string name_)
MatrixArray(std::string name_, std::initializer_list< std::tuple< std::string, size_t, size_t > > args_)
std::map< std::string, size_t > keys_map
Vector of names of consecutive matrices in the array.
void add(std::tuple< std::string, size_t, size_t > param_)
A dynamic array of matrices. It's just what it looks like - std::vector<Matrix>; elements are are acc...
friend class boost::serialization::access
bool keyExists(char key_)
bool keyExists(std::string key_)
typename std::shared_ptr< mic::types::Matrix< T > > MatrixPtr
Typedef for a shared pointer to template-typed dynamic matrices.
std::map< std::string, size_t > keys()
friend std::ostream & operator<<(std::ostream &os_, const MatrixArray &obj_)
MatrixArray & operator=(const MatrixArray &other)
mic::types::MatrixPtr< T > & operator[](size_t number_)
Template-typed Matrix of dynamic size. Uses OpenBLAS if found by CMAKE - overloaded, specializations of * operator for types: float, double.
void add(std::initializer_list< std::tuple< std::string, size_t, size_t > > params_)
void add(std::string name_, size_t input_, size_t output_)