MultiDimMatrixIndex

 

template <class T>

class MultiDimMatrix

 

A simple class to handle multidimensional matrices storing any data type (template <class T>).

By default the storage is col major, although it can be changed with ColMajor() or RowMajor() functions.

 

 

Constructor Detail


 

template <typename ...Args> MultiDimMatrix<T>(Args ...args)

Sets in args the axis dimensions.

 

 

Public Member List

 

template <typename ...Args> T& operator()(Args ...args)

Sets the data in the indicated index of each dimension.

 


 

T& operator()(const Vector<int>& indx)

Sets the data in the indicated index of each dimension.

 


 

template <typename ...Args> const T& operator()(Args ...args) const

Access the data in the indicated index of each dimension.

 


 

const T& operator()(const Vector<int>& indx) const

Access the data in the indicated index of each dimension..

 


 

Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> block(const Vector<int>& indx, int idrow, int wrow, int idcol, int wcol)

Returns an Eigen::Matrix with a copy of the data from indx, considering idrow as the dimension of the rows and idcol as the dimension of the columns, of height wrow and width wcol.

 


 

int GetNumAxis() const

Gets the number of dimensions.

 


 

void ColMajor(bool c = true)

It c is true sets the storage as column major. If false it sets it as row major.

 


 

void RowMajor(bool c = true)

It c is true sets the storage as row major. If false it sets it as column major.

 


 

int size() const

Returns the number of elements of the stored data.

 


 

int size(int dim) const

Returns the number of elements of dimension dim.

 


 

template <typename ...Args> void Resize(int t, Args ...args)

Resizes the matrix with the new sizes per dimension in args.

 


 

void Resize(const Vector<int>& dim)

Resizes the matrix with the new sizes per dimension in dim.

 


 

const T *begin() const

Gets a pointer to the raw data.