Tips and tricks: Difference between revisions

Jump to navigation Jump to search
201 bytes added ,  29 October 2017
(3 intermediate revisions by 3 users not shown)
Line 7: Line 7:
{{Code|change default figure size|<pre>set (0, 'DefaultFigurePosition', [1 get(0, "screensize")(4:-1:3) get(0, "DefaultFigurePosition")(4)]);</pre>}}
{{Code|change default figure size|<pre>set (0, 'DefaultFigurePosition', [1 get(0, "screensize")(4:-1:3) get(0, "DefaultFigurePosition")(4)]);</pre>}}


The value of {{Codeline|DefaultFigurePosition}} must be a four element vector with the x and y coordinates for the figure, followed by its with and height. The code above sets the default image to be placed at the top of the monitor, with the width of the monitor and the same height previously set as default.
The value of {{Codeline|DefaultFigurePosition}} must be a four element vector with the x and y coordinates for the figure, followed by its width and height. The code above sets the default image to be placed at the top of the monitor, with the width of the monitor and the same height previously set as default.


=== Changing default font for axes ===
=== Changing default font for axes ===
Line 78: Line 78:
<tr><td>element multiplication</td><td><code>A.*B</code></td><td><code>product(A,B) </code></td></tr>
<tr><td>element multiplication</td><td><code>A.*B</code></td><td><code>product(A,B) </code></td></tr>
<tr><td>element division</td><td><code>A./B</code></td><td><code>quotient(A,B) </code></td></tr>
<tr><td>element division</td><td><code>A./B</code></td><td><code>quotient(A,B) </code></td></tr>
<tr><td>transpose*</td><td><code>A'</code></td><td><code>A.transpose()</code></td></tr>
<tr><td>transpose*</td><td><code>A.'</code></td><td><code>A.transpose()</code></td></tr>
<tr><td>select element m,n of A**</td><td><code>A(m,n)</code></td><td><code>A(m-1,n-1)</code></td></tr>
<tr><td>select element m,n of A**</td><td><code>A(m,n)</code></td><td><code>A(m-1,n-1)</code></td></tr>
<tr><td>select row N of A**</td><td><code>A(N,:)</code></td><td><code>A.row(N-1)</code></td></tr>
<tr><td>select row N of A**</td><td><code>A(N,:)</code></td><td><code>A.row(N-1)</code></td></tr>
Line 113: Line 113:
<tr><td>number of rows</td><td><code>size(A,1)</code></td><td><code>A.rows()</code></td></tr>
<tr><td>number of rows</td><td><code>size(A,1)</code></td><td><code>A.rows()</code></td></tr>
<tr><td>number of columns</td><td><code>size(A,2)</code></td><td><code>A.cols()</code></td></tr>
<tr><td>number of columns</td><td><code>size(A,2)</code></td><td><code>A.cols()</code></td></tr>
<tr><td>range</td><td><code>0.1:0.2:0.9</code></td><td><code>Range (0.1, 0.9, 0.2).matrix_value ()</code></td></tr>
</table>
</table>


Line 176: Line 177:


===Changing BLAS===
===Changing BLAS===


Many Octave functions are wrappers to optimized numerical libraries, notably BLAS and ATLAS. It is possible to achieve impressive performance gains by simply using a library tuned to your platform. One example is using OpenBLAS to replace the default BLAS implementation ([http://www.stat.cmu.edu/~nmv/2013/07/09/for-faster-r-use-openblas-instead-better-than-atlas-trivial-to-switch-to-on-ubuntu/ further details]).
Many Octave functions are wrappers to optimized numerical libraries, notably BLAS and ATLAS. It is possible to achieve impressive performance gains by simply using a library tuned to your platform. One example is using OpenBLAS to replace the default BLAS implementation ([http://www.stat.cmu.edu/~nmv/2013/07/09/for-faster-r-use-openblas-instead-better-than-atlas-trivial-to-switch-to-on-ubuntu/ further details]).


On Linux, this just takes a few commands:
On some Linux distributions, this just takes a few commands. For instance, on Ubuntu, it usually suffices to run


sudo apt-get install libopenblas-base libatlas3gf-base
sudo apt-get install libopenblas-base libatlas3gf-base


Then run
followed by


sudo update-alternatives --config libblas.so.3
sudo update-alternatives --config libblas.so.3


and select the openblas option.
and then selecting the openblas option.
219

edits

Navigation menu