1Bigarray.Array1(3) OCaml library 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 one-
18 dimensional arrays. (The Array2 and Array3 structures below provide
19 operations specialized for two- and three-dimensional arrays.) Stati‐
20 cally knowing the number of dimensions of the array allows faster oper‐
21 ations, and more precise static type-checking.
22
23
24
25
26
27
28 type ('a, 'b, 'c) t
29
30
31 The type of one-dimensional big arrays whose elements have Caml type 'a
32 , representation kind 'b , and memory layout 'c .
33
34
35
36
37 val create : ('a, 'b) Bigarray.kind -> 'c Bigarray.layout -> int ->
38 ('a, 'b, 'c) t
39
40
41 Array1.create kind layout dim returns a new bigarray of one dimension,
42 whose size is dim . kind and layout determine the array element kind
43 and the array layout as described for Genarray.create .
44
45
46
47
48 val dim : ('a, 'b, 'c) t -> int
49
50 Return the size (dimension) of the given one-dimensional big array.
51
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
62 val layout : ('a, 'b, 'c) t -> 'c Bigarray.layout
63
64 Return the layout of the given big array.
65
66
67
68
69 val get : ('a, 'b, 'c) t -> int -> 'a
70
71
72 Array1.get a x , or alternatively a.{x} , returns the element of a at
73 index x . x must be greater or equal than 0 and strictly less than
74 Array1.dim a if a has C layout. If a has Fortran layout, x must be
75 greater or equal than 1 and less or equal than Array1.dim a . Other‐
76 wise, Invalid_arg is raised.
77
78
79
80
81 val set : ('a, 'b, 'c) t -> int -> 'a -> unit
82
83
84 Array1.set a x v , also written a.{x} <- v , stores the value v at
85 index x in a . x must be inside the bounds of a as described in Bigar‐
86 ray.Array1.get ; otherwise, Invalid_arg is raised.
87
88
89
90
91 val sub : ('a, 'b, 'c) t -> int -> int -> ('a, 'b, 'c) t
92
93 Extract a sub-array of the given one-dimensional big array. See Genar‐
94 ray.sub_left for more details.
95
96
97
98
99 val blit : ('a, 'b, 'c) t -> ('a, 'b, 'c) t -> unit
100
101 Copy the first big array to the second big array. See Genarray.blit
102 for more details.
103
104
105
106
107 val fill : ('a, 'b, 'c) t -> 'a -> unit
108
109 Fill the given big array with the given value. See Genarray.fill for
110 more details.
111
112
113
114
115 val of_array : ('a, 'b) Bigarray.kind -> 'c Bigarray.layout -> 'a array
116 -> ('a, 'b, 'c) t
117
118 Build a one-dimensional big array initialized from the given array.
119
120
121
122
123 val map_file : Unix.file_descr -> ('a, 'b) Bigarray.kind -> 'c Bigar‐
124 ray.layout -> bool -> int -> ('a, 'b, 'c) t
125
126 Memory mapping of a file as a one-dimensional big array. See Bigar‐
127 ray.Genarray.map_file for more details.
128
129
130
131
132
133
134OCamldoc 2007-05-24 Bigarray.Array1(3)