Module Ndarray.Indexing

A module housing functions for creating and manipulating indices and slices for working with Zarr arrays.

type index =
  1. | I of int
  2. | L of int array
  3. | R of int array
val slice_of_coords : int array list -> index array

slice_of_coords c takes a list of array coordinates and returns a slice corresponding to the coordinates. Elements of each slice variant are sorted in increasing order.

val coords_of_slice : index array -> int array -> int array array

coords_of_slice s shp returns an array of coordinates given a slice s and array shape shp.

val cartesian_prod : int list list -> int list list

cartesian_prod ll returns a cartesian product of the elements of list ll. It is mainly used to generate a C-order of chunk indices in a regular Zarr array grid.

val slice_shape : index array -> int array -> int array

slice_shape s shp returns the shape of slice s within an array of shape shp.