1Bigarray.Array3(3) OCaml library Bigarray.Array3(3)
2
3
4
6 Bigarray.Array3 - Three-dimensional arrays.
7
9 Module Bigarray.Array3
10
12 Module Array3
13 : sig end
14
15
16 Three-dimensional arrays. The Array3 structure provides operations sim‐
17 ilar to those of Bigarray.Genarray , but specialized to the case of
18 three-dimensional arrays.
19
20
21
22
23
24 type ('a, 'b, 'c) t
25
26
27 The type of three-dimensional Bigarrays whose elements have OCaml type
28 'a , representation kind 'b , and memory layout 'c .
29
30
31
32 val create : ('a, 'b) Bigarray.kind -> 'c Bigarray.layout -> int -> int
33 -> int -> ('a, 'b, 'c) t
34
35
36 Array3.create kind layout dim1 dim2 dim3 returns a new Bigarray of
37 three dimensions, whose size is dim1 in the first dimension, dim2 in
38 the second dimension, and dim3 in the third. kind and layout determine
39 the array element kind and the array layout as described for Bigar‐
40 ray.Genarray.create .
41
42
43
44 val init : ('a, 'b) Bigarray.kind -> 'c Bigarray.layout -> int -> int
45 -> int -> (int -> int -> int -> 'a) -> ('a, 'b, 'c) t
46
47
48 Array3.init kind layout dim1 dim2 dim3 f returns a new Bigarray b of
49 three dimensions, whose size is dim1 in the first dimension, dim2 in
50 the second dimension, and dim3 in the third. kind and layout determine
51 the array element kind and the array layout as described for Bigar‐
52 ray.Genarray.create .
53
54 Each element Array3.get b i j k of the array is initialized to the re‐
55 sult of f i j k .
56
57 In other words, Array3.init kind layout dim1 dim2 dim3 f tabulates the
58 results of f applied to the indices of a new Bigarray whose layout is
59 described by kind , layout , dim1 , dim2 and dim3 .
60
61
62 Since 4.12.0
63
64
65
66 val dim1 : ('a, 'b, 'c) t -> int
67
68 Return the first dimension of the given three-dimensional Bigarray.
69
70
71
72 val dim2 : ('a, 'b, 'c) t -> int
73
74 Return the second dimension of the given three-dimensional Bigarray.
75
76
77
78 val dim3 : ('a, 'b, 'c) t -> int
79
80 Return the third dimension of the given three-dimensional Bigarray.
81
82
83
84 val kind : ('a, 'b, 'c) t -> ('a, 'b) Bigarray.kind
85
86 Return the kind of the given Bigarray.
87
88
89
90 val layout : ('a, 'b, 'c) t -> 'c Bigarray.layout
91
92 Return the layout of the given Bigarray.
93
94
95
96 val change_layout : ('a, 'b, 'c) t -> 'd Bigarray.layout -> ('a, 'b,
97 'd) t
98
99
100 Array3.change_layout a layout returns a Bigarray with the specified
101 layout , sharing the data with a (and hence having the same dimensions
102 as a ). No copying of elements is involved: the new array and the orig‐
103 inal array share the same storage space. The dimensions are reversed,
104 such that get v [| a; b; c |] in C layout becomes get v [| c+1; b+1;
105 a+1 |] in Fortran layout.
106
107
108 Since 4.06.0
109
110
111
112 val size_in_bytes : ('a, 'b, 'c) t -> int
113
114
115 size_in_bytes a is the number of elements in a multiplied by a 's Bi‐
116 garray.kind_size_in_bytes .
117
118
119 Since 4.03.0
120
121
122
123 val get : ('a, 'b, 'c) t -> int -> int -> int -> 'a
124
125
126 Array3.get a x y z , also written a.{x,y,z} , returns the element of a
127 at coordinates ( x , y , z ). x , y and z must be within the bounds of
128 a , as described for Bigarray.Genarray.get ; otherwise, Invalid_argu‐
129 ment is raised.
130
131
132
133 val set : ('a, 'b, 'c) t -> int -> int -> int -> 'a -> unit
134
135
136 Array3.set a x y v , or alternatively a.{x,y,z} <- v , stores the value
137 v at coordinates ( x , y , z ) in a . x , y and z must be within the
138 bounds of a , as described for Bigarray.Genarray.set ; otherwise, In‐
139 valid_argument is raised.
140
141
142
143 val sub_left : ('a, 'b, Bigarray.c_layout) t -> int -> int -> ('a, 'b,
144 Bigarray.c_layout) t
145
146 Extract a three-dimensional sub-array of the given three-dimensional
147 Bigarray by restricting the first dimension. See Bigarray.Genar‐
148 ray.sub_left for more details. Array3.sub_left applies only to arrays
149 with C layout.
150
151
152
153 val sub_right : ('a, 'b, Bigarray.fortran_layout) t -> int -> int ->
154 ('a, 'b, Bigarray.fortran_layout) t
155
156 Extract a three-dimensional sub-array of the given three-dimensional
157 Bigarray by restricting the second dimension. See Bigarray.Genar‐
158 ray.sub_right for more details. Array3.sub_right applies only to ar‐
159 rays with Fortran layout.
160
161
162
163 val slice_left_1 : ('a, 'b, Bigarray.c_layout) t -> int -> int -> ('a,
164 'b, Bigarray.c_layout) Bigarray.Array1.t
165
166 Extract a one-dimensional slice of the given three-dimensional Bigarray
167 by fixing the first two coordinates. The integer parameters are the
168 coordinates of the slice to extract. See Bigarray.Genarray.slice_left
169 for more details. Array3.slice_left_1 applies only to arrays with C
170 layout.
171
172
173
174 val slice_right_1 : ('a, 'b, Bigarray.fortran_layout) t -> int -> int
175 -> ('a, 'b, Bigarray.fortran_layout) Bigarray.Array1.t
176
177 Extract a one-dimensional slice of the given three-dimensional Bigarray
178 by fixing the last two coordinates. The integer parameters are the co‐
179 ordinates of the slice to extract. See Bigarray.Genarray.slice_right
180 for more details. Array3.slice_right_1 applies only to arrays with
181 Fortran layout.
182
183
184
185 val slice_left_2 : ('a, 'b, Bigarray.c_layout) t -> int -> ('a, 'b, Bi‐
186 garray.c_layout) Bigarray.Array2.t
187
188 Extract a two-dimensional slice of the given three-dimensional Bigar‐
189 ray by fixing the first coordinate. The integer parameter is the first
190 coordinate of the slice to extract. See Bigarray.Genarray.slice_left
191 for more details. Array3.slice_left_2 applies only to arrays with C
192 layout.
193
194
195
196 val slice_right_2 : ('a, 'b, Bigarray.fortran_layout) t -> int -> ('a,
197 'b, Bigarray.fortran_layout) Bigarray.Array2.t
198
199 Extract a two-dimensional slice of the given three-dimensional Bigarray
200 by fixing the last coordinate. The integer parameter is the coordinate
201 of the slice to extract. See Bigarray.Genarray.slice_right for more
202 details. Array3.slice_right_2 applies only to arrays with Fortran lay‐
203 out.
204
205
206
207 val blit : ('a, 'b, 'c) t -> ('a, 'b, 'c) t -> unit
208
209 Copy the first Bigarray to the second Bigarray. See Bigarray.Genar‐
210 ray.blit for more details.
211
212
213
214 val fill : ('a, 'b, 'c) t -> 'a -> unit
215
216 Fill the given Bigarray with the given value. See Bigarray.Genar‐
217 ray.fill for more details.
218
219
220
221 val of_array : ('a, 'b) Bigarray.kind -> 'c Bigarray.layout -> 'a array
222 array array -> ('a, 'b, 'c) t
223
224 Build a three-dimensional Bigarray initialized from the given array of
225 arrays of arrays.
226
227
228
229 val unsafe_get : ('a, 'b, 'c) t -> int -> int -> int -> 'a
230
231 Like Bigarray.Array3.get , but bounds checking is not always performed.
232
233
234
235 val unsafe_set : ('a, 'b, 'c) t -> int -> int -> int -> 'a -> unit
236
237 Like Bigarray.Array3.set , but bounds checking is not always performed.
238
239
240
241
242
243OCamldoc 2023-01-23 Bigarray.Array3(3)