ravel_index

Function ravel_index 

pub fn ravel_index<I>(indices: &[I], shape: &[usize]) -> usize
where I: AsIndex,
Expand description

Compute the ravel index for the given coordinates.

This returns the row-major order raveling:

  • strides[-1] = 1
  • strides[i] = strides[i+1] * dims[i+1]
  • dim_strides = coords * strides
  • ravel = sum(dim_strides)

§Arguments

  • indices: the index for each dimension; must be the same length as shape.
  • shape: the shape of each dimension; be the same length as indices.

§Returns

  • the ravel offset index.