package batteries

  1. Overview
  2. Docs
A community-maintained standard library extension

Install

Dune Dependency

Authors

Maintainers

Sources

v3.9.0.tar.gz
md5=ea26b5c72e6731e59d856626049cca4d
sha512=55975b62c26f6db77433a3ac31f97af609fc6789bb62ac38b267249c78fd44ff37fe81901f1cf560857b9493a6046dd37b0d1c0234c66bd59e52843aac3ce6cb

doc/batteries.unthreaded/BatBigarray/Array0/index.html

Module BatBigarray.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.

  • since 2.7.0 and OCaml 4.05.0
Sourcetype ('a, 'b, 'c) t = ('a, 'b, 'c) Bigarray.Array0.t

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

Sourceval create : ('a, 'b) kind -> 'c layout -> ('a, 'b, 'c) t

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

Return the kind of the given big array.

Sourceval layout : ('a, 'b, 'c) t -> 'c layout

Return the layout of the given big array.

Sourceval change_layout : ('a, 'b, 'c) t -> 'd layout -> ('a, 'b, 'd) t

Array0.change_layout a layout returns a big array 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.0
Sourceval size_in_bytes : ('a, 'b, 'c) t -> int

size_in_bytes a is a's kind_size_in_bytes.

Sourceval get : ('a, 'b, 'c) t -> 'a

Array0.get a returns the only element in a.

Sourceval set : ('a, 'b, 'c) t -> 'a -> unit

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

Sourceval blit : ('a, 'b, 'c) t -> ('a, 'b, 'c) t -> unit

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

Sourceval fill : ('a, 'b, 'c) t -> 'a -> unit

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

Sourceval of_value : ('a, 'b) kind -> 'c layout -> 'a -> ('a, 'b, 'c) t

Build a zero-dimensional big array initialized from the given value.

OCaml

Innovation. Community. Security.