package pyml

  1. Overview
  2. Docs
val of_indexed_structure : (int -> Object.t) -> (int -> Object.t -> unit) -> int -> Object.t

Py.Array.of_indexed_structure getter setter length returns a Python array-like structure a of length length, such that reading a[i] returns getter i and a[i] = v calls setter i v. To make the array-like structure read-only, raise an exception in setter.

val of_array : ('a -> Object.t) -> (Object.t -> 'a) -> 'a array -> Object.t

Py.Array.of_array getter setter array returns a Python array-like structure accessing the elements of array via getter and setter. To make the array-like structure read-only, raise an exception in setter.

val numpy_api : unit -> Object.t

Returns the object which contains the entry points to the Numpy API. It is used internally by the following functions and by the Numpy module.

val pyarray_type : unit -> Object.t

Returns the type of Numpy arrays.

numpy a returns a Numpy array that shares the same contents than the OCaml array a. The array is passed in place (without copy) which relies on the unboxed representation of floatarray : Python programs can change the contents of the array and the changes are visible in the OCaml array. Note that the Numpy module provides a more general interface between Numpy arrays and OCaml bigarrays.

val numpy_get_array : Object.t -> Stdcompat.floatarray

numpy_get_array a returns the OCaml array from which the Numpy array a has been converted from. Note that this function fails if a has not been obtained by calling the numpy function above. If you need to convert an arbitrary Numpy array to OCaml, you should use bigarrays and the Numpy module.

OCaml

Innovation. Community. Security.