OCaml library : Bigarray.Array0 (original) (raw)

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 (!'a, !'b, !'c) t

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

val create : ('a, 'b) [Bigarray.kind](Bigarray.html#TYPEkind) -> 'c [Bigarray.layout](Bigarray.html#TYPElayout) -> ('a, 'b, 'c) [t](Bigarray.Array0.html#TYPEt)

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.

val init : ('a, 'b) [Bigarray.kind](Bigarray.html#TYPEkind) -> 'c [Bigarray.layout](Bigarray.html#TYPElayout) -> 'a -> ('a, 'b, 'c) [t](Bigarray.Array0.html#TYPEt)

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

val kind : ('a, 'b, 'c) [t](Bigarray.Array0.html#TYPEt) -> ('a, 'b) [Bigarray.kind](Bigarray.html#TYPEkind)

Return the kind of the given Bigarray.

val layout : ('a, 'b, 'c) [t](Bigarray.Array0.html#TYPEt) -> 'c [Bigarray.layout](Bigarray.html#TYPElayout)

Return the layout of the given Bigarray.

val change_layout : ('a, 'b, 'c) [t](Bigarray.Array0.html#TYPEt) -> 'd [Bigarray.layout](Bigarray.html#TYPElayout) -> ('a, 'b, 'd) [t](Bigarray.Array0.html#TYPEt)

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.

val size_in_bytes : ('a, 'b, 'c) [t](Bigarray.Array0.html#TYPEt) -> int

val get : ('a, 'b, 'c) [t](Bigarray.Array0.html#TYPEt) -> 'a

Array0.get a returns the only element in a.

val set : ('a, 'b, 'c) [t](Bigarray.Array0.html#TYPEt) -> 'a -> unit

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

val blit : ('a, 'b, 'c) [t](Bigarray.Array0.html#TYPEt) -> ('a, 'b, 'c) [t](Bigarray.Array0.html#TYPEt) -> unit

val fill : ('a, 'b, 'c) [t](Bigarray.Array0.html#TYPEt) -> 'a -> unit

val of_value : ('a, 'b) [Bigarray.kind](Bigarray.html#TYPEkind) -> 'c [Bigarray.layout](Bigarray.html#TYPElayout) -> 'a -> ('a, 'b, 'c) [t](Bigarray.Array0.html#TYPEt)

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