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 two-
18 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_arg is raised.
80
81
82
83
84 val set : ('a, 'b, 'c) t -> int -> int -> 'a -> unit
85
86
87 Array2.set a x y v , or alternatively a.{x,y} <- v , stores the value v
88 at coordinates ( x , y ) in a . x and y must be within the bounds of a
89 , as described for Bigarray.Genarray.set ; otherwise, Invalid_arg is
90 raised.
91
92
93
94
95 val sub_left : ('a, 'b, Bigarray.c_layout) t -> int -> int -> ('a, 'b,
96 Bigarray.c_layout) t
97
98 Extract a two-dimensional sub-array of the given two-dimensional big
99 array by restricting the first dimension. See Bigarray.Genar‐
100 ray.sub_left for more details. Array2.sub_left applies only to arrays
101 with C layout.
102
103
104
105
106 val sub_right : ('a, 'b, Bigarray.fortran_layout) t -> int -> int ->
107 ('a, 'b, Bigarray.fortran_layout) t
108
109 Extract a two-dimensional sub-array of the given two-dimensional big
110 array by restricting the second dimension. See Bigarray.Genar‐
111 ray.sub_right for more details. Array2.sub_right applies only to
112 arrays with Fortran layout.
113
114
115
116
117 val slice_left : ('a, 'b, Bigarray.c_layout) t -> int -> ('a, 'b,
118 Bigarray.c_layout) Bigarray.Array1.t
119
120 Extract a row (one-dimensional slice) of the given two-dimensional big
121 array. The integer parameter is the index of the row to extract. See
122 Bigarray.Genarray.slice_left for more details. Array2.slice_left
123 applies only to arrays with C layout.
124
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
139 val blit : ('a, 'b, 'c) t -> ('a, 'b, 'c) t -> unit
140
141 Copy the first big array to the second big array. See Bigarray.Genar‐
142 ray.blit for more details.
143
144
145
146
147 val fill : ('a, 'b, 'c) t -> 'a -> unit
148
149 Fill the given big array with the given value. See Bigarray.Genar‐
150 ray.fill for more details.
151
152
153
154
155 val of_array : ('a, 'b) Bigarray.kind -> 'c Bigarray.layout -> 'a array
156 array -> ('a, 'b, 'c) t
157
158 Build a two-dimensional big array initialized from the given array of
159 arrays.
160
161
162
163
164 val map_file : Unix.file_descr -> ('a, 'b) Bigarray.kind -> 'c Bigar‐
165 ray.layout -> bool -> int -> int -> ('a, 'b, 'c) t
166
167 Memory mapping of a file as a two-dimensional big array. See Bigar‐
168 ray.Genarray.map_file for more details.
169
170
171
172
173
174
175OCamldoc 2007-05-24 Bigarray.Array2(3)