1Bigarray.Array2(3) OCaml library Bigarray.Array2(3)
2
3
4
6 Bigarray.Array2 - Two-dimensional arrays.
7
9 Module Bigarray.Array2
10
12 Module Array2
13 : sig end
14
15
16 Two-dimensional arrays. The Array2 structure provides operations simi‐
17 lar to those of Bigarray.Genarray , but specialized to the case of
18 two-dimensional arrays.
19
20
21
22
23
24
25 type ('a, 'b, 'c) t
26
27
28 The type of two-dimensional big arrays whose elements have Caml type 'a
29 , representation kind 'b , and memory layout 'c .
30
31
32
33
34 val create : ('a, 'b) Bigarray.kind -> 'c Bigarray.layout -> int -> int
35 -> ('a, 'b, 'c) t
36
37
38 Array2.create kind layout dim1 dim2 returns a new bigarray of two
39 dimension, whose size is dim1 in the first dimension and dim2 in the
40 second dimension. kind and layout determine the array element kind and
41 the array layout as described for Bigarray.Genarray.create .
42
43
44
45
46 val dim1 : ('a, 'b, 'c) t -> int
47
48 Return the first dimension of the given two-dimensional big array.
49
50
51
52
53 val dim2 : ('a, 'b, 'c) t -> int
54
55 Return the second dimension of the given two-dimensional big array.
56
57
58
59
60 val kind : ('a, 'b, 'c) t -> ('a, 'b) Bigarray.kind
61
62 Return the kind of the given big array.
63
64
65
66
67 val layout : ('a, 'b, 'c) t -> 'c Bigarray.layout
68
69 Return the layout of the given big array.
70
71
72
73
74 val get : ('a, 'b, 'c) t -> int -> int -> 'a
75
76
77 Array2.get a x y , also written a.{x,y} , returns the element of a at
78 coordinates ( x , y ). x and y must be within the bounds of a , as
79 described for Bigarray.Genarray.get ; otherwise, Invalid_argument is
80 raised.
81
82
83
84
85 val set : ('a, 'b, 'c) t -> int -> int -> 'a -> unit
86
87
88 Array2.set a x y v , or alternatively a.{x,y} <- v , stores the value v
89 at coordinates ( x , y ) in a . x and y must be within the bounds of a
90 , as described for Bigarray.Genarray.set ; otherwise, Invalid_argument
91 is raised.
92
93
94
95
96 val sub_left : ('a, 'b, Bigarray.c_layout) t -> int -> int -> ('a, 'b,
97 Bigarray.c_layout) t
98
99 Extract a two-dimensional sub-array of the given two-dimensional big
100 array by restricting the first dimension. See Bigarray.Genar‐
101 ray.sub_left for more details. Array2.sub_left applies only to arrays
102 with C layout.
103
104
105
106
107 val sub_right : ('a, 'b, Bigarray.fortran_layout) t -> int -> int ->
108 ('a, 'b, Bigarray.fortran_layout) t
109
110 Extract a two-dimensional sub-array of the given two-dimensional big
111 array by restricting the second dimension. See Bigarray.Genar‐
112 ray.sub_right for more details. Array2.sub_right applies only to
113 arrays with Fortran layout.
114
115
116
117
118 val slice_left : ('a, 'b, Bigarray.c_layout) t -> int -> ('a, 'b,
119 Bigarray.c_layout) Bigarray.Array1.t
120
121 Extract a row (one-dimensional slice) of the given two-dimensional big
122 array. The integer parameter is the index of the row to extract. See
123 Bigarray.Genarray.slice_left for more details. Array2.slice_left
124 applies only to arrays with C layout.
125
126
127
128
129 val slice_right : ('a, 'b, Bigarray.fortran_layout) t -> int -> ('a,
130 'b, Bigarray.fortran_layout) Bigarray.Array1.t
131
132 Extract a column (one-dimensional slice) of the given two-dimensional
133 big array. The integer parameter is the index of the column to
134 extract. See Bigarray.Genarray.slice_right for more details.
135 Array2.slice_right applies only to arrays with Fortran layout.
136
137
138
139
140 val blit : ('a, 'b, 'c) t -> ('a, 'b, 'c) t -> unit
141
142 Copy the first big array to the second big array. See Bigarray.Genar‐
143 ray.blit for more details.
144
145
146
147
148 val fill : ('a, 'b, 'c) t -> 'a -> unit
149
150 Fill the given big array with the given value. See Bigarray.Genar‐
151 ray.fill for more details.
152
153
154
155
156 val of_array : ('a, 'b) Bigarray.kind -> 'c Bigarray.layout -> 'a array
157 array -> ('a, 'b, 'c) t
158
159 Build a two-dimensional big array initialized from the given array of
160 arrays.
161
162
163
164
165 val map_file : Unix.file_descr -> ?pos:int64 -> ('a, 'b) Bigarray.kind
166 -> 'c Bigarray.layout -> bool -> int -> int -> ('a, 'b, 'c) t
167
168 Memory mapping of a file as a two-dimensional big array. See Bigar‐
169 ray.Genarray.map_file for more details.
170
171
172
173
174 val unsafe_get : ('a, 'b, 'c) t -> int -> int -> 'a
175
176 Like Bigarray.Array2.get , but bounds checking is not always performed.
177
178
179
180
181 val unsafe_set : ('a, 'b, 'c) t -> int -> int -> 'a -> unit
182
183 Like Bigarray.Array2.set , but bounds checking is not always performed.
184
185
186
187
188
189
190OCamldoc 2017-03-22 Bigarray.Array2(3)