~ubuntu-branches/ubuntu/karmic/ocaml-doc/karmic

« back to all changes in this revision

Viewing changes to ocaml.html/libref/Bigarray.Genarray.html

  • Committer: Bazaar Package Importer
  • Author(s): Vanicat Rémi
  • Date: 2002-02-05 10:51:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020205105143-a061tunf8tev07ne
Tags: 3.04-4
* New debian maintainer
* Split doc-base file
* Move to non-free
* Change the copyright file to the copyright of the documentation
* remove FAQs (their license prohibit their redistribution)
* corrected the examples

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<html>
 
2
<head>
 
3
<link rel="stylesheet" href="style.css" type="text/css">
 
4
<link rel="Start" href="index.html">
 
5
<link rel="next" href="Bigarray.Array1.html">
 
6
<link rel="Up" href="Bigarray.html">
 
7
<link title="Index of types" rel="Appendix" href="index_types.html">
 
8
<link title="Index of exceptions" rel="Appendix" href="index_exceptions.html">
 
9
<link title="Index of values" rel="Appendix" href="index_values.html">
 
10
<link title="Index of class attributes" rel="Appendix" href="index_attributes.html">
 
11
<link title="Index of class methods" rel="Appendix" href="index_methods.html">
 
12
<link title="Index of classes" rel="Appendix" href="index_classes.html">
 
13
<link title="Index of class types" rel="Appendix" href="index_class_types.html">
 
14
<link title="Index of modules" rel="Appendix" href="index_modules.html">
 
15
<link title="Index of module types" rel="Appendix" href="index_module_types.html">
 
16
<link title="Arg" rel="Chapter" href="Arg.html">
 
17
 
 
18
<link title="Arith_status" rel="Chapter" href="Arith_status.html">
 
19
 
 
20
<link title="Array" rel="Chapter" href="Array.html">
 
21
 
 
22
<link title="ArrayLabels" rel="Chapter" href="ArrayLabels.html">
 
23
 
 
24
<link title="Big_int" rel="Chapter" href="Big_int.html">
 
25
 
 
26
<link title="Bigarray" rel="Chapter" href="Bigarray.html">
 
27
 
 
28
<link title="Buffer" rel="Chapter" href="Buffer.html">
 
29
 
 
30
<link title="Callback" rel="Chapter" href="Callback.html">
 
31
 
 
32
<link title="Char" rel="Chapter" href="Char.html">
 
33
 
 
34
<link title="Condition" rel="Chapter" href="Condition.html">
 
35
 
 
36
<link title="Dbm" rel="Chapter" href="Dbm.html">
 
37
 
 
38
<link title="Digest" rel="Chapter" href="Digest.html">
 
39
 
 
40
<link title="Dynlink" rel="Chapter" href="Dynlink.html">
 
41
 
 
42
<link title="Event" rel="Chapter" href="Event.html">
 
43
 
 
44
<link title="Filename" rel="Chapter" href="Filename.html">
 
45
 
 
46
<link title="Format" rel="Chapter" href="Format.html">
 
47
 
 
48
<link title="Gc" rel="Chapter" href="Gc.html">
 
49
 
 
50
<link title="Genlex" rel="Chapter" href="Genlex.html">
 
51
 
 
52
<link title="Graphics" rel="Chapter" href="Graphics.html">
 
53
 
 
54
<link title="GraphicsX11" rel="Chapter" href="GraphicsX11.html">
 
55
 
 
56
<link title="Hashtbl" rel="Chapter" href="Hashtbl.html">
 
57
 
 
58
<link title="Int32" rel="Chapter" href="Int32.html">
 
59
 
 
60
<link title="Int64" rel="Chapter" href="Int64.html">
 
61
 
 
62
<link title="Lazy" rel="Chapter" href="Lazy.html">
 
63
 
 
64
<link title="Lexing" rel="Chapter" href="Lexing.html">
 
65
 
 
66
<link title="List" rel="Chapter" href="List.html">
 
67
 
 
68
<link title="ListLabels" rel="Chapter" href="ListLabels.html">
 
69
 
 
70
<link title="Map" rel="Chapter" href="Map.html">
 
71
 
 
72
<link title="Marshal" rel="Chapter" href="Marshal.html">
 
73
 
 
74
<link title="MoreLabels" rel="Chapter" href="MoreLabels.html">
 
75
 
 
76
<link title="Mutex" rel="Chapter" href="Mutex.html">
 
77
 
 
78
<link title="Nativeint" rel="Chapter" href="Nativeint.html">
 
79
 
 
80
<link title="Num" rel="Chapter" href="Num.html">
 
81
 
 
82
<link title="Obj" rel="Chapter" href="Obj.html">
 
83
 
 
84
<link title="Oo" rel="Chapter" href="Oo.html">
 
85
 
 
86
<link title="Parsing" rel="Chapter" href="Parsing.html">
 
87
 
 
88
<link title="Pervasives" rel="Chapter" href="Pervasives.html">
 
89
 
 
90
<link title="Printexc" rel="Chapter" href="Printexc.html">
 
91
 
 
92
<link title="Printf" rel="Chapter" href="Printf.html">
 
93
 
 
94
<link title="Queue" rel="Chapter" href="Queue.html">
 
95
 
 
96
<link title="Random" rel="Chapter" href="Random.html">
 
97
 
 
98
<link title="Set" rel="Chapter" href="Set.html">
 
99
 
 
100
<link title="Sort" rel="Chapter" href="Sort.html">
 
101
 
 
102
<link title="Stack" rel="Chapter" href="Stack.html">
 
103
 
 
104
<link title="StdLabels" rel="Chapter" href="StdLabels.html">
 
105
 
 
106
<link title="Str" rel="Chapter" href="Str.html">
 
107
 
 
108
<link title="Stream" rel="Chapter" href="Stream.html">
 
109
 
 
110
<link title="String" rel="Chapter" href="String.html">
 
111
 
 
112
<link title="StringLabels" rel="Chapter" href="StringLabels.html">
 
113
 
 
114
<link title="Sys" rel="Chapter" href="Sys.html">
 
115
 
 
116
<link title="Thread" rel="Chapter" href="Thread.html">
 
117
 
 
118
<link title="ThreadUnix" rel="Chapter" href="ThreadUnix.html">
 
119
 
 
120
<link title="Tk" rel="Chapter" href="Tk.html">
 
121
 
 
122
<link title="Unix" rel="Chapter" href="Unix.html">
 
123
 
 
124
<link title="UnixLabels" rel="Chapter" href="UnixLabels.html">
 
125
 
 
126
<link title="Weak" rel="Chapter" href="Weak.html">
 
127
<title>Bigarray.Genarray</title>
 
128
</head>
 
129
<body>
 
130
<div class="navbar">&nbsp;<a href="Bigarray.html">Up</a>
 
131
&nbsp;<a href="Bigarray.Array1.html">Next</a>
 
132
</div>
 
133
<center><h1>Module <a href="type_Bigarray.Genarray.html">Bigarray.Genarray</a></h1></center>
 
134
<br>
 
135
<pre><span class="keyword">module</span> Genarray = <code><span class="keyword">struct</span> ... <span class="keyword">end</span> </code></pre><hr width="100%">
 
136
<br><code><span class="keyword">type</span> <a name="TYPEt"></a>(<code class="type">'a, 'b, 'c</code>) t </code>
 
137
<div class="info">
 
138
The type <code><span class="constructor">Genarray</span>.t</code> is the type of big arrays with variable
 
139
     numbers of dimensions.  Any number of dimensions between 1 and 16
 
140
     is supported.<br>
 
141
     The three type parameters to <code><span class="constructor">Genarray</span>.t</code> identify the array element
 
142
     kind and layout, as follows:<ul>
 
143
<li>the first parameter, <code><span class="keywordsign">'</span>a</code>, is the Caml type for accessing array
 
144
       elements (<code>float</code>, <code>int</code>, <code>int32</code>, <code>int64</code>, <code>nativeint</code>);</li>
 
145
<li>the second parameter, <code><span class="keywordsign">'</span>b</code>, is the actual kind of array elements
 
146
       (<code>float32_elt</code>, <code>float64_elt</code>, <code>int8_signed_elt</code>, <code>int8_unsigned_elt</code>,
 
147
       etc);</li>
 
148
<li>the third parameter, <code><span class="keywordsign">'</span>c</code>, identifies the array layout
 
149
       (<code>c_layout</code> or <code>fortran_layout</code>).</li>
 
150
</ul>
 
151
 
 
152
     For instance, <code>(float, float32_elt, fortran_layout) <span class="constructor">Genarray</span>.t</code>
 
153
     is the type of generic big arrays containing 32-bit floats
 
154
     in Fortran layout; reads and writes in this array use the
 
155
     Caml type <code>float</code>.<br>
 
156
</div>
 
157
<br>
 
158
<pre><span class="keyword">val</span> <a name="VALcreate"></a>create : <code class="type">('a, 'b) <a href="Bigarray.html#TYPEkind">Bigarray.kind</a> -><br>       'c <a href="Bigarray.html#TYPElayout">Bigarray.layout</a> -> int array -> ('a, 'b, 'c) <a href="Bigarray.Genarray.html#TYPEt">t</a></code></pre><div class="info">
 
159
<code><span class="constructor">Genarray</span>.create kind layout dimensions</code> returns a new big array
 
160
     whose element kind is determined by the parameter <code>kind</code> (one of
 
161
     <code>float32</code>, <code>float64</code>, <code>int8_signed</code>, etc) and whose layout is
 
162
     determined by the parameter <code>layout</code> (one of <code>c_layout</code> or
 
163
     <code>fortran_layout</code>).  The <code>dimensions</code> parameter is an array of
 
164
     integers that indicate the size of the big array in each dimension.
 
165
     The length of <code>dimensions</code> determines the number of dimensions
 
166
     of the bigarray.<br>
 
167
     For instance, <code><span class="constructor">Genarray</span>.create int32 c_layout [|4;6;8|]</code>
 
168
     returns a fresh big array of 32-bit integers, in C layout,
 
169
     having three dimensions, the three dimensions being 4, 6 and 8
 
170
     respectively.<br>
 
171
     Big arrays returned by <code><span class="constructor">Genarray</span>.create</code> are not initialized:
 
172
     the initial values of array elements is unspecified.<br>
 
173
     <code><span class="constructor">Genarray</span>.create</code> raises <code><span class="constructor">Invalid_arg</span></code> if the number of dimensions
 
174
     is not in the range 1 to 16 inclusive, or if one of the dimensions
 
175
     is negative.<br>
 
176
</div>
 
177
<pre><span class="keyword">val</span> <a name="VALnum_dims"></a>num_dims : <code class="type">('a, 'b, 'c) <a href="Bigarray.Genarray.html#TYPEt">t</a> -> int</code></pre><div class="info">
 
178
Return the number of dimensions of the given big array.<br>
 
179
</div>
 
180
<pre><span class="keyword">val</span> <a name="VALnth_dim"></a>nth_dim : <code class="type">('a, 'b, 'c) <a href="Bigarray.Genarray.html#TYPEt">t</a> -> int -> int</code></pre><div class="info">
 
181
<code><span class="constructor">Genarray</span>.nth_dim a n</code> returns the <code>n</code>-th dimension of the
 
182
     big array <code>a</code>.  The first dimension corresponds to <code>n = 0</code>;
 
183
     the second dimension corresponds to <code>n = 1</code>; the last dimension,
 
184
     to <code>n = <span class="constructor">Genarray</span>.num_dims a - 1</code>.
 
185
     Raise <code><span class="constructor">Invalid_arg</span></code> if <code>n</code> is less than 0 or greater or equal than
 
186
     <code><span class="constructor">Genarray</span>.num_dims a</code>.<br>
 
187
</div>
 
188
<pre><span class="keyword">val</span> <a name="VALget"></a>get : <code class="type">('a, 'b, 'c) <a href="Bigarray.Genarray.html#TYPEt">t</a> -> int array -> 'a</code></pre><div class="info">
 
189
Read an element of a generic big array.
 
190
     <code><span class="constructor">Genarray</span>.get a [|i1; ...; iN|]</code> returns the element of <code>a</code>
 
191
     whose coordinates are <code>i1</code> in the first dimension, <code>i2</code> in
 
192
     the second dimension, \ldots, <code>iN</code> in the <code><span class="constructor">N</span></code>-th dimension.<br>
 
193
     If <code>a</code> has C layout, the coordinates must be greater or equal than 0
 
194
     and strictly less than the corresponding dimensions of <code>a</code>.
 
195
     If <code>a</code> has Fortran layout, the coordinates must be greater or equal
 
196
     than 1 and less or equal than the corresponding dimensions of <code>a</code>.
 
197
     Raise <code><span class="constructor">Invalid_arg</span></code> if the array <code>a</code> does not have exactly <code><span class="constructor">N</span></code>
 
198
     dimensions, or if the coordinates are outside the array bounds.<br>
 
199
     If <code><span class="constructor">N</span> &gt; 3</code>, alternate syntax is provided: you can write
 
200
     <code>a.{i1, i2, ..., iN}</code> instead of <code><span class="constructor">Genarray</span>.get a [|i1; ...; iN|]</code>.
 
201
     (The syntax <code>a.{...}</code> with one, two or three coordinates is
 
202
     reserved for accessing one-, two- and three-dimensional arrays
 
203
     as described below.)<br>
 
204
</div>
 
205
<pre><span class="keyword">val</span> <a name="VALset"></a>set : <code class="type">('a, 'b, 'c) <a href="Bigarray.Genarray.html#TYPEt">t</a> -> int array -> 'a -> unit</code></pre><div class="info">
 
206
Assign an element of a generic big array.
 
207
     <code><span class="constructor">Genarray</span>.set a [|i1; ...; iN|] v</code> stores the value <code>v</code> in the
 
208
     element of <code>a</code> whose coordinates are <code>i1</code> in the first dimension,
 
209
     <code>i2</code> in the second dimension, \ldots, <code>iN</code> in the <code><span class="constructor">N</span></code>-th dimension.<br>
 
210
     The array <code>a</code> must have exactly <code><span class="constructor">N</span></code> dimensions, and all coordinates
 
211
     must lie inside the array bounds, as described for <code><span class="constructor">Genarray</span>.get</code>;
 
212
     otherwise, <code><span class="constructor">Invalid_arg</span></code> is raised.<br>
 
213
     If <code><span class="constructor">N</span> &gt; 3</code>, alternate syntax is provided: you can write
 
214
     <code>a.{i1, i2, ..., iN} &lt;- v</code> instead of
 
215
     <code><span class="constructor">Genarray</span>.set a [|i1; ...; iN|] v</code>.
 
216
     (The syntax <code>a.{...} &lt;- v</code> with one, two or three coordinates is
 
217
     reserved for updating one-, two- and three-dimensional arrays
 
218
     as described below.)<br>
 
219
</div>
 
220
<pre><span class="keyword">val</span> <a name="VALsub_left"></a>sub_left : <code class="type">('a, 'b, <a href="Bigarray.html#TYPEc_layout">Bigarray.c_layout</a>) <a href="Bigarray.Genarray.html#TYPEt">t</a> -><br>       int -> int -> ('a, 'b, <a href="Bigarray.html#TYPEc_layout">Bigarray.c_layout</a>) <a href="Bigarray.Genarray.html#TYPEt">t</a></code></pre><div class="info">
 
221
Extract a sub-array of the given big array by restricting the
 
222
     first (left-most) dimension.  <code><span class="constructor">Genarray</span>.sub_left a ofs len</code>
 
223
     returns a big array with the same number of dimensions as <code>a</code>,
 
224
     and the same dimensions as <code>a</code>, except the first dimension,
 
225
     which corresponds to the interval <code>[ofs ... ofs + len - 1]</code>
 
226
     of the first dimension of <code>a</code>.  No copying of elements is
 
227
     involved: the sub-array and the original array share the same
 
228
     storage space.  In other terms, the element at coordinates
 
229
     <code>[|i1; ...; iN|]</code> of the sub-array is identical to the
 
230
     element at coordinates <code>[|i1+ofs; ...; iN|]</code> of the original
 
231
     array <code>a</code>.<br>
 
232
     <code><span class="constructor">Genarray</span>.sub_left</code> applies only to big arrays in C layout.
 
233
     Raise <code><span class="constructor">Invalid_arg</span></code> if <code>ofs</code> and <code>len</code> do not designate
 
234
     a valid sub-array of <code>a</code>, that is, if <code>ofs &lt; 0</code>, or <code>len &lt; 0</code>,
 
235
     or <code>ofs + len &gt; <span class="constructor">Genarray</span>.nth_dim a 0</code>.<br>
 
236
</div>
 
237
<pre><span class="keyword">val</span> <a name="VALsub_right"></a>sub_right : <code class="type">('a, 'b, <a href="Bigarray.html#TYPEfortran_layout">Bigarray.fortran_layout</a>) <a href="Bigarray.Genarray.html#TYPEt">t</a> -><br>       int -> int -> ('a, 'b, <a href="Bigarray.html#TYPEfortran_layout">Bigarray.fortran_layout</a>) <a href="Bigarray.Genarray.html#TYPEt">t</a></code></pre><div class="info">
 
238
Extract a sub-array of the given big array by restricting the
 
239
     last (right-most) dimension.  <code><span class="constructor">Genarray</span>.sub_right a ofs len</code>
 
240
     returns a big array with the same number of dimensions as <code>a</code>,
 
241
     and the same dimensions as <code>a</code>, except the last dimension,
 
242
     which corresponds to the interval <code>[ofs ... ofs + len - 1]</code>
 
243
     of the last dimension of <code>a</code>.  No copying of elements is
 
244
     involved: the sub-array and the original array share the same
 
245
     storage space.  In other terms, the element at coordinates
 
246
     <code>[|i1; ...; iN|]</code> of the sub-array is identical to the
 
247
     element at coordinates <code>[|i1; ...; iN+ofs|]</code> of the original
 
248
     array <code>a</code>.<br>
 
249
     <code><span class="constructor">Genarray</span>.sub_right</code> applies only to big arrays in Fortran layout.
 
250
     Raise <code><span class="constructor">Invalid_arg</span></code> if <code>ofs</code> and <code>len</code> do not designate
 
251
     a valid sub-array of <code>a</code>, that is, if <code>ofs &lt; 1</code>, or <code>len &lt; 0</code>,
 
252
     or <code>ofs + len &gt; <span class="constructor">Genarray</span>.nth_dim a (<span class="constructor">Genarray</span>.num_dims a - 1)</code>.<br>
 
253
</div>
 
254
<pre><span class="keyword">val</span> <a name="VALslice_left"></a>slice_left : <code class="type">('a, 'b, <a href="Bigarray.html#TYPEc_layout">Bigarray.c_layout</a>) <a href="Bigarray.Genarray.html#TYPEt">t</a> -><br>       int array -> ('a, 'b, <a href="Bigarray.html#TYPEc_layout">Bigarray.c_layout</a>) <a href="Bigarray.Genarray.html#TYPEt">t</a></code></pre><div class="info">
 
255
Extract a sub-array of lower dimension from the given big array
 
256
     by fixing one or several of the first (left-most) coordinates.
 
257
     <code><span class="constructor">Genarray</span>.slice_left a [|i1; ... ; iM|]</code> returns the ``slice''
 
258
     of <code>a</code> obtained by setting the first <code><span class="constructor">M</span></code> coordinates to
 
259
     <code>i1</code>, \ldots, <code>iM</code>.  If <code>a</code> has <code><span class="constructor">N</span></code> dimensions, the slice has
 
260
     dimension <code><span class="constructor">N</span> - <span class="constructor">M</span></code>, and the element at coordinates
 
261
     <code>[|j1; ...; j(<span class="constructor">N</span>-<span class="constructor">M</span>)|]</code> in the slice is identical to the element
 
262
     at coordinates <code>[|i1; ...; iM; j1; ...; j(<span class="constructor">N</span>-<span class="constructor">M</span>)|]</code> in the original
 
263
     array <code>a</code>.  No copying of elements is involved: the slice and
 
264
     the original array share the same storage space.<br>
 
265
     <code><span class="constructor">Genarray</span>.slice_left</code> applies only to big arrays in C layout.
 
266
     Raise <code><span class="constructor">Invalid_arg</span></code> if <code><span class="constructor">M</span> &gt;= <span class="constructor">N</span></code>, or if <code>[|i1; ... ; iM|]</code>
 
267
     is outside the bounds of <code>a</code>.<br>
 
268
</div>
 
269
<pre><span class="keyword">val</span> <a name="VALslice_right"></a>slice_right : <code class="type">('a, 'b, <a href="Bigarray.html#TYPEfortran_layout">Bigarray.fortran_layout</a>) <a href="Bigarray.Genarray.html#TYPEt">t</a> -><br>       int array -> ('a, 'b, <a href="Bigarray.html#TYPEfortran_layout">Bigarray.fortran_layout</a>) <a href="Bigarray.Genarray.html#TYPEt">t</a></code></pre><div class="info">
 
270
Extract a sub-array of lower dimension from the given big array
 
271
     by fixing one or several of the last (right-most) coordinates.
 
272
     <code><span class="constructor">Genarray</span>.slice_right a [|i1; ... ; iM|]</code> returns the ``slice''
 
273
     of <code>a</code> obtained by setting the last <code><span class="constructor">M</span></code> coordinates to
 
274
     <code>i1</code>, \ldots, <code>iM</code>.  If <code>a</code> has <code><span class="constructor">N</span></code> dimensions, the slice has
 
275
     dimension <code><span class="constructor">N</span> - <span class="constructor">M</span></code>, and the element at coordinates
 
276
     <code>[|j1; ...; j(<span class="constructor">N</span>-<span class="constructor">M</span>)|]</code> in the slice is identical to the element
 
277
     at coordinates <code>[|j1; ...; j(<span class="constructor">N</span>-<span class="constructor">M</span>); i1; ...; iM|]</code> in the original
 
278
     array <code>a</code>.  No copying of elements is involved: the slice and
 
279
     the original array share the same storage space.<br>
 
280
     <code><span class="constructor">Genarray</span>.slice_right</code> applies only to big arrays in Fortran layout.
 
281
     Raise <code><span class="constructor">Invalid_arg</span></code> if <code><span class="constructor">M</span> &gt;= <span class="constructor">N</span></code>, or if <code>[|i1; ... ; iM|]</code>
 
282
     is outside the bounds of <code>a</code>.<br>
 
283
</div>
 
284
<pre><span class="keyword">val</span> <a name="VALblit"></a>blit : <code class="type">('a, 'b, 'c) <a href="Bigarray.Genarray.html#TYPEt">t</a> -> ('a, 'b, 'c) <a href="Bigarray.Genarray.html#TYPEt">t</a> -> unit</code></pre><div class="info">
 
285
Copy all elements of a big array in another big array.
 
286
     <code><span class="constructor">Genarray</span>.blit src dst</code> copies all elements of <code>src</code> into
 
287
     <code>dst</code>.  Both arrays <code>src</code> and <code>dst</code> must have the same number of
 
288
     dimensions and equal dimensions.  Copying a sub-array of <code>src</code>
 
289
     to a sub-array of <code>dst</code> can be achieved by applying <code><span class="constructor">Genarray</span>.blit</code>
 
290
     to sub-array or slices of <code>src</code> and <code>dst</code>.<br>
 
291
</div>
 
292
<pre><span class="keyword">val</span> <a name="VALfill"></a>fill : <code class="type">('a, 'b, 'c) <a href="Bigarray.Genarray.html#TYPEt">t</a> -> 'a -> unit</code></pre><div class="info">
 
293
Set all elements of a big array to a given value.
 
294
     <code><span class="constructor">Genarray</span>.fill a v</code> stores the value <code>v</code> in all elements of
 
295
     the big array <code>a</code>.  Setting only some elements of <code>a</code> to <code>v</code>
 
296
     can be achieved by applying <code><span class="constructor">Genarray</span>.fill</code> to a sub-array
 
297
     or a slice of <code>a</code>.<br>
 
298
</div>
 
299
<pre><span class="keyword">val</span> <a name="VALmap_file"></a>map_file : <code class="type"><a href="Unix.html#TYPEfile_descr">Unix.file_descr</a> -><br>       ('a, 'b) <a href="Bigarray.html#TYPEkind">Bigarray.kind</a> -><br>       'c <a href="Bigarray.html#TYPElayout">Bigarray.layout</a> -> bool -> int array -> ('a, 'b, 'c) <a href="Bigarray.Genarray.html#TYPEt">t</a></code></pre><div class="info">
 
300
Memory mapping of a file as a big array.
 
301
     <code><span class="constructor">Genarray</span>.map_file fd kind layout shared dims</code>
 
302
     returns a big array of kind <code>kind</code>, layout <code>layout</code>,
 
303
     and dimensions as specified in <code>dims</code>.  The data contained in
 
304
     this big array are the contents of the file referred to by
 
305
     the file descriptor <code>fd</code> (as opened previously with
 
306
     <code><span class="constructor">Unix</span>.openfile</code>, for example).  If <code>shared</code> is <code><span class="keyword">true</span></code>,
 
307
     all modifications performed on the array are reflected in
 
308
     the file.  This requires that <code>fd</code> be opened with write permissions.
 
309
     If <code>shared</code> is <code><span class="keyword">false</span></code>, modifications performed on the array
 
310
     are done in memory only, using copy-on-write of the modified
 
311
     pages; the underlying file is not affected.<br>
 
312
     <code><span class="constructor">Genarray</span>.map_file</code> is much more efficient than reading
 
313
     the whole file in a big array, modifying that big array,
 
314
     and writing it afterwards.<br>
 
315
     To adjust automatically the dimensions of the big array to
 
316
     the actual size of the file, the major dimension (that is,
 
317
     the first dimension for an array with C layout, and the last
 
318
     dimension for an array with Fortran layout) can be given as
 
319
     <code>-1</code>.  <code><span class="constructor">Genarray</span>.map_file</code> then determines the major dimension
 
320
     from the size of the file.  The file must contain an integral
 
321
     number of sub-arrays as determined by the non-major dimensions,
 
322
     otherwise <code><span class="constructor">Failure</span></code> is raised.<br>
 
323
     If all dimensions of the big array are given, the file size is
 
324
     matched against the size of the big array.  If the file is larger
 
325
     than the big array, only the initial portion of the file is
 
326
     mapped to the big array.  If the file is smaller than the big
 
327
     array, the file is automatically grown to the size of the big array.
 
328
     This requires write permissions on <code>fd</code>.<br>
 
329
</div>
 
330
</html>
 
 
b'\\ No newline at end of file'