14template <
typename Tdata>
18 using data_type = Tdata;
28 inline void resize(VarType m_, VarType n_, Tdata x = 0)
32 data.resize(m_ * n_, x);
35 inline void reshape(VarType m_, VarType n_)
43 inline auto rows()
const {
return m; }
44 inline auto cols()
const {
return n; }
45 inline auto size()
const {
return m * n; }
49 return data[i + j * m];
54 return data[i + j * m];
57 void print(std::ostream &os = std::cout)
const
59 for (VarType i = 0; i < m; i++) {
60 for (VarType j = 0; j < n; j++)
61 os << this->
operator()(i, j) <<
", ";
67 template <
typename TTdata>
71template <
typename Tdata>
Definition: DynamicMatrix.hpp:16
DynamicMatrix(VarType m_, VarType n_, Tdata x)
Definition: DynamicMatrix.hpp:26
friend std::ostream & operator<<(std::ostream &os, const DynamicMatrix< TTdata > &M)
auto & operator()(VarType i, VarType j)
Definition: DynamicMatrix.hpp:47
void reshape(VarType m_, VarType n_)
Definition: DynamicMatrix.hpp:35
std::vector< Tdata > data
Definition: DynamicMatrix.hpp:22
void resize(VarType m_, VarType n_, Tdata x=0)
Definition: DynamicMatrix.hpp:28
DynamicMatrix(VarType m_)
Sequare matrix.
Definition: DynamicMatrix.hpp:24
auto rows() const
Definition: DynamicMatrix.hpp:43
void print(std::ostream &os=std::cout) const
Definition: DynamicMatrix.hpp:57
auto cols() const
Definition: DynamicMatrix.hpp:44
auto size() const
Definition: DynamicMatrix.hpp:45
auto operator()(VarType i, VarType j) const
Definition: DynamicMatrix.hpp:52
DynamicMatrix(VarType m_, VarType n_)
Definition: DynamicMatrix.hpp:25
Slide namespace contains all the types, classes, and functions for the simulation framework.
Definition: Cell.hpp:27
std::ostream & operator<<(std::ostream &os, const DynamicMatrix< Tdata > &M)
Definition: DynamicMatrix.hpp:72