Function libwalrus::lin_to_multi

Function Documentation

std::vector<int> libwalrus::lin_to_multi(unsigned long long int linear_index, const std::vector<int> &maxes)

Converts a linear index to a multi index e.g. if we wanted the multi-index (i,j) of an element in a 2x2 matrix given a linear index of 3 in the array storing the matrix, the maxes vector would be {1,1} and this function would return (1,0)

Return

multi-index corresponding to the linear index

Parameters
  • linear_index: the “flattened” index

  • maxes: a vector of integers, representing the max index value of each indice in the multi-index object.