package np

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type tag = [
  1. | `Ndindex
]
type t = [ `Ndindex | `Object ] Obj.t
val of_pyobject : Py.Object.t -> t
val to_pyobject : [> tag ] Obj.t -> Py.Object.t
val create : int list -> t

An N-dimensional iterator object to index arrays.

Given the shape of an array, an `ndindex` instance iterates over the N-dimensional index of the array. At each iteration a tuple of indices is returned, the last dimension is iterated over first.

Parameters ---------- `*args` : ints The size of each dimension of the array.

See Also -------- ndenumerate, flatiter

Examples -------- >>> for index in np.ndindex(3, 2, 1): ... print(index) (0, 0, 0) (0, 1, 0) (1, 0, 0) (1, 1, 0) (2, 0, 0) (2, 1, 0)

val __iter__ : [> tag ] Obj.t -> Py.Object.t

None

val ndincr : [> tag ] Obj.t -> Py.Object.t

Increment the multi-dimensional index by one.

This method is for backward compatibility only: do not use.

val next : [> tag ] Obj.t -> int array

Standard iterator method, updates the index and returns the index tuple.

Returns ------- val : tuple of ints Returns a tuple containing the indices of the current iteration.

val to_string : t -> string

Print the object to a human-readable representation.

val show : t -> string

Print the object to a human-readable representation.

val pp : Format.formatter -> t -> unit

Pretty-print the object to a formatter.

OCaml

Innovation. Community. Security.