module Array1:sig..end
Array1 structure provides operations
similar to those of
Bigarray.Genarray, but specialized to the case of one-dimensional arrays.
(The Array2 and Array3 structures below provide operations
specialized for two- and three-dimensional arrays.)
Statically knowing the number of dimensions of the array allows
faster operations, and more precise static type-checking.type('a, 'b, 'c)t =('a, 'b, 'c) Bigarray.Array1.t
'a, representation kind 'b, and memory layout 'c.val create : ('a, 'b) BatBigarray.kind ->
'c BatBigarray.layout -> int -> ('a, 'b, 'c) tArray1.create kind layout dim returns a new bigarray of
one dimension, whose size is dim. kind and layout
determine the array element kind and the array layout
as described for Genarray.create.val dim : ('a, 'b, 'c) t -> intval kind : ('a, 'b, 'c) t -> ('a, 'b) BatBigarray.kindval layout : ('a, 'b, 'c) t -> 'c BatBigarray.layoutval size_in_bytes : ('a, 'b, 'c) t -> intsize_in_bytes a is the number of elements in a multiplied
by a's BatBigarray.kind_size_in_bytes.val get : ('a, 'b, 'c) t -> int -> 'aArray1.get a x, or alternatively a.{x},
returns the element of a at index x.
x must be greater or equal than 0 and strictly less than
Array1.dim a if a has C layout. If a has Fortran layout,
x must be greater or equal than 1 and less or equal than
Array1.dim a.Invalid_argument otherwise.val set : ('a, 'b, 'c) t -> int -> 'a -> unitArray1.set a x v, also written a.{x} <- v,
stores the value v at index x in a.
x must be inside the bounds of a as described in
Bigarray.Array1.get;Invalid_argument otherwise.val sub : ('a, 'b, 'c) t ->
int -> int -> ('a, 'b, 'c) tGenarray.sub_left for more details.val blit : ('a, 'b, 'c) t ->
('a, 'b, 'c) t -> unitGenarray.blit for more details.val fill : ('a, 'b, 'c) t -> 'a -> unitGenarray.fill for more details.val of_array : ('a, 'b) BatBigarray.kind ->
'c BatBigarray.layout -> 'a array -> ('a, 'b, 'c) tval map_file : Unix.file_descr ->
?pos:int64 ->
('a, 'b) BatBigarray.kind ->
'c BatBigarray.layout -> bool -> int -> ('a, 'b, 'c) tBigarray.Genarray.map_file for more details.val enum : ('a, 'b, 'c) t -> 'a BatEnum.tArray1.enum e returns an enumeration on the elements of e.
Contrarily to the multi-dimensional case, order of elements is
specified: elements are in sequential order, from smaller to
larger indices.val of_enum : ('a, 'b) BatBigarray.kind ->
'c BatBigarray.layout -> 'a BatEnum.t -> ('a, 'b, 'c) tArray1.of_enum kind layout enum returns a new one-dimensional
big array of kind kind and layout layout, with elements taken
from the enumeration enum in order.val map : ('a -> 'b) ->
('b, 'c) Bigarray.kind ->
('a, 'd, 'e) t -> ('b, 'c, 'e) tArray1.map f a applies function f to all the elements of a,
and builds a Bigarray.Array1.t with the results returned by f.val mapi : (int -> 'a -> 'b) ->
('b, 'c) Bigarray.kind ->
('a, 'd, 'e) t -> ('b, 'c, 'e) tBigarray.Array1.map, but the
function is applied to the index of the element as the first argument,
and the element itself as the second argument.val modify : ('a -> 'a) -> ('a, 'b, 'c) t -> unitmodify f a changes each element x in a to f x
in-place.val modifyi : (int -> 'a -> 'a) -> ('a, 'b, 'c) t -> unitBigarray.Array1.modify, but the function is applied
to the index of the element as the first argument, and the
element itself as the second argument.val to_array : ('a, 'b, 'c) t -> 'a array
In case of doubt, don't use them.
val unsafe_get : ('a, 'b, 'c) t -> int -> 'aBigarray.Array1.get, but bounds checking is not always performed.
Use with caution and only when the program logic guarantees that
the access is within bounds.val unsafe_set : ('a, 'b, 'c) t -> int -> 'a -> unitBigarray.Array1.set, but bounds checking is not always performed.
Use with caution and only when the program logic guarantees that
the access is within bounds.