Template Function Indexer::deIndexer

Function Documentation

template<typename T = size_t, typename D = std::vector<T>, typename L = D>
L Indexer::deIndexer(const D &dims, const T &index)

Produces a location in a multi-dimensional array from a one-dimensional index.

Given the dimensions of a multi-dimensional array and a one-dimensional index in the flattened representation of that array, this function returns the equivalent location as a list of positions on the axes of the array.

Parameters:
  • dims – An ordered container holding the sequence of dimension sizes.

  • index – The one-dimensional index to be converted to a mulit-dimensional location.

Returns:

The multi-dimensional location equivalent to the one-dimensional index with an array of the provided arguments.