Enable large arrays: Build octave such that it can use arrays larger than 2Gb.: Difference between revisions

Jump to navigation Jump to search
Take example from Manual, previous one actually works. Minor formatting improvements.
No edit summary
(Take example from Manual, previous one actually works. Minor formatting improvements.)
Line 4: Line 4:


<pre>
<pre>
octave:1> a = zeros(1024,1024,512);
>> a = zeros (1024*1024*1024*3, 1, 'int8');
error: memory exhausted or requested size too large for range of Octave's index type -- trying to return to prompt
error: out of memory or dimension too large for Octave's index type
</pre>
</pre>


You will obtain this error even if your system has enough RAM to create this array (4 GB in the above case).
You will obtain this error even if your system has enough RAM to create this array (4 GB in the above case).


To use arrays with more than (approximately) 2 billion elements, Octave has to be configured with the option --enable-64. This option is experimental and you are (as always) encouraged to submit bug reports if you find a problem.  
To use arrays with more than (approximately) <math>2^{31}</math> elements, Octave has to be configured with the option <code>--enable-64</code>. This option is experimental and you are (as always) encouraged to submit bug reports if you find a problem.  
With this option, Octave will use internally 64-bit integers for array dimensions and indexing. However, '''all numerical libraries''' used by Octave will need to use also 64-bit integers for array dimensions and indexing, and in most cases they need to be compiled from source.
With this option, Octave will use internally 64-bit integers for array dimensions and indexing. However, '''all numerical libraries''' used by Octave will need to use also 64-bit integers for array dimensions and indexing, and in most cases they need to be compiled from source.


Navigation menu