package batteries
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=e4b70d1a716f0aaba36f419f618d0a2e
sha512=a31f1f8cf2c7c3c6c757f3bfae98ff61bb32bab6a1f1e215937df42bcfa447aad41a37edb28d7bcecb88b3838ed8bd57142bcf8e2d28e09bb538055fd8a3b72d
doc/batteries.unthreaded/BatBigarray/Array3/index.html
Module BatBigarray.Array3
Three-dimensional arrays. The Array3 structure provides operations similar to those of Bigarray.Genarray, but specialized to the case of three-dimensional arrays.
type ('a, 'b, 'c) t = ('a, 'b, 'c) Bigarray.Array3.tThe type of three-dimensional big arrays whose elements have OCaml type 'a, representation kind 'b, and memory layout 'c.
Array3.create kind layout dim1 dim2 dim3 returns a new bigarray of three dimension, whose size is dim1 in the first dimension, dim2 in the second dimension, and dim3 in the third. kind and layout determine the array element kind and the array layout as described for Bigarray.Genarray.create.
val dim1 : ('a, 'b, 'c) t -> intReturn the first dimension of the given three-dimensional big array.
val dim2 : ('a, 'b, 'c) t -> intReturn the second dimension of the given three-dimensional big array.
val dim3 : ('a, 'b, 'c) t -> intReturn the third dimension of the given three-dimensional big array.
Array3.change_layout a layout returns a bigarray with the specified layout, sharing the data with a (and hence having the same dimensions as a). No copying of elements is involved: the new array and the original array share the same storage space. The dimensions are reversed, such that get v [| a; b; c |] in C layout becomes get v [| c+1; b+1; a+1 |] in Fortran layout.
val size_in_bytes : ('a, 'b, 'c) t -> intsize_in_bytes a is the number of elements in a multiplied by a's kind_size_in_bytes.
val get : ('a, 'b, 'c) t -> int -> int -> int -> 'aArray3.get a x y z, also written a.{x,y,z}, returns the element of a at coordinates (x, y, z). x, y and z must be within the bounds of a, as described for Bigarray.Genarray.get;
val set : ('a, 'b, 'c) t -> int -> int -> int -> 'a -> unitArray3.set a x y v, or alternatively a.{x,y,z} <- v, stores the value v at coordinates (x, y, z) in a. x, y and z must be within the bounds of a, as described for Bigarray.Genarray.set;
Extract a three-dimensional sub-array of the given three-dimensional big array by restricting the first dimension. See Bigarray.Genarray.sub_left for more details. Array3.sub_left applies only to arrays with C layout.
val sub_right :
('a, 'b, fortran_layout) t ->
int ->
int ->
('a, 'b, fortran_layout) tExtract a three-dimensional sub-array of the given three-dimensional big array by restricting the second dimension. See Bigarray.Genarray.sub_right for more details. Array3.sub_right applies only to arrays with Fortran layout.
Extract a one-dimensional slice of the given three-dimensional big array by fixing the first two coordinates. The integer parameters are the coordinates of the slice to extract. See Bigarray.Genarray.slice_left for more details. Array3.slice_left_1 applies only to arrays with C layout.
val slice_right_1 :
('a, 'b, fortran_layout) t ->
int ->
int ->
('a, 'b, fortran_layout) Array1.tExtract a one-dimensional slice of the given three-dimensional big array by fixing the last two coordinates. The integer parameters are the coordinates of the slice to extract. See Bigarray.Genarray.slice_right for more details. Array3.slice_right_1 applies only to arrays with Fortran layout.
Extract a two-dimensional slice of the given three-dimensional big array by fixing the first coordinate. The integer parameter is the first coordinate of the slice to extract. See Bigarray.Genarray.slice_left for more details. Array3.slice_left_2 applies only to arrays with C layout.
val slice_right_2 :
('a, 'b, fortran_layout) t ->
int ->
('a, 'b, fortran_layout) Array2.tExtract a two-dimensional slice of the given three-dimensional big array by fixing the last coordinate. The integer parameter is the coordinate of the slice to extract. See Bigarray.Genarray.slice_right for more details. Array3.slice_right_2 applies only to arrays with Fortran layout.
Copy the first big array to the second big array. See Bigarray.Genarray.blit for more details.
val fill : ('a, 'b, 'c) t -> 'a -> unitFill the given big array with the given value. See Bigarray.Genarray.fill for more details.
Build a three-dimensional big array initialized from the given array of arrays of arrays.
val map_file :
Unix.file_descr ->
?pos:int64 ->
('a, 'b) kind ->
'c layout ->
bool ->
int ->
int ->
int ->
('a, 'b, 'c) tMemory mapping of a file as a three-dimensional big array. See Bigarray.Genarray.map_file for more details.
enum e returns an enumeration on the elements of e. The order of enumeration is unspecified.
val map :
('a -> 'b) ->
('b, 'c) Bigarray.kind ->
('a, 'd, 'e) t ->
('b, 'c, 'e) tArray3.map f a applies function f to all the elements of a, and builds a Bigarray.Array3.t with the results returned by f.
val mapijk :
(int -> int -> int -> 'a -> 'b) ->
('b, 'c) Bigarray.kind ->
('a, 'd, 'e) t ->
('b, 'c, 'e) tSame as Bigarray.Array3.map, but the function is applied to the index of the element as the first three arguments, and the element itself as the fourth argument.
val modify : ('a -> 'a) -> ('a, 'b, 'c) t -> unitmodify f a changes each element x in a to f x in-place.
val modifyijk : (int -> int -> int -> 'a -> 'a) -> ('a, 'b, 'c) t -> unitSame as Bigarray.Array3.modify, but the function is applied to the index of the coordinates as the first three arguments, and the element itself as the fourth argument.
val to_array : ('a, 'b, 'c) t -> 'a array array arrayBuild a three-dimensional array initialized from the given big array.
Unsafe operations
In case of doubt, don't use them.
val unsafe_get : ('a, 'b, 'c) t -> int -> int -> int -> 'aLike Bigarray.Array3.get, but bounds checking is not always performed.
val unsafe_set : ('a, 'b, 'c) t -> int -> int -> int -> 'a -> unitLike Bigarray.Array3.set, but bounds checking is not always performed.