Module Bigarray.Array0

module Array0: sig .. end

Zero-dimensional arrays. The Array0 structure provides operations similar to those of Bigarray.Genarray, but specialized to the case of zero-dimensional arrays that only contain a single scalar value. Statically knowing the number of dimensions of the array allows faster operations, and more precise static type-checking.


type t('a, 'b, 'c);

The type of zero-dimensional Bigarrays whose elements have OCaml type 'a, representation kind 'b, and memory layout 'c.

let create: (Bigarray.kind('a, 'b), Bigarray.layout('c)) => t('a, 'b, 'c);

Array0.create kind layout returns a new Bigarray of zero dimension. kind and layout determine the array element kind and the array layout as described for Bigarray.Genarray.create.

let init: (Bigarray.kind('a, 'b), Bigarray.layout('c), 'a) => t('a, 'b, 'c);

Array0.init kind layout v behaves like Array0.create kind layout except that the element is additionally initialized to the value v.

let kind: t('a, 'b, 'c) => Bigarray.kind('a, 'b);

Return the kind of the given Bigarray.

let layout: t('a, 'b, 'c) => Bigarray.layout('c);

Return the layout of the given Bigarray.

let change_layout: (t('a, 'b, 'c), Bigarray.layout('d)) => t('a, 'b, 'd);

Array0.change_layout a layout returns a Bigarray with the specified layout, sharing the data with a. No copying of elements is involved: the new array and the original array share the same storage space.

let size_in_bytes: t('a, 'b, 'c) => int;

size_in_bytes a is a's Bigarray.kind_size_in_bytes.

let get: t('a, 'b, 'c) => 'a;

Array0.get a returns the only element in a.

let set: (t('a, 'b, 'c), 'a) => unit;

Array0.set a x v stores the value v in a.

let blit: (t('a, 'b, 'c), t('a, 'b, 'c)) => unit;

Copy the first Bigarray to the second Bigarray. See Bigarray.Genarray.blit for more details.

let fill: (t('a, 'b, 'c), 'a) => unit;

Fill the given Bigarray with the given value. See Bigarray.Genarray.fill for more details.

let of_value:
  (Bigarray.kind('a, 'b), Bigarray.layout('c), 'a) => t('a, 'b, 'c);

Build a zero-dimensional Bigarray initialized from the given value.