407 lines
5.5 KiB
HTML
407 lines
5.5 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of Bigarray.Array1</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>Bigarray.Array1</H1>
|
|
Section: OCaml library (3o)<BR>Updated: 2020-01-30<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
Bigarray.Array1 - One-dimensional arrays.
|
|
<A NAME="lbAC"> </A>
|
|
<H2>Module</H2>
|
|
|
|
Module Bigarray.Array1
|
|
<A NAME="lbAD"> </A>
|
|
<H2>Documentation</H2>
|
|
|
|
<P>
|
|
Module
|
|
<B>Array1</B>
|
|
|
|
<BR> :
|
|
<B>sig end</B>
|
|
|
|
<P>
|
|
<P>
|
|
One-dimensional arrays. The
|
|
<B>Array1</B>
|
|
|
|
structure provides operations
|
|
similar to those of
|
|
<B>Bigarray.Genarray</B>
|
|
|
|
, but specialized to the case of one-dimensional arrays.
|
|
(The
|
|
<B>Bigarray.Array2</B>
|
|
|
|
and
|
|
<B>Bigarray.Array3</B>
|
|
|
|
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.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>type </I>
|
|
|
|
<B>('a, 'b, 'c)</B>
|
|
|
|
<I>t </I>
|
|
|
|
<P>
|
|
<P>
|
|
The type of one-dimensional Bigarrays whose elements have
|
|
OCaml type
|
|
<B>'a</B>
|
|
|
|
, representation kind
|
|
<B>'b</B>
|
|
|
|
, and memory layout
|
|
<B>'c</B>
|
|
|
|
.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val create </I>
|
|
|
|
:
|
|
<B>('a, 'b) Bigarray.kind -></B>
|
|
|
|
<B>'c Bigarray.layout -> int -> ('a, 'b, 'c) t</B>
|
|
|
|
<P>
|
|
<P>
|
|
<B>Array1.create kind layout dim</B>
|
|
|
|
returns a new Bigarray of
|
|
one dimension, whose size is
|
|
<B>dim</B>
|
|
|
|
.
|
|
<B>kind</B>
|
|
|
|
and
|
|
<B>layout</B>
|
|
|
|
determine the array element kind and the array layout
|
|
as described for
|
|
<B>Bigarray.Genarray.create</B>
|
|
|
|
.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val dim </I>
|
|
|
|
:
|
|
<B>('a, 'b, 'c) t -> int</B>
|
|
|
|
<P>
|
|
Return the size (dimension) of the given one-dimensional
|
|
Bigarray.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val kind </I>
|
|
|
|
:
|
|
<B>('a, 'b, 'c) t -> ('a, 'b) Bigarray.kind</B>
|
|
|
|
<P>
|
|
Return the kind of the given Bigarray.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val layout </I>
|
|
|
|
:
|
|
<B>('a, 'b, 'c) t -> 'c Bigarray.layout</B>
|
|
|
|
<P>
|
|
Return the layout of the given Bigarray.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val change_layout </I>
|
|
|
|
:
|
|
<B>('a, 'b, 'c) t -></B>
|
|
|
|
<B>'d Bigarray.layout -> ('a, 'b, 'd) t</B>
|
|
|
|
<P>
|
|
<P>
|
|
<B>Array1.change_layout a layout</B>
|
|
|
|
returns a Bigarray with the
|
|
specified
|
|
<B>layout</B>
|
|
|
|
, sharing the data with
|
|
<B>a</B>
|
|
|
|
(and hence having
|
|
the same dimension as
|
|
<B>a</B>
|
|
|
|
). No copying of elements is involved: the
|
|
new array and the original array share the same storage space.
|
|
<P>
|
|
<P>
|
|
<B>Since</B>
|
|
|
|
4.06.0
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val size_in_bytes </I>
|
|
|
|
:
|
|
<B>('a, 'b, 'c) t -> int</B>
|
|
|
|
<P>
|
|
<P>
|
|
<B>size_in_bytes a</B>
|
|
|
|
is the number of elements in
|
|
<B>a</B>
|
|
|
|
multiplied by
|
|
<B>a</B>
|
|
|
|
's
|
|
<B>Bigarray.kind_size_in_bytes</B>
|
|
|
|
.
|
|
<P>
|
|
<P>
|
|
<B>Since</B>
|
|
|
|
4.03.0
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val get </I>
|
|
|
|
:
|
|
<B>('a, 'b, 'c) t -> int -> 'a</B>
|
|
|
|
<P>
|
|
<P>
|
|
<B>Array1.get a x</B>
|
|
|
|
, or alternatively
|
|
<B>a.{x}</B>
|
|
|
|
,
|
|
returns the element of
|
|
<B>a</B>
|
|
|
|
at index
|
|
<B>x</B>
|
|
|
|
.
|
|
<B>x</B>
|
|
|
|
must be greater or equal than
|
|
<B>0</B>
|
|
|
|
and strictly less than
|
|
<B>Array1.dim a</B>
|
|
|
|
if
|
|
<B>a</B>
|
|
|
|
has C layout. If
|
|
<B>a</B>
|
|
|
|
has Fortran layout,
|
|
<B>x</B>
|
|
|
|
must be greater or equal than
|
|
<B>1</B>
|
|
|
|
and less or equal than
|
|
<B>Array1.dim a</B>
|
|
|
|
. Otherwise,
|
|
<B>Invalid_argument</B>
|
|
|
|
is raised.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val set </I>
|
|
|
|
:
|
|
<B>('a, 'b, 'c) t -> int -> 'a -> unit</B>
|
|
|
|
<P>
|
|
<P>
|
|
<B>Array1.set a x v</B>
|
|
|
|
, also written
|
|
<B>a.{x} <- v</B>
|
|
|
|
,
|
|
stores the value
|
|
<B>v</B>
|
|
|
|
at index
|
|
<B>x</B>
|
|
|
|
in
|
|
<B>a</B>
|
|
|
|
.
|
|
<B>x</B>
|
|
|
|
must be inside the bounds of
|
|
<B>a</B>
|
|
|
|
as described in
|
|
<B>Bigarray.Array1.get</B>
|
|
|
|
;
|
|
otherwise,
|
|
<B>Invalid_argument</B>
|
|
|
|
is raised.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val sub </I>
|
|
|
|
:
|
|
<B>('a, 'b, 'c) t -></B>
|
|
|
|
<B>int -> int -> ('a, 'b, 'c) t</B>
|
|
|
|
<P>
|
|
Extract a sub-array of the given one-dimensional Bigarray.
|
|
See
|
|
<B>Bigarray.Genarray.sub_left</B>
|
|
|
|
for more details.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val slice </I>
|
|
|
|
:
|
|
<B>('a, 'b, 'c) t -> int -> ('a, 'b, 'c) Bigarray.Array0.t</B>
|
|
|
|
<P>
|
|
Extract a scalar (zero-dimensional slice) of the given one-dimensional
|
|
Bigarray. The integer parameter is the index of the scalar to
|
|
extract. See
|
|
<B>Bigarray.Genarray.slice_left</B>
|
|
|
|
and
|
|
<B>Bigarray.Genarray.slice_right</B>
|
|
|
|
for more details.
|
|
<P>
|
|
<P>
|
|
<B>Since</B>
|
|
|
|
4.05.0
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val blit </I>
|
|
|
|
:
|
|
<B>('a, 'b, 'c) t -> ('a, 'b, 'c) t -> unit</B>
|
|
|
|
<P>
|
|
Copy the first Bigarray to the second Bigarray.
|
|
See
|
|
<B>Bigarray.Genarray.blit</B>
|
|
|
|
for more details.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val fill </I>
|
|
|
|
:
|
|
<B>('a, 'b, 'c) t -> 'a -> unit</B>
|
|
|
|
<P>
|
|
Fill the given Bigarray with the given value.
|
|
See
|
|
<B>Bigarray.Genarray.fill</B>
|
|
|
|
for more details.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val of_array </I>
|
|
|
|
:
|
|
<B>('a, 'b) Bigarray.kind -></B>
|
|
|
|
<B>'c Bigarray.layout -> 'a array -> ('a, 'b, 'c) t</B>
|
|
|
|
<P>
|
|
Build a one-dimensional Bigarray initialized from the
|
|
given array.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val unsafe_get </I>
|
|
|
|
:
|
|
<B>('a, 'b, 'c) t -> int -> 'a</B>
|
|
|
|
<P>
|
|
Like
|
|
<B>Bigarray.Array1.get</B>
|
|
|
|
, but bounds checking is not always performed.
|
|
Use with caution and only when the program logic guarantees that
|
|
the access is within bounds.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val unsafe_set </I>
|
|
|
|
:
|
|
<B>('a, 'b, 'c) t -> int -> 'a -> unit</B>
|
|
|
|
<P>
|
|
Like
|
|
<B>Bigarray.Array1.set</B>
|
|
|
|
, but bounds checking is not always performed.
|
|
Use with caution and only when the program logic guarantees that
|
|
the access is within bounds.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="2"><A HREF="#lbAC">Module</A><DD>
|
|
<DT id="3"><A HREF="#lbAD">Documentation</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:36 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|