unravel_index

mipylib.numeric.minum.unravel_index(a, dims)

Converts a flat index or array of flat indices into a tuple of coordinate arrays.

Parameters
  • indices – (array_like) An integer array whose elements are indices into the flattened version of an array of dimensions dims.

  • dims – (tuple of ints) The shape of the array to use for unraveling indices.

Returns

tuple of ndarray. Each array in the tuple has the same shape as the indices array.

Examples:

>>> unravel_index(22, (7,6))
(3, 4)