Module Ndarray.Indexing

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

type index =
  1. | F
  2. | I of int
  3. | T of int
  4. | L of int list
  5. | R of int * int
  6. | R' of int * int * int
val slice_of_coords : int list list -> index list

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 list -> int list -> int list list

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 list -> int list -> int list

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