1Bigarray.Array1(3)               OCaml library              Bigarray.Array1(3)
2
3
4

NAME

6       Bigarray.Array1 - One-dimensional arrays.
7

Module

9       Module   Bigarray.Array1
10

Documentation

12       Module Array1
13        : sig end
14
15
16       One-dimensional  arrays. The Array1 structure provides operations simi‐
17       lar to those of Bigarray.Genarray , but  specialized  to  the  case  of
18       one-dimensional   arrays.   (The  Bigarray.Array2  and  Bigarray.Array3
19       structures below provide operations specialized for two- and  three-di‐
20       mensional  arrays.)  Statically knowing the number of dimensions of the
21       array allows faster operations, and more precise static type-checking.
22
23
24
25
26
27       type ('a, 'b, 'c) t
28
29
30       The type of one-dimensional Bigarrays whose elements have OCaml type 'a
31       , representation kind 'b , and memory layout 'c .
32
33
34
35       val  create  :  ('a,  'b) Bigarray.kind -> 'c Bigarray.layout -> int ->
36       ('a, 'b, 'c) t
37
38
39       Array1.create kind layout dim returns a new Bigarray of one  dimension,
40       whose  size  is dim .  kind and layout determine the array element kind
41       and the array layout as described for Bigarray.Genarray.create .
42
43
44
45       val init : ('a, 'b) Bigarray.kind -> 'c Bigarray.layout -> int ->  (int
46       -> 'a) -> ('a, 'b, 'c) t
47
48
49       Array1.init  kind  layout  dim f returns a new Bigarray b of one dimen‐
50       sion, whose size is dim .  kind and layout determine the array  element
51       kind and the array layout as described for Bigarray.Genarray.create .
52
53       Each  element  Array1.get b i of the array is initialized to the result
54       of f i .
55
56       In other words, Array1.init kind layout dimensions f tabulates the  re‐
57       sults of f applied to the indices of a new Bigarray whose layout is de‐
58       scribed by kind , layout and dim .
59
60
61       Since 4.12.0
62
63
64
65       val dim : ('a, 'b, 'c) t -> int
66
67       Return the size (dimension) of the given one-dimensional Bigarray.
68
69
70
71       val kind : ('a, 'b, 'c) t -> ('a, 'b) Bigarray.kind
72
73       Return the kind of the given Bigarray.
74
75
76
77       val layout : ('a, 'b, 'c) t -> 'c Bigarray.layout
78
79       Return the layout of the given Bigarray.
80
81
82
83       val change_layout : ('a, 'b, 'c) t -> 'd Bigarray.layout  ->  ('a,  'b,
84       'd) t
85
86
87       Array1.change_layout  a  layout  returns  a Bigarray with the specified
88       layout , sharing the data with a (and hence having the  same  dimension
89       as a ). No copying of elements is involved: the new array and the orig‐
90       inal array share the same storage space.
91
92
93       Since 4.06.0
94
95
96
97       val size_in_bytes : ('a, 'b, 'c) t -> int
98
99
100       size_in_bytes a is the number of elements in a multiplied by a  's  Bi‐
101       garray.kind_size_in_bytes .
102
103
104       Since 4.03.0
105
106
107
108       val get : ('a, 'b, 'c) t -> int -> 'a
109
110
111       Array1.get  a  x , or alternatively a.{x} , returns the element of a at
112       index x .  x must be greater or equal than 0 and strictly less than Ar‐
113       ray1.dim  a  if  a  has  C  layout.  If a has Fortran layout, x must be
114       greater or equal than 1 and less or equal than Array1.dim a  .   Other‐
115       wise, Invalid_argument is raised.
116
117
118
119       val set : ('a, 'b, 'c) t -> int -> 'a -> unit
120
121
122       Array1.set  a x v , also written a.{x} <- v , stores the value v at in‐
123       dex x in a .  x must be inside the bounds of a as described  in  Bigar‐
124       ray.Array1.get ; otherwise, Invalid_argument is raised.
125
126
127
128       val sub : ('a, 'b, 'c) t -> int -> int -> ('a, 'b, 'c) t
129
130       Extract  a sub-array of the given one-dimensional Bigarray.  See Bigar‐
131       ray.Genarray.sub_left for more details.
132
133
134
135       val slice : ('a, 'b, 'c) t -> int -> ('a, 'b, 'c) Bigarray.Array0.t
136
137       Extract a scalar (zero-dimensional slice) of the given  one-dimensional
138       Bigarray.  The integer parameter is the index of the scalar to extract.
139       See Bigarray.Genarray.slice_left and Bigarray.Genarray.slice_right  for
140       more details.
141
142
143       Since 4.05.0
144
145
146
147       val blit : ('a, 'b, 'c) t -> ('a, 'b, 'c) t -> unit
148
149       Copy  the  first  Bigarray to the second Bigarray.  See Bigarray.Genar‐
150       ray.blit for more details.
151
152
153
154       val fill : ('a, 'b, 'c) t -> 'a -> unit
155
156       Fill the given Bigarray with  the  given  value.   See  Bigarray.Genar‐
157       ray.fill for more details.
158
159
160
161       val of_array : ('a, 'b) Bigarray.kind -> 'c Bigarray.layout -> 'a array
162       -> ('a, 'b, 'c) t
163
164       Build a one-dimensional Bigarray initialized from the given array.
165
166
167
168       val unsafe_get : ('a, 'b, 'c) t -> int -> 'a
169
170       Like Bigarray.Array1.get , but bounds checking is not always performed.
171       Use  with  caution  and only when the program logic guarantees that the
172       access is within bounds.
173
174
175
176       val unsafe_set : ('a, 'b, 'c) t -> int -> 'a -> unit
177
178       Like Bigarray.Array1.set , but bounds checking is not always performed.
179       Use  with  caution  and only when the program logic guarantees that the
180       access is within bounds.
181
182
183
184
185
186OCamldoc                          2022-07-22                Bigarray.Array1(3)
Impressum