Template Class MatrixAdapter#

Inheritance Relationships#

Base Type#

Class Documentation#

template<typename dtype>
class MatrixAdapter : public pele::Array<dtype>#

This is a very minimal implementation of a matrix.

It’s primary function is to act as a wrapper for pele::Array, so a pele array can be act as a matrix temporarily. The idea is to redo something like the reshape() function in numpy.

Public Functions

inline MatrixAdapter(size_t dim1, size_t dim2, dtype val = 0)#

Construct a matrix and allocate memory for it.

inline MatrixAdapter(pele::Array<double> v, size_t dim2)#

wrap a pele::Array to act like a matrix

This is like numpy.reshape. v.size() must be divisable by dim2

inline MatrixAdapter(double *data, size_t dim1, size_t dim2)#

wrap an existing block of memory

inline dtype const &operator()(size_t i, size_t j) const#

access the element of the array at row i and column j

inline dtype &operator()(size_t i, size_t j)#
inline std::pair<size_t, size_t> shape() const#

return a pair giving the shape of the array.