1Bigarray.Array1(3) OCamldoc Bigarray.Array1(3)
2
3
4
6 Bigarray.Array1 - One-dimensional arrays.
7
9 Module Bigarray.Array1
10
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
20 three-dimensional arrays.) Statically knowing the number of dimensions
21 of the array allows faster operations, and more precise static
22 type-checking.
23
24
25
26
27
28 type ('a, 'b, 'c) t
29
30
31 The type of one-dimensional big arrays whose elements have OCaml type
32 'a , representation kind 'b , and memory layout 'c .
33
34
35
36 val create : ('a, 'b) Bigarray.kind -> 'c Bigarray.layout -> int ->
37 ('a, 'b, 'c) t
38
39
40 Array1.create kind layout dim returns a new bigarray of one dimension,
41 whose size is dim . kind and layout determine the array element kind
42 and the array layout as described for Bigarray.Genarray.create .
43
44
45
46 val dim : ('a, 'b, 'c) t -> int
47
48 Return the size (dimension) of the given one-dimensional big array.
49
50
51
52 val kind : ('a, 'b, 'c) t -> ('a, 'b) Bigarray.kind
53
54 Return the kind of the given big array.
55
56
57
58 val layout : ('a, 'b, 'c) t -> 'c Bigarray.layout
59
60 Return the layout of the given big array.
61
62
63
64 val size_in_bytes : ('a, 'b, 'c) t -> int
65
66
67 size_in_bytes a is the number of elements in a multiplied by a 's
68 Bigarray.kind_size_in_bytes .
69
70
71 Since 4.03.0
72
73
74
75 val get : ('a, 'b, 'c) t -> int -> 'a
76
77
78 Array1.get a x , or alternatively a.{x} , returns the element of a at
79 index x . x must be greater or equal than 0 and strictly less than
80 Array1.dim a if a has C layout. If a has Fortran layout, x must be
81 greater or equal than 1 and less or equal than Array1.dim a . Other‐
82 wise, Invalid_argument is raised.
83
84
85
86 val set : ('a, 'b, 'c) t -> int -> 'a -> unit
87
88
89 Array1.set a x v , also written a.{x} <- v , stores the value v at
90 index x in a . x must be inside the bounds of a as described in Bigar‐
91 ray.Array1.get ; otherwise, Invalid_argument is raised.
92
93
94
95 val sub : ('a, 'b, 'c) t -> int -> int -> ('a, 'b, 'c) t
96
97 Extract a sub-array of the given one-dimensional big array. See Bigar‐
98 ray.Genarray.sub_left for more details.
99
100
101
102 val slice : ('a, 'b, 'c) t -> int -> ('a, 'b, 'c) Bigarray.Array0.t
103
104 Extract a scalar (zero-dimensional slice) of the given one-dimensional
105 big array. The integer parameter is the index of the scalar to
106 extract. See Bigarray.Genarray.slice_left and Bigarray.Genar‐
107 ray.slice_right for more details.
108
109
110 Since 4.05.0
111
112
113
114 val blit : ('a, 'b, 'c) t -> ('a, 'b, 'c) t -> unit
115
116 Copy the first big array to the second big array. See Bigarray.Genar‐
117 ray.blit for more details.
118
119
120
121 val fill : ('a, 'b, 'c) t -> 'a -> unit
122
123 Fill the given big array with the given value. See Bigarray.Genar‐
124 ray.fill for more details.
125
126
127
128 val of_array : ('a, 'b) Bigarray.kind -> 'c Bigarray.layout -> 'a array
129 -> ('a, 'b, 'c) t
130
131 Build a one-dimensional big array initialized from the given array.
132
133
134
135 val map_file : Unix.file_descr -> ?pos:int64 -> ('a, 'b) Bigarray.kind
136 -> 'c Bigarray.layout -> bool -> int -> ('a, 'b, 'c) t
137
138 Memory mapping of a file as a one-dimensional big array. See Bigar‐
139 ray.Genarray.map_file for more details.
140
141
142
143 val unsafe_get : ('a, 'b, 'c) t -> int -> 'a
144
145 Like Bigarray.Array1.get , but bounds checking is not always performed.
146 Use with caution and only when the program logic guarantees that the
147 access is within bounds.
148
149
150
151 val unsafe_set : ('a, 'b, 'c) t -> int -> 'a -> unit
152
153 Like Bigarray.Array1.set , but bounds checking is not always performed.
154 Use with caution and only when the program logic guarantees that the
155 access is within bounds.
156
157
158
159
160
1612018-04-14 source: Bigarray.Array1(3)