type ('a, 'b, 'c) t
The type of one-dimensional Bigarrays whose elements have OCaml type
'a
, representation kind'b
, and memory layout'c
.
val create : ('a, 'b) kind -> 'c layout -> int -> ('a, 'b, 'c) t
Array1.create kind layout dim
returns a new Bigarray of one dimension, whose size isdim
.kind
andlayout
determine the array element kind and the array layout as described forGenarray.create
.
val dim : ('a, 'b, 'c) t -> int
Return the size (dimension) of the given one-dimensional Bigarray.
val change_layout : ('a, 'b, 'c) t -> 'd layout -> ('a, 'b, 'd) t
Array1.change_layout a layout
returns a Bigarray with the specifiedlayout
, sharing the data witha
(and hence having the same dimension asa
). No copying of elements is involved: the new array and the original array share the same storage space.- since
- 4.06.0
val size_in_bytes : ('a, 'b, 'c) t -> int
size_in_bytes a
is the number of elements ina
multiplied bya
'skind_size_in_bytes
.- since
- 4.03.0
val get : ('a, 'b, 'c) t -> int -> 'a
Array1.get a x
, or alternativelya.{x}
, returns the element ofa
at indexx
.x
must be greater or equal than0
and strictly less thanArray1.dim a
ifa
has C layout. Ifa
has Fortran layout,x
must be greater or equal than1
and less or equal thanArray1.dim a
. Otherwise,Invalid_argument
is raised.
val set : ('a, 'b, 'c) t -> int -> 'a -> unit
Array1.set a x v
, also writtena.{x} <- v
, stores the valuev
at indexx
ina
.x
must be inside the bounds ofa
as described inBigarray.Array1.get
; otherwise,Invalid_argument
is raised.
val sub : ('a, 'b, 'c) t -> int -> int -> ('a, 'b, 'c) t
Extract a sub-array of the given one-dimensional Bigarray. See
Genarray.sub_left
for more details.
val slice : ('a, 'b, 'c) t -> int -> ('a, 'b, 'c) Array0.t
Extract a scalar (zero-dimensional slice) of the given one-dimensional Bigarray. The integer parameter is the index of the scalar to extract. See
Bigarray.Genarray.slice_left
andBigarray.Genarray.slice_right
for more details.- since
- 4.05.0
val blit : ('a, 'b, 'c) t -> ('a, 'b, 'c) t -> unit
Copy the first Bigarray to the second Bigarray. See
Genarray.blit
for more details.
val fill : ('a, 'b, 'c) t -> 'a -> unit
Fill the given Bigarray with the given value. See
Genarray.fill
for more details.
val of_array : ('a, 'b) kind -> 'c layout -> 'a array -> ('a, 'b, 'c) t
Build a one-dimensional Bigarray initialized from the given array.
val unsafe_get : ('a, 'b, 'c) t -> int -> 'a
Like
Bigarray.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 -> unit
Like
Bigarray.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.