Module Numpy

module Numpy: sig .. end

OCaml Interface for Numpy.

Arrays are passed in place (without copy): Python and OCaml programs can change the contents of the array and the changes are visible in the other language.

The following table gives the correspondence between bigarray kinds and Numpy element types.

Other kinds/element types are not supported. In particular, OCaml integer kind, int, has no equivalent type in Numpy.

val of_bigarray : ('a, 'b, 'c) Bigarray.Genarray.t -> Py.Object.t

of_bigarray a returns a Numpy array that shares the same contents than the OCaml array a.

val to_bigarray : ('a, 'b) Bigarray.kind ->
'c Bigarray.layout -> Py.Object.t -> ('a, 'b, 'c) Bigarray.Genarray.t

to_bigarray kind layout a returns a bigarray that shares the same contents than the Numpy array a.