class MultiDimMatrixIndex
A class to access multidimensional matrices stored in simple vector containers.
By default the storage is col major, although it can be changed with ColMajor() or RowMajor() functions.
template <typename ...Args> MultiDimMatrixIndex(Args ...args)
Sets in args the axis dimensions.
void SetNumAxis(int numAxis)
Sets the number of dimensions with numAxis.
void SetAxisDim(int axis, int dim)
Sets the size dim of the dimension axis.
void SetAxis1D(int dimX)
Sets the size dimX of unidimensional vector.
void SetAxis2D(int dimX, int dimY)
Sets with dimX and dimY the sizes of a bidimensional vector.
Upp::Vector<int> &GetAxisDim()
Gets the array of dimensions including the size of each.
int GetIndex(const Vector<int> &index) const
Gets the index in the storage of a multidimensional matrix of index included in Vector index..
template <typename T, typename... Args> int GetIndex(T t, Args... args) const
Gets the index in the storage of a multidimensional matrix of indexes t (t0, t1, ...).
template <typename... Args> int operator()(Args... args) const
Operator to get the index in the storage given index of the columns.
int GetIndex(int x, int y) const
Gets the index in the storage of a bidimensional matrix of index x and y.
bool IsValid(int x, int y) const
Gets if the bidimensional matrix index x and y is inside bounds..
int GetNumAxis() const
Gets the number of dimensions.
int size() const
Returns the size of the storage.
template <typename T> void RowMajorToColMajor(const T *d_row, T *d_col, const Vector<int>& dims)
Transforms an storage d_row in row major, to the same data in d_col in col major order. dims includes the size of each dimension.
template <typename T> void ColMajorToRowMajor(const T *d_col, T *d_row, const Vector<int>& dims)
Transforms an storage d_col in col major, to the same data in d_row in row major order. dims includes the size of each dimension.
|