1Bigarray.Array2(3) OCamldoc 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 type ('a, 'b, 'c) t
25
26
27 The type of two-dimensional big arrays 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 -> ('a, 'b, 'c) t
34
35
36 Array2.create kind layout dim1 dim2 returns a new bigarray of two
37 dimension, whose size is dim1 in the first dimension and dim2 in the
38 second dimension. kind and layout determine the array element kind and
39 the array layout as described for Bigarray.Genarray.create .
40
41
42
43 val dim1 : ('a, 'b, 'c) t -> int
44
45 Return the first dimension of the given two-dimensional big array.
46
47
48
49 val dim2 : ('a, 'b, 'c) t -> int
50
51 Return the second dimension of the given two-dimensional big array.
52
53
54
55 val kind : ('a, 'b, 'c) t -> ('a, 'b) Bigarray.kind
56
57 Return the kind of the given big array.
58
59
60
61 val layout : ('a, 'b, 'c) t -> 'c Bigarray.layout
62
63 Return the layout of the given big array.
64
65
66
67 val size_in_bytes : ('a, 'b, 'c) t -> int
68
69
70 size_in_bytes a is the number of elements in a multiplied by a 's
71 Bigarray.kind_size_in_bytes .
72
73
74 Since 4.03.0
75
76
77
78 val get : ('a, 'b, 'c) t -> int -> int -> 'a
79
80
81 Array2.get a x y , also written a.{x,y} , returns the element of a at
82 coordinates ( x , y ). x and y must be within the bounds of a , as
83 described for Bigarray.Genarray.get ; otherwise, Invalid_argument is
84 raised.
85
86
87
88 val set : ('a, 'b, 'c) t -> int -> int -> 'a -> unit
89
90
91 Array2.set a x y v , or alternatively a.{x,y} <- v , stores the value v
92 at coordinates ( x , y ) in a . x and y must be within the bounds of a
93 , as described for Bigarray.Genarray.set ; otherwise, Invalid_argument
94 is raised.
95
96
97
98 val sub_left : ('a, 'b, Bigarray.c_layout) t -> int -> int -> ('a, 'b,
99 Bigarray.c_layout) t
100
101 Extract a two-dimensional sub-array of the given two-dimensional big
102 array by restricting the first dimension. See Bigarray.Genar‐
103 ray.sub_left for more details. Array2.sub_left applies only to arrays
104 with C layout.
105
106
107
108 val sub_right : ('a, 'b, Bigarray.fortran_layout) t -> int -> int ->
109 ('a, 'b, Bigarray.fortran_layout) t
110
111 Extract a two-dimensional sub-array of the given two-dimensional big
112 array by restricting the second dimension. See Bigarray.Genar‐
113 ray.sub_right for more details. Array2.sub_right applies only to
114 arrays with Fortran layout.
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 val slice_right : ('a, 'b, Bigarray.fortran_layout) t -> int -> ('a,
129 'b, Bigarray.fortran_layout) Bigarray.Array1.t
130
131 Extract a column (one-dimensional slice) of the given two-dimensional
132 big array. The integer parameter is the index of the column to
133 extract. See Bigarray.Genarray.slice_right for more details.
134 Array2.slice_right applies only to arrays with Fortran layout.
135
136
137
138 val blit : ('a, 'b, 'c) t -> ('a, 'b, 'c) t -> unit
139
140 Copy the first big array to the second big array. See Bigarray.Genar‐
141 ray.blit for more details.
142
143
144
145 val fill : ('a, 'b, 'c) t -> 'a -> unit
146
147 Fill the given big array with the given value. See Bigarray.Genar‐
148 ray.fill for more details.
149
150
151
152 val of_array : ('a, 'b) Bigarray.kind -> 'c Bigarray.layout -> 'a array
153 array -> ('a, 'b, 'c) t
154
155 Build a two-dimensional big array initialized from the given array of
156 arrays.
157
158
159
160 val map_file : Unix.file_descr -> ?pos:int64 -> ('a, 'b) Bigarray.kind
161 -> 'c Bigarray.layout -> bool -> int -> int -> ('a, 'b, 'c) t
162
163 Memory mapping of a file as a two-dimensional big array. See Bigar‐
164 ray.Genarray.map_file for more details.
165
166
167
168 val unsafe_get : ('a, 'b, 'c) t -> int -> int -> 'a
169
170 Like Bigarray.Array2.get , but bounds checking is not always performed.
171
172
173
174 val unsafe_set : ('a, 'b, 'c) t -> int -> int -> 'a -> unit
175
176 Like Bigarray.Array2.set , but bounds checking is not always performed.
177
178
179
180
181
1822018-04-14 source: Bigarray.Array2(3)