1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link rel="previous" href="Big_int.html">
<link rel="next" href="Buffer.html">
<link rel="Up" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="Arg" rel="Chapter" href="Arg.html">
<link title="Arith_status" rel="Chapter" href="Arith_status.html">
<link title="Array" rel="Chapter" href="Array.html">
<link title="ArrayLabels" rel="Chapter" href="ArrayLabels.html">
<link title="Big_int" rel="Chapter" href="Big_int.html">
<link title="Bigarray" rel="Chapter" href="Bigarray.html">
<link title="Buffer" rel="Chapter" href="Buffer.html">
<link title="Callback" rel="Chapter" href="Callback.html">
<link title="CamlinternalMod" rel="Chapter" href="CamlinternalMod.html">
<link title="CamlinternalOO" rel="Chapter" href="CamlinternalOO.html">
<link title="Char" rel="Chapter" href="Char.html">
<link title="Complex" rel="Chapter" href="Complex.html">
<link title="Condition" rel="Chapter" href="Condition.html">
<link title="Dbm" rel="Chapter" href="Dbm.html">
<link title="Digest" rel="Chapter" href="Digest.html">
<link title="Dynlink" rel="Chapter" href="Dynlink.html">
<link title="Event" rel="Chapter" href="Event.html">
<link title="Filename" rel="Chapter" href="Filename.html">
<link title="Format" rel="Chapter" href="Format.html">
<link title="Gc" rel="Chapter" href="Gc.html">
<link title="Genlex" rel="Chapter" href="Genlex.html">
<link title="Graphics" rel="Chapter" href="Graphics.html">
<link title="GraphicsX11" rel="Chapter" href="GraphicsX11.html">
<link title="Hashtbl" rel="Chapter" href="Hashtbl.html">
<link title="Int32" rel="Chapter" href="Int32.html">
<link title="Int64" rel="Chapter" href="Int64.html">
<link title="Lazy" rel="Chapter" href="Lazy.html">
<link title="Lexing" rel="Chapter" href="Lexing.html">
<link title="List" rel="Chapter" href="List.html">
<link title="ListLabels" rel="Chapter" href="ListLabels.html">
<link title="Map" rel="Chapter" href="Map.html">
<link title="Marshal" rel="Chapter" href="Marshal.html">
<link title="MoreLabels" rel="Chapter" href="MoreLabels.html">
<link title="Mutex" rel="Chapter" href="Mutex.html">
<link title="Nativeint" rel="Chapter" href="Nativeint.html">
<link title="Num" rel="Chapter" href="Num.html">
<link title="Obj" rel="Chapter" href="Obj.html">
<link title="Oo" rel="Chapter" href="Oo.html">
<link title="Parsing" rel="Chapter" href="Parsing.html">
<link title="Pervasives" rel="Chapter" href="Pervasives.html">
<link title="Printexc" rel="Chapter" href="Printexc.html">
<link title="Printf" rel="Chapter" href="Printf.html">
<link title="Queue" rel="Chapter" href="Queue.html">
<link title="Random" rel="Chapter" href="Random.html">
<link title="Scanf" rel="Chapter" href="Scanf.html">
<link title="Set" rel="Chapter" href="Set.html">
<link title="Sort" rel="Chapter" href="Sort.html">
<link title="Stack" rel="Chapter" href="Stack.html">
<link title="StdLabels" rel="Chapter" href="StdLabels.html">
<link title="Str" rel="Chapter" href="Str.html">
<link title="Stream" rel="Chapter" href="Stream.html">
<link title="String" rel="Chapter" href="String.html">
<link title="StringLabels" rel="Chapter" href="StringLabels.html">
<link title="Sys" rel="Chapter" href="Sys.html">
<link title="Thread" rel="Chapter" href="Thread.html">
<link title="ThreadUnix" rel="Chapter" href="ThreadUnix.html">
<link title="Tk" rel="Chapter" href="Tk.html">
<link title="Unix" rel="Chapter" href="Unix.html">
<link title="UnixLabels" rel="Chapter" href="UnixLabels.html">
<link title="Weak" rel="Chapter" href="Weak.html"><link title="Element kinds" rel="Section" href="#6_Elementkinds">
<link title="Array layouts" rel="Section" href="#6_Arraylayouts">
<link title="Generic arrays (of arbitrarily many dimensions)" rel="Section" href="#6_Genericarraysofarbitrarilymanydimensions">
<link title="One-dimensional arrays" rel="Section" href="#6_Onedimensionalarrays">
<link title="Two-dimensional arrays" rel="Section" href="#6_Twodimensionalarrays">
<link title="Three-dimensional arrays" rel="Section" href="#6_Threedimensionalarrays">
<link title="Coercions between generic big arrays and fixed-dimension big arrays" rel="Section" href="#6_Coercionsbetweengenericbigarraysandfixeddimensionbigarrays">
<link title="Re-shaping big arrays" rel="Section" href="#6_Reshapingbigarrays">
<link title="Supported layouts" rel="Subsection" href="#7_Supportedlayouts">
<title>Bigarray</title>
</head>
<body>
<div class="navbar"><a href="Big_int.html">Previous</a>
<a href="index.html">Up</a>
<a href="Buffer.html">Next</a>
</div>
<center><h1>Module <a href="type_Bigarray.html">Bigarray</a></h1></center>
<br>
<pre><span class="keyword">module</span> Bigarray: <code class="code"><span class="keyword">sig</span></code> <a href="Bigarray.html">..</a> <code class="code"><span class="keyword">end</span></code></pre>Large, multi-dimensional, numerical arrays.
<p>
This module implements multi-dimensional arrays of integers and
floating-point numbers, thereafter referred to as ``big arrays''.
The implementation allows efficient sharing of large numerical
arrays between Caml code and C or Fortran numerical libraries.
<p>
Concerning the naming conventions, users of this module are encouraged
to do <code class="code"><span class="keyword">open</span> <span class="constructor">Bigarray</span></code> in their source, then refer to array types and
operations via short dot notation, e.g. <code class="code"><span class="constructor">Array1</span>.t</code> or <code class="code"><span class="constructor">Array2</span>.sub</code>.
<p>
Big arrays support all the Caml ad-hoc polymorphic operations:<ul>
<li>comparisons (<code class="code">=</code>, <code class="code"><></code>, <code class="code"><=</code>, etc, as well as <a href="Pervasives.html#VALcompare"><code class="code">compare</code></a>);</li>
<li>hashing (module <code class="code"><span class="constructor">Hash</span></code>);</li>
<li>and structured input-output (<a href="Pervasives.html#VALoutput_value"><code class="code">output_value</code></a>
and <a href="Pervasives.html#VALinput_value"><code class="code">input_value</code></a>, as well as the functions from the
<a href="Marshal.html"><code class="code"><span class="constructor">Marshal</span></code></a> module).</li>
</ul>
<br>
<hr width="100%">
<br>
<a name="6_Elementkinds"></a>
<h6>Element kinds</h6><br>
<br>
Big arrays can contain elements of the following kinds:<ul>
<li>IEEE single precision (32 bits) floating-point numbers
(<a href="Bigarray.html#TYPEfloat32_elt"><code class="code"><span class="constructor">Bigarray</span>.float32_elt</code></a>),</li>
<li>IEEE double precision (64 bits) floating-point numbers
(<a href="Bigarray.html#TYPEfloat64_elt"><code class="code"><span class="constructor">Bigarray</span>.float64_elt</code></a>),</li>
<li>IEEE single precision (2 * 32 bits) floating-point complex numbers
(<a href="Bigarray.html#TYPEcomplex32_elt"><code class="code"><span class="constructor">Bigarray</span>.complex32_elt</code></a>),</li>
<li>IEEE double precision (2 * 64 bits) floating-point complex numbers
(<a href="Bigarray.html#TYPEcomplex64_elt"><code class="code"><span class="constructor">Bigarray</span>.complex64_elt</code></a>),</li>
<li>8-bit integers (signed or unsigned)
(<a href="Bigarray.html#TYPEint8_signed_elt"><code class="code"><span class="constructor">Bigarray</span>.int8_signed_elt</code></a> or <a href="Bigarray.html#TYPEint8_unsigned_elt"><code class="code"><span class="constructor">Bigarray</span>.int8_unsigned_elt</code></a>),</li>
<li>16-bit integers (signed or unsigned)
(<a href="Bigarray.html#TYPEint16_signed_elt"><code class="code"><span class="constructor">Bigarray</span>.int16_signed_elt</code></a> or <a href="Bigarray.html#TYPEint16_unsigned_elt"><code class="code"><span class="constructor">Bigarray</span>.int16_unsigned_elt</code></a>),</li>
<li>Caml integers (signed, 31 bits on 32-bit architectures,
63 bits on 64-bit architectures) (<a href="Bigarray.html#TYPEint_elt"><code class="code"><span class="constructor">Bigarray</span>.int_elt</code></a>),</li>
<li>32-bit signed integer (<a href="Bigarray.html#TYPEint32_elt"><code class="code"><span class="constructor">Bigarray</span>.int32_elt</code></a>),</li>
<li>64-bit signed integers (<a href="Bigarray.html#TYPEint64_elt"><code class="code"><span class="constructor">Bigarray</span>.int64_elt</code></a>),</li>
<li>platform-native signed integers (32 bits on 32-bit architectures,
64 bits on 64-bit architectures) (<a href="Bigarray.html#TYPEnativeint_elt"><code class="code"><span class="constructor">Bigarray</span>.nativeint_elt</code></a>).</li>
</ul>
Each element kind is represented at the type level by one
of the abstract types defined below.<br>
<pre><span class="keyword">type</span> <a name="TYPEfloat32_elt"></a><code class="type"></code>float32_elt </pre>
<pre><span class="keyword">type</span> <a name="TYPEfloat64_elt"></a><code class="type"></code>float64_elt </pre>
<pre><span class="keyword">type</span> <a name="TYPEcomplex32_elt"></a><code class="type"></code>complex32_elt </pre>
<pre><span class="keyword">type</span> <a name="TYPEcomplex64_elt"></a><code class="type"></code>complex64_elt </pre>
<pre><span class="keyword">type</span> <a name="TYPEint8_signed_elt"></a><code class="type"></code>int8_signed_elt </pre>
<pre><span class="keyword">type</span> <a name="TYPEint8_unsigned_elt"></a><code class="type"></code>int8_unsigned_elt </pre>
<pre><span class="keyword">type</span> <a name="TYPEint16_signed_elt"></a><code class="type"></code>int16_signed_elt </pre>
<pre><span class="keyword">type</span> <a name="TYPEint16_unsigned_elt"></a><code class="type"></code>int16_unsigned_elt </pre>
<pre><span class="keyword">type</span> <a name="TYPEint_elt"></a><code class="type"></code>int_elt </pre>
<pre><span class="keyword">type</span> <a name="TYPEint32_elt"></a><code class="type"></code>int32_elt </pre>
<pre><span class="keyword">type</span> <a name="TYPEint64_elt"></a><code class="type"></code>int64_elt </pre>
<pre><span class="keyword">type</span> <a name="TYPEnativeint_elt"></a><code class="type"></code>nativeint_elt </pre>
<pre><span class="keyword">type</span> <a name="TYPEkind"></a><code class="type">('a, 'b)</code> kind </pre>
<div class="info">
To each element kind is associated a Caml type, which is
the type of Caml values that can be stored in the big array
or read back from it. This type is not necessarily the same
as the type of the array elements proper: for instance,
a big array whose elements are of kind <code class="code">float32_elt</code> contains
32-bit single precision floats, but reading or writing one of
its elements from Caml uses the Caml type <code class="code">float</code>, which is
64-bit double precision floats.
<p>
The abstract type <code class="code">(<span class="keywordsign">'</span>a, <span class="keywordsign">'</span>b) kind</code> captures this association
of a Caml type <code class="code"><span class="keywordsign">'</span>a</code> for values read or written in the big array,
and of an element kind <code class="code"><span class="keywordsign">'</span>b</code> which represents the actual contents
of the big array. The following predefined values of type
<code class="code">kind</code> list all possible associations of Caml types with
element kinds:<br>
</div>
<pre><span class="keyword">val</span> <a name="VALfloat32"></a>float32 : <code class="type">(float, <a href="Bigarray.html#TYPEfloat32_elt">float32_elt</a>) <a href="Bigarray.html#TYPEkind">kind</a></code></pre><div class="info">
See <a href="Bigarray.html#VALchar"><code class="code"><span class="constructor">Bigarray</span>.char</code></a>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALfloat64"></a>float64 : <code class="type">(float, <a href="Bigarray.html#TYPEfloat64_elt">float64_elt</a>) <a href="Bigarray.html#TYPEkind">kind</a></code></pre><div class="info">
See <a href="Bigarray.html#VALchar"><code class="code"><span class="constructor">Bigarray</span>.char</code></a>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALcomplex32"></a>complex32 : <code class="type">(<a href="Complex.html#TYPEt">Complex.t</a>, <a href="Bigarray.html#TYPEcomplex32_elt">complex32_elt</a>) <a href="Bigarray.html#TYPEkind">kind</a></code></pre><div class="info">
See <a href="Bigarray.html#VALchar"><code class="code"><span class="constructor">Bigarray</span>.char</code></a>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALcomplex64"></a>complex64 : <code class="type">(<a href="Complex.html#TYPEt">Complex.t</a>, <a href="Bigarray.html#TYPEcomplex64_elt">complex64_elt</a>) <a href="Bigarray.html#TYPEkind">kind</a></code></pre><div class="info">
See <a href="Bigarray.html#VALchar"><code class="code"><span class="constructor">Bigarray</span>.char</code></a>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALint8_signed"></a>int8_signed : <code class="type">(int, <a href="Bigarray.html#TYPEint8_signed_elt">int8_signed_elt</a>) <a href="Bigarray.html#TYPEkind">kind</a></code></pre><div class="info">
See <a href="Bigarray.html#VALchar"><code class="code"><span class="constructor">Bigarray</span>.char</code></a>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALint8_unsigned"></a>int8_unsigned : <code class="type">(int, <a href="Bigarray.html#TYPEint8_unsigned_elt">int8_unsigned_elt</a>) <a href="Bigarray.html#TYPEkind">kind</a></code></pre><div class="info">
See <a href="Bigarray.html#VALchar"><code class="code"><span class="constructor">Bigarray</span>.char</code></a>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALint16_signed"></a>int16_signed : <code class="type">(int, <a href="Bigarray.html#TYPEint16_signed_elt">int16_signed_elt</a>) <a href="Bigarray.html#TYPEkind">kind</a></code></pre><div class="info">
See <a href="Bigarray.html#VALchar"><code class="code"><span class="constructor">Bigarray</span>.char</code></a>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALint16_unsigned"></a>int16_unsigned : <code class="type">(int, <a href="Bigarray.html#TYPEint16_unsigned_elt">int16_unsigned_elt</a>) <a href="Bigarray.html#TYPEkind">kind</a></code></pre><div class="info">
See <a href="Bigarray.html#VALchar"><code class="code"><span class="constructor">Bigarray</span>.char</code></a>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALint"></a>int : <code class="type">(int, <a href="Bigarray.html#TYPEint_elt">int_elt</a>) <a href="Bigarray.html#TYPEkind">kind</a></code></pre><div class="info">
See <a href="Bigarray.html#VALchar"><code class="code"><span class="constructor">Bigarray</span>.char</code></a>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALint32"></a>int32 : <code class="type">(int32, <a href="Bigarray.html#TYPEint32_elt">int32_elt</a>) <a href="Bigarray.html#TYPEkind">kind</a></code></pre><div class="info">
See <a href="Bigarray.html#VALchar"><code class="code"><span class="constructor">Bigarray</span>.char</code></a>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALint64"></a>int64 : <code class="type">(int64, <a href="Bigarray.html#TYPEint64_elt">int64_elt</a>) <a href="Bigarray.html#TYPEkind">kind</a></code></pre><div class="info">
See <a href="Bigarray.html#VALchar"><code class="code"><span class="constructor">Bigarray</span>.char</code></a>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALnativeint"></a>nativeint : <code class="type">(nativeint, <a href="Bigarray.html#TYPEnativeint_elt">nativeint_elt</a>) <a href="Bigarray.html#TYPEkind">kind</a></code></pre><div class="info">
See <a href="Bigarray.html#VALchar"><code class="code"><span class="constructor">Bigarray</span>.char</code></a>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALchar"></a>char : <code class="type">(char, <a href="Bigarray.html#TYPEint8_unsigned_elt">int8_unsigned_elt</a>) <a href="Bigarray.html#TYPEkind">kind</a></code></pre><div class="info">
As shown by the types of the values above,
big arrays of kind <code class="code">float32_elt</code> and <code class="code">float64_elt</code> are
accessed using the Caml type <code class="code">float</code>. Big arrays of complex kinds
<code class="code">complex32_elt</code>, <code class="code">complex64_elt</code> are accessed with the Caml type
<a href="Complex.html#TYPEt"><code class="code"><span class="constructor">Complex</span>.t</code></a>. Big arrays of
integer kinds are accessed using the smallest Caml integer
type large enough to represent the array elements:
<code class="code">int</code> for 8- and 16-bit integer bigarrays, as well as Caml-integer
bigarrays; <code class="code">int32</code> for 32-bit integer bigarrays; <code class="code">int64</code>
for 64-bit integer bigarrays; and <code class="code">nativeint</code> for
platform-native integer bigarrays. Finally, big arrays of
kind <code class="code">int8_unsigned_elt</code> can also be accessed as arrays of
characters instead of arrays of small integers, by using
the kind value <code class="code">char</code> instead of <code class="code">int8_unsigned</code>.<br>
</div>
<br>
<a name="6_Arraylayouts"></a>
<h6>Array layouts</h6><br>
<pre><span class="keyword">type</span> <a name="TYPEc_layout"></a><code class="type"></code>c_layout </pre>
<div class="info">
See <a href="Bigarray.html#VALfortran_layout"><code class="code"><span class="constructor">Bigarray</span>.fortran_layout</code></a>.<br>
</div>
<pre><span class="keyword">type</span> <a name="TYPEfortran_layout"></a><code class="type"></code>fortran_layout </pre>
<div class="info">
To facilitate interoperability with existing C and Fortran code,
this library supports two different memory layouts for big arrays,
one compatible with the C conventions,
the other compatible with the Fortran conventions.
<p>
In the C-style layout, array indices start at 0, and
multi-dimensional arrays are laid out in row-major format.
That is, for a two-dimensional array, all elements of
row 0 are contiguous in memory, followed by all elements of
row 1, etc. In other terms, the array elements at <code class="code">(x,y)</code>
and <code class="code">(x, y+1)</code> are adjacent in memory.
<p>
In the Fortran-style layout, array indices start at 1, and
multi-dimensional arrays are laid out in column-major format.
That is, for a two-dimensional array, all elements of
column 0 are contiguous in memory, followed by all elements of
column 1, etc. In other terms, the array elements at <code class="code">(x,y)</code>
and <code class="code">(x+1, y)</code> are adjacent in memory.
<p>
Each layout style is identified at the type level by the
abstract types <a href="Bigarray.html#VALc_layout"><code class="code"><span class="constructor">Bigarray</span>.c_layout</code></a> and <code class="code">fortran_layout</code> respectively.<br>
</div>
<pre><span class="keyword">type</span> <a name="TYPElayout"></a><code class="type">'a</code> layout </pre>
<div class="info">
The type <code class="code"><span class="keywordsign">'</span>a layout</code> represents one of the two supported
memory layouts: C-style if <code class="code"><span class="keywordsign">'</span>a</code> is <a href="Bigarray.html#VALc_layout"><code class="code"><span class="constructor">Bigarray</span>.c_layout</code></a>, Fortran-style
if <code class="code"><span class="keywordsign">'</span>a</code> is <a href="Bigarray.html#VALfortran_layout"><code class="code"><span class="constructor">Bigarray</span>.fortran_layout</code></a>.<br>
</div>
<br>
<a name="7_Supportedlayouts"></a>
<div class="h7">Supported layouts</div>
<p>
The abstract values <code class="code">c_layout</code> and <code class="code">fortran_layout</code> represent
the two supported layouts at the level of values.<br>
<pre><span class="keyword">val</span> <a name="VALc_layout"></a>c_layout : <code class="type"><a href="Bigarray.html#TYPEc_layout">c_layout</a> <a href="Bigarray.html#TYPElayout">layout</a></code></pre><pre><span class="keyword">val</span> <a name="VALfortran_layout"></a>fortran_layout : <code class="type"><a href="Bigarray.html#TYPEfortran_layout">fortran_layout</a> <a href="Bigarray.html#TYPElayout">layout</a></code></pre><br>
<a name="6_Genericarraysofarbitrarilymanydimensions"></a>
<h6>Generic arrays (of arbitrarily many dimensions)</h6><br>
<pre><span class="keyword">module</span> <a href="Bigarray.Genarray.html">Genarray</a>: <code class="code"><span class="keyword">sig</span></code> <a href="Bigarray.Genarray.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><br>
<a name="6_Onedimensionalarrays"></a>
<h6>One-dimensional arrays</h6><br>
<pre><span class="keyword">module</span> <a href="Bigarray.Array1.html">Array1</a>: <code class="code"><span class="keyword">sig</span></code> <a href="Bigarray.Array1.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info">
One-dimensional arrays.
</div>
<br>
<a name="6_Twodimensionalarrays"></a>
<h6>Two-dimensional arrays</h6><br>
<pre><span class="keyword">module</span> <a href="Bigarray.Array2.html">Array2</a>: <code class="code"><span class="keyword">sig</span></code> <a href="Bigarray.Array2.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info">
Two-dimensional arrays.
</div>
<br>
<a name="6_Threedimensionalarrays"></a>
<h6>Three-dimensional arrays</h6><br>
<pre><span class="keyword">module</span> <a href="Bigarray.Array3.html">Array3</a>: <code class="code"><span class="keyword">sig</span></code> <a href="Bigarray.Array3.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info">
Three-dimensional arrays.
</div>
<br>
<a name="6_Coercionsbetweengenericbigarraysandfixeddimensionbigarrays"></a>
<h6>Coercions between generic big arrays and fixed-dimension big arrays</h6><br>
<pre><span class="keyword">val</span> <a name="VALgenarray_of_array1"></a>genarray_of_array1 : <code class="type">('a, 'b, 'c) <a href="Bigarray.Array1.html#TYPEt">Array1.t</a> -> ('a, 'b, 'c) <a href="Bigarray.Genarray.html#TYPEt">Genarray.t</a></code></pre><div class="info">
Return the generic big array corresponding to the given one-dimensional
big array.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALgenarray_of_array2"></a>genarray_of_array2 : <code class="type">('a, 'b, 'c) <a href="Bigarray.Array2.html#TYPEt">Array2.t</a> -> ('a, 'b, 'c) <a href="Bigarray.Genarray.html#TYPEt">Genarray.t</a></code></pre><div class="info">
Return the generic big array corresponding to the given two-dimensional
big array.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALgenarray_of_array3"></a>genarray_of_array3 : <code class="type">('a, 'b, 'c) <a href="Bigarray.Array3.html#TYPEt">Array3.t</a> -> ('a, 'b, 'c) <a href="Bigarray.Genarray.html#TYPEt">Genarray.t</a></code></pre><div class="info">
Return the generic big array corresponding to the given three-dimensional
big array.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALarray1_of_genarray"></a>array1_of_genarray : <code class="type">('a, 'b, 'c) <a href="Bigarray.Genarray.html#TYPEt">Genarray.t</a> -> ('a, 'b, 'c) <a href="Bigarray.Array1.html#TYPEt">Array1.t</a></code></pre><div class="info">
Return the one-dimensional big array corresponding to the given
generic big array. Raise <code class="code"><span class="constructor">Invalid_arg</span></code> if the generic big array
does not have exactly one dimension.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALarray2_of_genarray"></a>array2_of_genarray : <code class="type">('a, 'b, 'c) <a href="Bigarray.Genarray.html#TYPEt">Genarray.t</a> -> ('a, 'b, 'c) <a href="Bigarray.Array2.html#TYPEt">Array2.t</a></code></pre><div class="info">
Return the two-dimensional big array corresponding to the given
generic big array. Raise <code class="code"><span class="constructor">Invalid_arg</span></code> if the generic big array
does not have exactly two dimensions.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALarray3_of_genarray"></a>array3_of_genarray : <code class="type">('a, 'b, 'c) <a href="Bigarray.Genarray.html#TYPEt">Genarray.t</a> -> ('a, 'b, 'c) <a href="Bigarray.Array3.html#TYPEt">Array3.t</a></code></pre><div class="info">
Return the three-dimensional big array corresponding to the given
generic big array. Raise <code class="code"><span class="constructor">Invalid_arg</span></code> if the generic big array
does not have exactly three dimensions.<br>
</div>
<br>
<a name="6_Reshapingbigarrays"></a>
<h6>Re-shaping big arrays</h6><br>
<pre><span class="keyword">val</span> <a name="VALreshape"></a>reshape : <code class="type">('a, 'b, 'c) <a href="Bigarray.Genarray.html#TYPEt">Genarray.t</a> -><br> int array -> ('a, 'b, 'c) <a href="Bigarray.Genarray.html#TYPEt">Genarray.t</a></code></pre><div class="info">
<code class="code">reshape b [|d1;...;dN|]</code> converts the big array <code class="code">b</code> to a
<code class="code"><span class="constructor">N</span></code>-dimensional array of dimensions <code class="code">d1</code>...<code class="code">dN</code>. The returned
array and the original array <code class="code">b</code> share their data
and have the same layout. For instance, assuming that <code class="code">b</code>
is a one-dimensional array of dimension 12, <code class="code">reshape b [|3;4|]</code>
returns a two-dimensional array <code class="code">b'</code> of dimensions 3 and 4.
If <code class="code">b</code> has C layout, the element <code class="code">(x,y)</code> of <code class="code">b'</code> corresponds
to the element <code class="code">x * 3 + y</code> of <code class="code">b</code>. If <code class="code">b</code> has Fortran layout,
the element <code class="code">(x,y)</code> of <code class="code">b'</code> corresponds to the element
<code class="code">x + (y - 1) * 4</code> of <code class="code">b</code>.
The returned big array must have exactly the same number of
elements as the original big array <code class="code">b</code>. That is, the product
of the dimensions of <code class="code">b</code> must be equal to <code class="code">i1 * ... * iN</code>.
Otherwise, <code class="code"><span class="constructor">Invalid_arg</span></code> is raised.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALreshape_1"></a>reshape_1 : <code class="type">('a, 'b, 'c) <a href="Bigarray.Genarray.html#TYPEt">Genarray.t</a> -> int -> ('a, 'b, 'c) <a href="Bigarray.Array1.html#TYPEt">Array1.t</a></code></pre><div class="info">
Specialized version of <a href="Bigarray.html#VALreshape"><code class="code"><span class="constructor">Bigarray</span>.reshape</code></a> for reshaping to
one-dimensional arrays.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALreshape_2"></a>reshape_2 : <code class="type">('a, 'b, 'c) <a href="Bigarray.Genarray.html#TYPEt">Genarray.t</a> -><br> int -> int -> ('a, 'b, 'c) <a href="Bigarray.Array2.html#TYPEt">Array2.t</a></code></pre><div class="info">
Specialized version of <a href="Bigarray.html#VALreshape"><code class="code"><span class="constructor">Bigarray</span>.reshape</code></a> for reshaping to
two-dimensional arrays.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALreshape_3"></a>reshape_3 : <code class="type">('a, 'b, 'c) <a href="Bigarray.Genarray.html#TYPEt">Genarray.t</a> -><br> int -> int -> int -> ('a, 'b, 'c) <a href="Bigarray.Array3.html#TYPEt">Array3.t</a></code></pre><div class="info">
Specialized version of <a href="Bigarray.html#VALreshape"><code class="code"><span class="constructor">Bigarray</span>.reshape</code></a> for reshaping to
three-dimensional arrays.<br>
</div>
</body></html>
|