jon.recoil.org

Module Bigarray.Array0Source

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.

Sourcetype (!'a, !'b, !'c) t

The type of zero-dimensional Bigarrays whose elements have OCaml type 'a, representation kind 'b, and memory layout '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 Genarray.create.

Sourceval init : ('a, 'b) Stdlib.Bigarray.kind -> 'c Stdlib.Bigarray.layout -> 'a @ local -> ('a, 'b, 'c) Stdlib.Bigarray.Array0.t

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

  • since 4.12
Sourceval kind : ('a, 'b, 'c) Stdlib.Bigarray.Array0.t @ immutable -> ('a, 'b) Stdlib.Bigarray.kind @@ stateless

Return the kind of the given Bigarray.

Sourceval layout : ('a, 'b, 'c) Stdlib.Bigarray.Array0.t @ immutable -> 'c Stdlib.Bigarray.layout @@ stateless

Return the layout of the given Bigarray.

Sourceval change_layout : ('a, 'b, 'c) Stdlib.Bigarray.Array0.t -> 'd Stdlib.Bigarray.layout -> ('a, 'b, 'd) Stdlib.Bigarray.Array0.t

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.

  • since 4.06
Sourceval size_in_bytes : ('a, 'b, 'c) Stdlib.Bigarray.Array0.t @ local immutable -> int

size_in_bytes a is a's kind_size_in_bytes.

Sourceval get : ('a, 'b, 'c) Stdlib.Bigarray.Array0.t @ local shared -> 'a

Array0.get a returns the only element in a.

Sourceval set : ('a, 'b, 'c) Stdlib.Bigarray.Array0.t @ local -> 'a @ local -> unit

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

Sourceval blit : ('a, 'b, 'c) Stdlib.Bigarray.Array0.t @ shared -> ('a, 'b, 'c) Stdlib.Bigarray.Array0.t -> unit

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

Sourceval fill : ('a, 'b, 'c) Stdlib.Bigarray.Array0.t -> 'a -> unit

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

Sourceval of_value : ('a, 'b) Stdlib.Bigarray.kind -> 'c Stdlib.Bigarray.layout -> 'a @ local -> ('a, 'b, 'c) Stdlib.Bigarray.Array0.t

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