https://wiki.octave.org/wiki/api.php?action=feedcontributions&user=87.163.179.198&feedformat=atomOctave - User contributions [en]2024-03-29T14:03:21ZUser contributionsMediaWiki 1.39.2https://wiki.octave.org/wiki/index.php?title=Interval_package&diff=10556Interval package2017-12-04T14:32:15Z<p>87.163.179.198: /* Developer Information */</p>
<hr />
<div><div style="float: right; margin: 0 3em">[[File:Octave-interval.png|center]]</div>The GNU Octave interval package for real-valued interval arithmetic.<br />
<br />
[[File:Interval-sombrero.png|280px|thumb|right|Plotting the interval enclosure of a function]] <br />
<br />
== Distribution ==<br />
* [http://octave.sourceforge.net/interval/index.html Latest version at Octave Forge]<br />
** <code>pkg install -forge interval</code><br />
** [http://octave.sourceforge.net/interval/overview.html function reference]<br />
** [http://octave.sourceforge.net/interval/package_doc/index.html package documentation] (user manual)<br />
'''Third-party'''<br />
* [https://tracker.debian.org/pkg/octave-interval Debian GNU/Linux], [https://launchpad.net/ubuntu/+source/octave-interval Launchpad Ubuntu]<br />
* [https://aur.archlinux.org/packages/octave-interval/ archlinux user repository]<br />
* Included in [https://ftp.gnu.org/gnu/octave/windows/ official Windows installer] and installed automatically with Octave (since version 4.0.1)<br />
* [https://trac.macports.org/browser/trunk/dports/math/octave-interval MacPorts] for Mac OS X<br />
* [http://www.freshports.org/math/octave-forge-interval/ FreshPorts] for FreeBSD<br />
* [https://cygwin.com/cgi-bin2/package-grep.cgi?grep=octave-interval Cygwin] for Windows<br />
* [https://build.opensuse.org/package/show/science/octave-forge-interval openSUSE build service]<br />
<br />
== Development status ==<br />
* Completeness<br />
** All required functions from IEEE Std 1788-2015, IEEE standard for interval arithmetic, are implemented. The standard was approved on June 11, 2015. It will remain active for ten years.<br />
** In addition there are functions for interval matrix arithmetic, plotting and solvers.<br />
* Quality<br />
** Includes tests for all functions, many tests for basic functions<br />
** No known bugs. The package is quite new and still has a small user base, so there might be hidden bugs. Also some advanced functions will always need more testing.<br />
* Portability<br />
** Runs in GNU Octave ≥ 3.8.2<br />
** Known to run under GNU/Linux, Microsoft Windows, macOS, and FreeBSD<br />
* Possible TODOs<br />
** To be considered in the future: Algorithms can be migrated from the C-XSC Toolbox (C++ code) from [http://www2.math.uni-wuppertal.de/wrswt/xsc/cxsc_new.html] (nlinsys.cpp and cpzero.cpp), however these would need gradient arithmetic and complex arithmetic.<br />
** Interval version of <code>interp1</code><br />
** Extend <code>subsasgn</code> to allow direct manipulation of inf and sup (and dec) properties.<br />
>> A = infsup ("[2, 4]");<br />
>> A.inf = infsup ("[1, 3]")<br />
A = [1, 4]<br />
>> A.inf = 5<br />
A = [Empty]<br />
:* While at it, also allow multiple subscripts in <code>subsasgn</code><br />
>> A(:)(2:4)(2) = 42; # equivalent to A(3) = 42<br />
>> A.inf(3) = 42; # also A(3).inf = 42<br />
>> A.inf.inf = 42 # should produce error?<br />
>> A.inf.sup = 42 # should produce error?<br />
:* Tight Enclosure of Matrix Multiplication with Level 3 BLAS [http://kam.mff.cuni.cz/conferences/swim2015/abstracts/ozaki.pdf] [http://kam.mff.cuni.cz/conferences/swim2015/slides/ozaki.pdf]<br />
:* Verified Convex Hull for Inexact Data [http://kam.mff.cuni.cz/conferences/swim2015/abstracts/ohta.pdf] [http://kam.mff.cuni.cz/conferences/swim2015/slides/ohta.pdf]<br />
:* Implement user-controllable output from the interval standard (e. g. via printf functions):<br />
a) It should be possible to specify the preferred overall field width (the length of s).<br />
b) It should be possible to specify how Empty, Entire and NaI are output,<br />
e.g., whether lower or upper case, and whether Entire becomes [Entire] or [-Inf, Inf].<br />
c) For l and u, it should be possible to specify the field width,<br />
and the number of digits after the point or the number of significant digits.<br />
(partly this is already implemented by output_precision (...) / `format long` / `format short`)<br />
d) It should be possible to output the bounds of an interval without punctuation,<br />
e.g., 1.234 2.345 instead of [1.234, 2.345]. For instance, this might be a<br />
convenient way to write intervals to a file for use by another application.<br />
<br />
== Compatibility ==<br />
The interval package's main goal is to be compliant with IEEE Std 1788-2015, so it is compatible with other standard-conforming implementations (on the set of operations described by the standard document).<br />
<br />
=== Octave Forge simp package ===<br />
In 2008/2009 there was a Single Interval Mathematics Package (SIMP) for Octave, which has eventually become unmaintained at Octave Forge.<br />
<br />
The simp package contains a few basic interval arithmetic operations on scalar or vector intervals. It does not consider inaccurate built-in arithmetic functions, round-off, conversion and representational errors. As a result its syntax is very easy, but the arithmetic fails to produce guaranteed enclosures.<br />
<br />
It is recommended to use the interval package as a replacement for simp. However, function names and interval constructors are not compatible between the packages.<br />
<br />
=== INTLAB ===<br />
This interval package is ''not'' meant to be a replacement for INTLAB and any compatibility with it is pure coincidence. Since both are compatible with GNU Octave, they happen to agree on many function names and programs written for INTLAB may possibly run with this interval package as well. Some fundamental differences that I am currently aware of:<br />
* INTLAB is non-free software, it grants none of the [http://www.gnu.org/philosophy/free-sw.html four essential freedoms] of free software<br />
* INTLAB is not conforming to IEEE Std 1788-2015 and the parsing of intervals from strings uses a different format—especially for the uncertain form<br />
* INTLAB supports intervals with complex numbers and sparse interval matrices, but no empty intervals<br />
* INTLAB uses inferior accuracy for most arithmetic operations, because it focuses on speed<br />
* Basic operations can be found in both packages, but the availability of special functions depends<br />
<br />
{{Code|In GNU Octave the interval package can also be run alongside INTLAB.|<syntaxhighlight lang="octave"><br />
# INTLAB intervals<br />
A1 = infsup (2, 3);<br />
B1 = hull (-4, A1);<br />
C1 = midrad (0, 2);<br />
# Interval package intervals<br />
pkg load interval<br />
A2 = infsup (2, 3);<br />
B2 = hull (-4, A2);<br />
C2 = midrad (0, 2);<br />
pkg unload interval<br />
<br />
# Computation with INTLAB<br />
A1 + B1 * C1<br />
# Computation without INTLAB<br />
A2 + B2 * C2<br />
</syntaxhighlight><br />
}}<br />
<br />
==== Known differences ====<br />
Simple programs written for INTLAB should run without modification with this interval package. The following table lists common functions that use a different name in INTLAB.<br />
{|<br />
! interval package<br />
! INTLAB<br />
|-<br />
| infsup (x)<br />
| intval (x)<br />
|-<br />
| wid (x)<br />
| diam (x)<br />
|-<br />
| subset (a, b)<br />
| in (a, b)<br />
|-<br />
| interior (a, b)<br />
| in0 (a, b)<br />
|-<br />
| isempty (x)<br />
| isnan (x)<br />
|-<br />
| disjoint (a, b)<br />
| emptyintersect (a, b)<br />
|-<br />
| hdist (a, b)<br />
| qdist (a, b)<br />
|-<br />
| disp (x)<br />
| disp2str (x)<br />
|-<br />
| infsup (s)<br />
| str2intval (s)<br />
|-<br />
| isa (x, "infsup")<br />
| isintval (x)<br />
|}<br />
<br />
== Similar software ==<br />
<br />
For C++ there is an interval library [https://github.com/nehmeier/libieeep1788/ libieeep1788] by Marco Nehmeier (member of IEEE P1788). It aims to be standard compliant with IEEE Std 1788-2015 and is designed in a modular way, supporting several interval data types and different flavors of interval arithmetic [http://www.youtube.com/watch?v=GOa9aWAZO_Q]. The GNU Octave interval package shares several unit tests with libieeep1788.<br />
<br />
For Julia there is an evolving interval library [https://github.com/dpsanders/ValidatedNumerics.jl ValidatedNumerics.jl] by Luis Benet and David P. Sanders. It is planned to become conforming to IEEE Std 1788-2015 (or to the basic standard 1788.1) in the future.<br />
<br />
== Developer Information ==<br />
=== Source Code Repository ===<br />
https://sourceforge.net/p/octave/interval/ci/default/tree/<br />
<br />
=== Dependencies ===<br />
apt-get install liboctave-dev mercurial make automake libmpfr-dev<br />
<br />
=== Build ===<br />
The repository contains a Makefile which controls the build process. Some common targets are:<br />
* <code>make release</code> Create a release tarball and the HTML documentation for [[Octave Forge]] (takes a while).<br />
* <code>make check</code> Run the full test-suite to verify that code changes didn't break anything (takes a while).<br />
* <code>make run</code> Quickly start Octave with minimal recompilation and functions loaded from the workspace (for interactive testing of code changes).<br />
<br />
'''Build dependencies'''<br />
<code>apt-get install libmpfr-dev autoconf automake git python3-ply python3-yaml inkscape zopfli</code><br />
<br />
* Octave<br />
* Mercurial<br />
* Texinfo<br />
* MPFR<br />
* Octave package: doctest<br />
** Purpose: Verification of the examples in the manual and in the function documentation<br />
** Installation: Use <code>pkg install -forge doctest</code> inside Octave<br />
* Octave package: generate_html<br />
** Purpose: Generate HTML documenation for publication on Octave Forge (only needed for release)<br />
** Installation: Use <code>pkg install -forge generate_html</code> inside Octave<br />
* Autoconf & Automake<br />
** Purpose: Preparation of bundled crlibm library for a release<br />
* ITF1788<br />
** Purpose: Compilation of unit-test<br />
** Installation: The git repository is automatically cloned by the Makefile<br />
* Inkscape<br />
** Purpose: Generate / convert images for the manual<br />
* Zopfli<br />
** Purpose: Optimize the size of the compressed release tarball<br />
<br />
=== Architecture ===<br />
<br />
In a nutshell the package provides two new data types to users: bare intervals and decorated intervals. The data types are implemented as:<br />
* class <code>infsup</code> (bare interval) with attributes <code>inf</code> (lower interval boundary) and <code>sup</code> (upper interval boundary)<br />
* class <code>infsupdec</code> (decorated interval) which extends the former and adds attribute <code>dec</code> (interval decoration).<br />
<br />
Almost all functions in the package are implemented as methods of these classes, e. g. <code>@infsup/sin</code> implements the sine function for bare intervals. Most code is kept in m-files. Arithmetic operations that require correctly-rounded results are implemented in oct-files (C++ code), these are used internally by the m-files of the package. The source code is organized as follows:<br />
<br />
+- doc/ – package manual<br />
+- inst/<br />
| +- @infsup/<br />
| | +- infsup.m – class constructor for bare intervals<br />
| | +- sin.m – sine function for bare intervals (uses mpfr_function_d internally)<br />
| | `- ... – further functions on bare intervals<br />
| +- @infsupdec/<br />
| | +- infsupdec.m – class constructor for decorated intervals<br />
| | +- sin.m – sine function for decorated intervals (uses @infsup/sin internally)<br />
| | `- ... – further functions on decorated intervals<br />
| `- ... – a few global functions that don't operate on intervals<br />
+- src/<br />
| | +- mpfr_function_d.cc – computes various arithmetic functions correctly rounded (using MPFR)<br />
| | `- ... – other oct-file sources<br />
`- test/ – interval arithmetic unit tests<br />
<br />
=== Best practices ===<br />
==== Parameter checking ====<br />
* All methods must check <code>nargin</code> and call <code>print_usage</code> if the number of parameters is wrong. This prevents simple errors by the user.<br />
* Methods with more than 1 parameter must convert non-interval parameters to intervals using the class constructor. This allows the user to mix non-interval parameters with interval parameters and the function treats any inputs as intervals. Invalid values will be handled by the class constructors.<br />
if (not (isa (x, "infsup")))<br />
x = infsup (x);<br />
endif<br />
if (not (isa (y, "infsup")))<br />
y = infsup (y);<br />
endif<br />
<br />
if (not (isa (x, "infsupdec")))<br />
x = infsupdec (x);<br />
endif<br />
if (not (isa (y, "infsupdec")))<br />
y = infsupdec (y);<br />
endif<br />
<br />
==== Use of Octave functions ====<br />
Octave functions may be used as long as they don't introduce arithmetic errors. For example, the ceil function can be used safely since it is exact on binary64 numbers.<br />
function x = ceil (x)<br />
... parameter checking ...<br />
x.inf = ceil (x.inf);<br />
x.sup = ceil (x.sup);<br />
endfunction<br />
<br />
If Octave functions would introduce arithmetic/rounding errors, there are interfaces to MPFR (<code>mpfr_function_d</code>) and crlibm (<code>crlibm_function</code>), which can produce guaranteed boundaries.<br />
<br />
<br />
==== Vectorization & Indexing ====<br />
All functions should be implemented using vectorization and indexing. This is very important for performance on large data. For example, consider the plus function. It computes lower and upper boundaries of the result (x.inf, y.inf, x.sup, y.sup may be vectors or matrices) and then uses an indexing expression to adjust values where empty intervals would have produces problematic values.<br />
function x = plus (x, y)<br />
... parameter checking ...<br />
l = mpfr_function_d ('plus', -inf, x.inf, y.inf);<br />
u = mpfr_function_d ('plus', +inf, x.sup, y.sup);<br />
<br />
emptyresult = isempty (x) | isempty (y);<br />
l(emptyresult) = inf;<br />
u(emptyresult) = -inf;<br />
…<br />
endfunction<br />
<br />
== VERSOFT ==<br />
The [http://uivtx.cs.cas.cz/~rohn/matlab/ VERSOFT] software package (by Jiří Rohn) has been released under a free software license (Expat license) and algorithms may be migrated into the interval package.<br />
<br />
The following table is no longer up-to-date, it describes the situation before p-coded files have been disclosed. So, some functions are no longer trapped.<br />
<br />
{|<br />
! Function<br />
! Status<br />
! Information<br />
|-<br />
|colspan="3"|Real (or complex) data only: Matrices<br />
|-<br />
|verbasis<br />
|style="color:red"| trapped<br />
| depends on <code style="color:red">verfullcolrank</code><br />
|-<br />
|vercondnum<br />
|style="color:red"| trapped<br />
| depends on <code style="color:red">versingval</code><br />
|-<br />
|verdet<br />
|style="color:red"| trapped<br />
| depends on p-coded <code>ol</code><br />
|-<br />
|verdistsing<br />
|style="color:red"| trapped<br />
| depends on <code style="color:red">versingval</code><br />
|-<br />
|verfullcolrank<br />
|style="color:red"| encrypted<br />
| implemented in p-coded <code>zd</code><br />
|-<br />
|vernorm2<br />
|style="color:red"| trapped<br />
| depends on <code style="color:red">versingval</code><br />
|-<br />
|vernull (experimental)<br />
| unknown<br />
| depends on <code style="color:red">verlsq</code>; todo: compare with local function inside <code style="color:green">verintlinineqs</code><br />
|-<br />
|verorth<br />
|style="color:red"| trapped<br />
| depends on <code style="color:red">verbasis</code> and <code style="color:red">verthinsvd</code><br />
|-<br />
|verorthproj<br />
|style="color:red"| trapped<br />
| depends on <code style="color:red">verpinv</code> and <code style="color:red">verfullcolrank</code><br />
|-<br />
|verpd<br />
|style="color:red"| trapped<br />
| depends on <code>isspd</code> (by Rump, to be checked) and <code style="color:red">vereig</code><br />
|-<br />
|verpinv<br />
|style="color:red"| trapped<br />
| dependency <code>verifylss</code> is implemented as <code>mldivide</code>; depends on <code style="color:red">verthinsvd</code><br />
|-<br />
|verpmat<br />
|style="color:red"| trapped<br />
| depends on <code style="color:red">verregsing</code><br />
|-<br />
|verrank<br />
|style="color:red"| trapped<br />
| depends on <code style="color:red">versingval</code> and <code style="color:red">verbasis</code><br />
|-<br />
|verrref<br />
|style="color:red"| trapped<br />
| depends on <code style="color:red">verfullcolrank</code> and <code style="color:red">verpinv</code><br />
|-<br />
|colspan="3"|Real (or complex) data only: Matrices: Eigenvalues and singular values<br />
|-<br />
|vereig<br />
|style="color:red"| encrypted<br />
| implemented in p-coded <code>ol</code><br />
|-<br />
|<s>vereigback</s><br />
|style="color:green"| free, migrated (for real eigenvalues)<br />
| dependency <code>norm</code> is already implemented<br />
|-<br />
|verspectrad<br />
|style="color:red"| trapped<br />
| main part implemented in p-coded <code>ol</code><br />
|-<br />
|colspan="3"|Real (or complex) data only: Matrices: Decompositions<br />
|-<br />
|verpoldec<br />
|style="color:red"| trapped<br />
| depends on <code style="color:red">verthinsvd</code><br />
|-<br />
|verrankdec<br />
|style="color:red"| trapped<br />
| depends on <code style="color:red">verfullcolrank</code> and <code style="color:red">verpinv</code><br />
|-<br />
|verspectdec<br />
|style="color:red"| trapped<br />
| main part implemented in p-coded <code>ol</code><br />
|-<br />
|verthinsvd<br />
|style="color:red"| encrypted<br />
| implemented in p-coded <code>ol</code><br />
|-<br />
|colspan="3"|Real (or complex) data only: Matrix functions<br />
|-<br />
|vermatfun<br />
|style="color:red"| trapped<br />
| main part implemented in p-coded <code>ol</code><br />
|-<br />
|colspan="3"|Real data only: Linear systems (rectangular) <br />
|-<br />
|<s>verlinineqnn</s><br />
|style="color:green"| free, migrated<br />
| use <code>glpk</code> as a replacement for <code>linprog</code><br />
|-<br />
|verlinsys<br />
|style="color:red"| trapped<br />
| dependency <code>verifylss</code> is implemented as <code>mldivide</code>; depends on <code style="color:red">verpinv</code>, <code style="color:red">verfullcolrank</code>, and <code style="color:red">verbasis</code><br />
|-<br />
|verlsq<br />
|style="color:red"| trapped<br />
| depends on <code style="color:red">verpinv</code> and <code style="color:red">verfullcolrank</code><br />
|-<br />
|colspan="3"|Real data only: Optimization<br />
|-<br />
|verlcpall<br />
|style="color:red"| trapped<br />
| depends on <code style="color:red">verabsvaleqnall</code><br />
|-<br />
|<s>verlinprog</s><br />
|style="color:green"| free, migrated<br />
| use <code>glpk</code> as a replacement for <code>linprog</code>; dependency <code>verifylss</code> is implemented as <code>mldivide</code><br />
|-<br />
|verlinprogg<br />
|style="color:red"| encrypted<br />
| implemented in p-coded <code>at</code><br />
|-<br />
|verquadprog<br />
| unknown<br />
| use <code>quadprog</code> from the optim package; use <code>glpk</code> as a replacement for <code>linprog</code>; dependency <code>verifylss</code> is implemented as <code>mldivide</code>; depends on <code>isspd</code> (by Rump, to be checked, algorithm in [http://www.ti3.tuhh.de/paper/rump/Ru06c.pdf])<br />
|-<br />
|colspan="3"|Real (or complex) data only: Polynomials<br />
|-<br />
|verroots<br />
|style="color:red"| trapped<br />
| main part implemented in p-coded <code>ol</code><br />
|-<br />
|colspan="3"|Interval (or real) data: Matrices<br />
|-<br />
|verhurwstab<br />
|style="color:red"| trapped<br />
| depends on <code style="color:red">verposdef</code><br />
|-<br />
|verinverse<br />
|style="color:red"| trapped<br />
| depends on <code style="color:red">verintervalhull</code><br />
|-<br />
|<s>verinvnonneg</s><br />
|style="color:green"| free, migrated<br />
|-<br />
|verposdef<br />
|style="color:red"| trapped<br />
| depends on <code>isspd</code> (by Rump, to be checked) and <code style="color:red">verregsing</code><br />
|-<br />
|verregsing<br />
|style="color:red"| trapped<br />
| dependency <code>verifylss</code> is implemented as <code>mldivide</code>; depends on <code>isspd</code> (by Rump, to be checked) and <code style="color:red">verintervalhull</code>; see also [http://uivtx.cs.cas.cz/~rohn/publist/singreg.pdf]<br />
|-<br />
|colspan="3"|Interval (or real) data: Matrices: Eigenvalues and singular values<br />
|-<br />
|vereigsym<br />
|style="color:red"| trapped<br />
| main part implemented in p-coded <code>ol</code>, depends on <code style="color:red">verspectrad</code><br />
|-<br />
|vereigval<br />
|style="color:red"| trapped<br />
| depends on <code style="color:red">verregsing</code><br />
|-<br />
|<s>vereigvec</s><br />
|style="color:green"| free, migrated<br />
|-<br />
|verperrvec<br />
|style="color:green"| free<br />
| the function is just a wrapper around <code style="color:green">vereigvec</code>?!?<br />
|-<br />
|versingval<br />
|style="color:red"| trapped<br />
| depends on <code style="color:red">vereigsym</code><br />
|-<br />
|colspan="3"|Interval (or real) data: Matrices: Decompositions<br />
|-<br />
|verqr (experimental)<br />
|style="color:green"| free<br />
| <code>qr</code> has already been implemented using the Gram-Schmidt process, which seems to be more accurate and faster than the Cholsky decomposition or Householder reflections used in verqr. No migration needed.<br />
|-<br />
|<s>verchol (experimental)</s><br />
|style="color:green"| free, migrated<br />
| migrated version has been named after the standard Octave function <code>chol</code><br />
|-<br />
|colspan="3"|Interval (or real) data: Linear systems (square)<br />
|-<br />
|verenclinthull<br />
|style="color:red"| trapped<br />
| main part implemented in p-coded <code>ea</code><br />
|-<br />
|verhullparam<br />
|style="color:red"| encrypted<br />
| implemented in p-coded <code>jz</code><br />
|-<br />
|verhullpatt<br />
|style="color:red"| trapped<br />
| main part implemented in p-coded <code>jz</code><br />
|-<br />
|verintervalhull<br />
|style="color:red"| encrypted<br />
| implemented in p-coded <code>intervalhull</code> (find algorithm in [http://uivtx.cs.cas.cz/~rohn/publist/intervalhull.pdf])<br />
|-<br />
|colspan="3"|Interval (or real) data: Linear systems (rectangular)<br />
|-<br />
|verintlinineqs<br />
|style="color:green"| free<br />
| depends on <code style="color:green">verlinineqnn</code><br />
|-<br />
|veroettprag<br />
|style="color:green"| free<br />
|-<br />
|vertolsol<br />
|style="color:green"| free<br />
| depends on <code style="color:green">verlinineqnn</code><br />
|-<br />
|colspan="3"|Interval (or real) data: Matrix equations (rectangular)<br />
|-<br />
|vermatreqn<br />
|style="color:green"| free<br />
|-<br />
|colspan="3"|Real data only: Uncommon problems<br />
|-<br />
| plusminusoneset<br />
|style="color:green"| free<br />
|-<br />
| verabsvaleqn<br />
|style="color:red"| trapped<br />
| main part implemented in p-coded <code>ek</code> (find algorithm in [http://uivtx.cs.cas.cz/~rohn/publist/signaccalg.pdf], improved version in [http://uivtx.cs.cas.cz/~rohn/publist/absvaleqnreport.pdf])<br />
|-<br />
| verabsvaleqnall<br />
|style="color:red"| trapped<br />
| depends on <code style="color:red">verabsvaleqn</code>, see also [http://uivtx.cs.cas.cz/~rohn/publist/absvaleqnall.pdf]<br />
|-<br />
| verbasintnpprob<br />
|style="color:red"| trapped<br />
| depends on <code style="color:red">verregsing</code><br />
|-<br />
|}<br />
<br />
<br />
[[Category:Octave-Forge]]</div>87.163.179.198https://wiki.octave.org/wiki/index.php?title=Octave_for_Debian_systems&diff=10555Octave for Debian systems2017-12-04T12:21:05Z<p>87.163.179.198: /* The right way */ add hint for bug 50580</p>
<hr />
<div>For Debian, and Debian-based distributions such as Ubuntu, specific solutions.<br />
<br />
== Pre-compiled binaries ==<br />
<br />
Binary packages for Octave and many Octave-Forge packages are provided by all versions of Debian and Ubuntu. These are the most well-tested binaries available and should work best for most users.<br />
<br />
sudo apt-get install octave<br />
<br />
Aside the {{codeline|octave}} package that installs GNU Octave, other pieces of it are split over multiple packages. These are {{codeline|octave-doc}}, {{codeline|octave-info}}, and {{codeline|octave-htmldoc}} for the documentation; {{codeline|liboctave-dev}} for the octave development header files and mkoctfile (required to install Octave Forge packages); and {{codeline|octave-dbg}} for the debugging symbols.<br />
<br />
For Debian stable users, there may also be newer packages available in backports, so don't forget to check there.<br />
<br />
=== Octave packages ===<br />
<br />
Many Octave packages are also distributed by your Linux distribution. These are tested to work the best with your Octave version. For example:<br />
<br />
sudo apt-get install octave-control octave-image octave-io octave-optim octave-signal octave-statistics<br />
<br />
=== Octave's Personal Package Archive (PPA) for Ubuntu ===<br />
<br />
For some Ubuntu releases the Octave packages are too old (Ubuntu 12.04 only has Octave version 3.2). The [https://launchpad.net/~octave GNU Octave Team] on Launchpad maintains a PPA providing more up to date packages of Octave for all versions of Ubuntu. These are backported from Debian unstable (the Ubuntu Octave Team needs help testing and preparing the packages so if you can help with this, contact [[User:Mtmiller|Mike Miller]]). To set up your system to install these packages:<br />
<br />
sudo apt-add-repository ppa:octave/stable<br />
sudo apt-get update<br />
sudo apt-get install octave<br />
<br />
=== Linuxbrew ===<br />
<br />
It is possible to install the current stable version of Octave and any needed dependencies within your home directory, particularly useful if you have an old Linux distribution or do not have root access, using [http://linuxbrew.sh Linuxbrew]:<br />
<br />
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install)"<br />
echo 'export PATH="$HOME/.linuxbrew/bin:$PATH"' >>~/.bash_profile<br />
brew install homebrew/science/octave<br />
<br />
== Compiling from source ==<br />
<br />
The ''only'' tricky part is to install the dependencies. Once that is solved, installing from source should be as easy as {{Codeline|./configure && make && make install}}. See the manual for [http://www.gnu.org/software/octave/doc/interpreter/Running-Configure-and-Make.html configure options] and [[Octave_for_Debian_systems#Configuration|below]] for some common examples.<br />
<br />
=== Install dependencies ===<br />
<br />
Note that different Debian and Ubuntu versions may have slightly different package names but their differences should be pretty small, mostly limited to version numbers.<br />
<br />
==== The easy way (but likely incorrect) ====<br />
<br />
This approach is ''only'' suitable if you are building from source the ''same'' version that your Linux distribution already has packaged.<br />
<br />
The easy way to install ''most'' of the necessary dependencies is to {{Codeline|sudo apt-get build-dep octave}}. This will install all packages necessary to build and prepare a Debian package for the octave version available on your system repositories. However:<br />
* will install unnecessary packages related to the building of a Debian package;<br />
* may miss some new dependencies;<br />
* may install packages that are no longer octave dependencies.<br />
<br />
==== The even easier way (but experimental) ====<br />
<br />
The [[MXE|MXE-octave]] package provides a way to compile Octave for different platforms. Dependencies and certain flags are handled automatically.<br />
<br />
==== The right way ====<br />
<br />
The right way is to select and install all the dependencies as listed in the {{Path|INSTALL.OCTAVE}} file (if it is not in your source tree build it doing <code>make INSTALL.OCTAVE</code>). The following are their package names in Debian repositories (they will have their own dependencies which your package manager will solve automatically). If you are building development versions, you'll require some more packages as listed on {{Path|etc/HACKING}} and {{Path|INSTALL}}. Many of them will already be installed on your system. Install the dependencies by typing<br />
<br />
sudo apt-get install<br />
<br />
followed by the package names of the table below.<br />
<br />
:{| class="wikitable"<br />
|-<br />
! Dependency !! Debian 8 Jessie (stable) !! Ubuntu 16.04 Xenial Xerus (LTS)<br />
|-<br />
!colspan="3" style="text-align:center;" | Required build tools<br />
|-<br />
| C compiler<br />
|| [https://packages.debian.org/jessie/gcc gcc]<br />
|| [http://packages.ubuntu.com/xenial/gcc gcc]<br />
|-<br />
| C++ compiler<br />
|| [https://packages.debian.org/jessie/g++ g++]<br />
|| [http://packages.ubuntu.com/xenial/g++ g++]<br />
|-<br />
| Fortran compiler<br />
|| [https://packages.debian.org/jessie/gfortran gfortran]<br />
|| [http://packages.ubuntu.com/xenial/gfortran gfortran]<br />
|-<br />
| GNU make<br />
|| [https://packages.debian.org/jessie/make make]<br />
|| [http://packages.ubuntu.com/xenial/make make]<br />
|-<br />
!colspan="3" style="text-align:center;"| Required external packages<br />
|-<br />
| BLAS<br />
|| [https://packages.debian.org/jessie/libblas-dev libblas-dev]<br />
|| [http://packages.ubuntu.com/xenial/libblas-dev libblas-dev]<br />
|-<br />
| LAPACK<br />
|| [https://packages.debian.org/jessie/liblapack-dev liblapack-dev]<br />
|| [http://packages.ubuntu.com/xenial/liblapack-dev liblapack-dev]<br />
|-<br />
| PCRE<br />
|| [https://packages.debian.org/jessie/libpcre3-dev libpcre3-dev]<br />
|| [http://packages.ubuntu.com/xenial/libpcre3-dev libpcre3-dev]<br />
|-<br />
!colspan="3" style="text-align:center;"| ''Strongly'' recommended. Check the [http://www.gnu.org/software/octave/doc/interpreter/External-Packages.html Octave manual] for more information.<br />
|-<br />
| ARPACK<br />
|| [https://packages.debian.org/jessie/libarpack2-dev libarpack2-dev]<br />
|| [http://packages.ubuntu.com/xenial/libarpack2-dev libarpack2-dev]<br />
|-<br />
| cURL<br />
|| [https://packages.debian.org/jessie/libcurl4-gnutls-dev libcurl4-gnutls-dev]<br />
|| [http://packages.ubuntu.com/xenial/libcurl4-gnutls-dev libcurl4-gnutls-dev]<br />
|-<br />
| epstool<br />
|| [https://packages.debian.org/jessie/epstool epstool]<br />
|| [http://packages.ubuntu.com/xenial/epstool epstool]<br />
|-<br />
| FFTW3<br />
|| [https://packages.debian.org/jessie/libfftw3-dev libfftw3-dev]<br />
|| [http://packages.ubuntu.com/xenial/libfftw3-dev libfftw3-dev]<br />
|-<br />
| fig2dev<br />
|| [https://packages.debian.org/jessie/transfig transfig]<br />
|| [http://packages.ubuntu.com/xenial/transfig transfig]<br />
|-<br />
| FLTK<br />
|| [https://packages.debian.org/jessie/libfltk1.3-dev libfltk1.3-dev]<br />
|| [http://packages.ubuntu.com/xenial/libfltk1.3-dev libfltk1.3-dev]<br />
|-<br />
| fontconfig<br />
|| [https://packages.debian.org/jessie/libfontconfig1-dev libfontconfig1-dev]<br />
|| [http://packages.ubuntu.com/xenial/libfontconfig1-dev libfontconfig1-dev]<br />
|-<br />
| FreeType<br />
|| [https://packages.debian.org/jessie/libfreetype6-dev libfreetype6-dev]<br />
|| [http://packages.ubuntu.com/xenial/libfreetype6-dev libfreetype6-dev]<br />
|-<br />
| gl2ps<br />
|| [https://packages.debian.org/jessie/libgl2ps-dev libgl2ps-dev]<br />
|| [http://packages.ubuntu.com/xenial/libgl2ps-dev libgl2ps-dev]<br />
|-<br />
| GLPK<br />
|| [https://packages.debian.org/jessie/libglpk-dev libglpk-dev]<br />
|| [http://packages.ubuntu.com/xenial/libglpk-dev libglpk-dev]<br />
|-<br />
| GNU Readline<br />
|| [https://packages.debian.org/jessie/libreadline-dev libreadline-dev]<br />
|| [http://packages.ubuntu.com/xenial/libreadline-dev libreadline-dev]<br />
|-<br />
| gnuplot<br />
|| [https://packages.debian.org/jessie/gnuplot gnuplot]<br />
|| [http://packages.ubuntu.com/xenial/gnuplot gnuplot-x11]<br />
|-<br />
| GraphicsMagick++<br />
|| [https://packages.debian.org/jessie/libgraphicsmagick++1-dev libgraphicsmagick++1-dev]<br />
|| [http://packages.ubuntu.com/xenial/libgraphicsmagick++1-dev libgraphicsmagick++1-dev]<br />
|-<br />
| HDF5<br />
|| [https://packages.debian.org/jessie/libhdf5-serial-dev libhdf5-serial-dev]<br />
|| [http://packages.ubuntu.com/xenial/libhdf5-serial-dev libhdf5-serial-dev]<br />
|-<br />
| Java JDK<br />
|| [https://packages.debian.org/jessie/openjdk-7-jdk openjdk-7-jdk]<br />
|| [http://packages.ubuntu.com/xenial/openjdk-8-jdk openjdk-8-jdk]<br />
|-<br />
| libsndfile<br />
|| [https://packages.debian.org/jessie/libsndfile1-dev libsndfile1-dev]<br />
|| [http://packages.ubuntu.com/xenial/libsndfile1-dev libsndfile1-dev]<br />
|-<br />
| LLVM<br />
|| [https://packages.debian.org/jessie/llvm-dev llvm-dev]<br />
|| [http://packages.ubuntu.com/xenial/llvm-dev llvm-dev]<br />
|-<br />
| lpr<br />
|| [https://packages.debian.org/jessie/lpr lpr]<br />
|| [http://packages.ubuntu.com/xenial/lpr lpr]<br />
|-<br />
| makeinfo<br />
|| [https://packages.debian.org/jessie/texinfo texinfo]<br />
|| [http://packages.ubuntu.com/xenial/texinfo texinfo]<br />
|-<br />
| OpenGL<br />
|| [https://packages.debian.org/jessie/libgl1-mesa-dev libgl1-mesa-dev]<br />
|| [http://packages.ubuntu.com/xenial/libgl1-mesa-dev libgl1-mesa-dev]<br />
|-<br />
| OSMesa<br />
|| [https://packages.debian.org/jessie/libosmesa6-dev libosmesa6-dev]<br />
|| [http://packages.ubuntu.com/xenial/libosmesa6-dev libosmesa6-dev]<br />
|-<br />
| pstoedit<br />
|| [https://packages.debian.org/jessie/pstoedit pstoedit]<br />
|| [http://packages.ubuntu.com/xenial/pstoedit pstoedit]<br />
|-<br />
| PortAudio<br />
|| [https://packages.debian.org/jessie/portaudio19-dev portaudio19-dev]<br />
|| [http://packages.ubuntu.com/xenial/portaudio19-dev portaudio19-dev]<br />
|-<br />
| Qhull<br />
|| [https://packages.debian.org/jessie/libqhull-dev libqhull-dev]<br />
|| [http://packages.ubuntu.com/xenial/libqhull-dev libqhull-dev]<br />
|-<br />
| QRUPDATE<br />
|| [https://packages.debian.org/jessie/libqrupdate-dev libqrupdate-dev]<br />
|| [http://packages.ubuntu.com/xenial/libqrupdate-dev libqrupdate-dev]<br />
|-<br />
| QScintilla<br />
|| [https://packages.debian.org/jessie/libqscintilla2-dev libqscintilla2-dev]<br />
|| [http://packages.ubuntu.com/xenial/libqscintilla2-dev libqscintilla2-dev]<br />
|-<br />
| Qt<br />
||<br />
[https://packages.debian.org/jessie/libqt4-dev libqt4-dev]<br />
[https://packages.debian.org/jessie/libqtcore4 libqtcore4]<br />
[https://packages.debian.org/jessie/libqtwebkit4 libqtwebkit4]<br />
[https://packages.debian.org/jessie/libqt4-network libqt4-network]<br />
[https://packages.debian.org/jessie/libqtgui4 libqtgui4]<br />
[https://packages.debian.org/jessie/libqt4-opengl-dev libqt4-opengl-dev]<br />
||<br />
[http://packages.ubuntu.com/xenial/libqt4-dev libqt4-dev]<br />
[http://packages.ubuntu.com/xenial/libqtcore4 libqtcore4]<br />
[http://packages.ubuntu.com/xenial/libqtwebkit4 libqtwebkit4]<br />
[http://packages.ubuntu.com/xenial/libqt4-network libqt4-network]<br />
[http://packages.ubuntu.com/xenial/libqtgui4 libqtgui4]<br />
[http://packages.ubuntu.com/xenial/libqt4-opengl-dev libqt4-opengl-dev]<br />
|-<br />
| SuiteSparse<br />
|| [https://packages.debian.org/jessie/libsuitesparse-dev libsuitesparse-dev]<br />
|| [http://packages.ubuntu.com/xenial/libsuitesparse-dev libsuitesparse-dev]<br />
|-<br />
| Texlive<br />
|| texlive<br />
|| texlive<br />
|-<br />
| Xft<br />
|| [https://packages.debian.org/jessie/libxft-dev libxft-dev]<br />
|| [http://packages.ubuntu.com/xenial3/libxft-dev libxft-dev]<br />
|-<br />
| zlib<br />
|| [https://packages.debian.org/jessie/zlib1g-dev zlib1g-dev]<br />
|| [http://packages.ubuntu.com/xenial/zlib1g-dev zlib1g-dev]<br />
|-<br />
!colspan="3" style="text-align:center;"| Required to build from development sources<br />
|-<br />
| Autoconf<br />
|| [https://packages.debian.org/jessie/autoconf autoconf]<br />
|| [http://packages.ubuntu.com/xenial/autoconf autoconf]<br />
|-<br />
| Automake<br />
|| [https://packages.debian.org/jessie/automake automake]<br />
|| [http://packages.ubuntu.com/xenial/automake automake]<br />
|-<br />
| Bison<br />
|| [https://packages.debian.org/jessie/bison bison]<br />
|| [http://packages.ubuntu.com/xenial/bison bison]<br />
|-<br />
| Flex<br />
|| [https://packages.debian.org/jessie/flex flex]<br />
|| [http://packages.ubuntu.com/xenial/flex flex]<br />
|-<br />
| gperf<br />
|| [https://packages.debian.org/jessie/gperf gperf]<br />
|| [http://packages.ubuntu.com/xenial/gperf gperf]<br />
|-<br />
| gzip<br />
|| [https://packages.debian.org/jessie/gzip gzip]<br />
|| [http://packages.ubuntu.com/xenial/gzip gzip]<br />
|-<br />
| icoutils<br />
|| [https://packages.debian.org/jessie/icoutils icoutils]<br />
|| [http://packages.ubuntu.com/xenial/icoutils icoutils]<br />
|-<br />
| rsvg-convert<br />
|| [https://packages.debian.org/jessie/librsvg2-bin librsvg2-bin]<br />
|| [http://packages.ubuntu.com/xenial/librsvg2-bin librsvg2-bin]<br />
|-<br />
| libtool<br />
|| [https://packages.debian.org/jessie/libtool libtool]<br />
|| [http://packages.ubuntu.com/xenial/libtool libtool]<br />
|-<br />
| perl<br />
|| [https://packages.debian.org/jessie/perl perl]<br />
|| [http://packages.ubuntu.com/xenial/perl perl]<br />
|-<br />
| rsync<br />
|| [https://packages.debian.org/jessie/rsync rsync]<br />
|| [http://packages.ubuntu.com/xenial/rsync rsync]<br />
|-<br />
| tar<br />
|| [https://packages.debian.org/jessie/tar tar]<br />
|| [http://packages.ubuntu.com/xenial/tar tar]<br />
|}<br />
<br />
To install all of these on Ubuntu 16.04, type<br />
sudo apt-get install gcc g++ gfortran make libblas-dev liblapack-dev libpcre3-dev libarpack2-dev libcurl4-gnutls-dev epstool libfftw3-dev transfig libfltk1.3-dev libfontconfig1-dev libfreetype6-dev libgl2ps-dev libglpk-dev libreadline-dev gnuplot-x11 libgraphicsmagick++1-dev libhdf5-serial-dev openjdk-8-jdk libsndfile1-dev llvm-dev lpr texinfo libgl1-mesa-dev libosmesa6-dev pstoedit portaudio19-dev libqhull-dev libqrupdate-dev libqscintilla2-dev libqt4-dev libqtcore4 libqtwebkit4 libqt4-network libqtgui4 libqt4-opengl-dev libsuitesparse-dev texlive libxft-dev zlib1g-dev autoconf automake bison flex gperf gzip icoutils librsvg2-bin libtool perl rsync tar<br />
or, for Debian 8 stable,<br />
sudo apt-get install gcc g++ gfortran make libblas-dev liblapack-dev libpcre3-dev libarpack2-dev libcurl4-gnutls-dev epstool libfftw3-dev transfig libfltk1.3-dev libfontconfig1-dev libfreetype6-dev libgl2ps-dev libglpk-dev libreadline-dev gnuplot libgraphicsmagick++1-dev libhdf5-serial-dev openjdk-7-jdk libsndfile1-dev llvm-dev lpr texinfo libgl1-mesa-dev libosmesa6-dev pstoedit portaudio19-dev libqhull-dev libqrupdate-dev libqscintilla2-dev libqt4-dev libqtcore4 libqtwebkit4 libqt4-network libqtgui4 libqt4-opengl-dev libsuitesparse-dev texlive libxft-dev zlib1g-dev autoconf automake bison flex gperf gzip icoutils librsvg2-bin libtool perl rsync tar<br />
or, for Debian 9 stable,<br />
sudo apt-get install gcc g++ gfortran make libblas-dev liblapack-dev libpcre3-dev libarpack2-dev libcurl4-gnutls-dev epstool libfftw3-dev transfig libfltk1.3-dev libfontconfig1-dev libfreetype6-dev libgl2ps-dev libglpk-dev libreadline-dev gnuplot libgraphicsmagick++1-dev libhdf5-serial-dev openjdk-8-jdk libsndfile1-dev llvm-dev texinfo libgl1-mesa-dev libosmesa6-dev pstoedit portaudio19-dev libjack-jackd2-dev libqhull-dev libqrupdate-dev libqscintilla2-dev libqt4-dev libqtcore4 libqtwebkit4 libqt4-network libqtgui4 libqt4-opengl-dev libsuitesparse-dev texlive libxft-dev zlib1g-dev autoconf automake bison flex gperf gzip icoutils librsvg2-bin libtool perl rsync tar<br />
<br />
{{Warning|<ul><li>The Debian repositoriy has several libraries for dealing with HDF data files. The recommended is {{Codeline|libhdf5-serial-dev}}. However, the {{Forge|msh|msh package}} requires [http://www.geuz.org/gmsh/ gmsh] which is incompatible with it.</li><br />
<li>The GraphicsMagick++ library (libgraphicsmagick++1-dev) on the Debian repositories was compiled with quantum 8 which limits reading images to 8 bit. The solution is to recompile [[GraphicsMagick]] with quantum 16 or 32 before building Octave.</li><br />
<li>For debian9 using openjdk-9-jdk (even providing {{Codeline|JAVA_HOME}}) could *not* be used for the java interface! Use openjdk-8-jdk instead.</li><br />
<li>When configure decides to use QT5 instead of QT4, make might fail because lrelease is missing (see [https://savannah.gnu.org/bugs/?50580 bug 50580]). It can be fixed by installing {{Codeline|qttools5-dev-tools}}</li><br />
</ul>}}<br />
<br />
=== Configuration ===<br />
<br />
As mentioned above, Octave can be compiled with the default settings using {{Codeline|./configure && make && make install}}. You can also tweak the setup using configure options. Some examples are given below for a Linux system.<br />
<br />
==== 64 bit ====<br />
<br />
To get [https://www.gnu.org/software/octave/doc/interpreter/Compiling-Octave-with-64_002dbit-Indexing.html 64-bit] indexing requires all linked libraries to support 64-bit variables. You can omit most of these except BLAS which gives a fatal error. This is remedied by compiling [http://www.openblas.net/ OpenBLAS] with edits to its Makefile.rule so that BINARY=64 INTERFACE64=1.<br />
<br />
<code>./configure LD_LIBRARY_PATH=/opt/OpenBLAS/lib CPPFLAGS=-I/opt/OpenBLAS/include LDFLAGS=-L/opt/OpenBLAS/lib --enable-64</code><br />
<br />
==== Java ====<br />
<br />
Autodetection for java should work well on Debian-based systems. A specific Java version can be specified by passing {{codeline|JAVA_HOME}} to configure, for example<br />
<br />
./configure JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64<br />
<br />
==== HDF5 ====<br />
<br />
On current versions of Debian and Ubuntu, you may get the following warning when building an older version of Octave from source:<br />
<br />
HDF5 library not found. Octave will not be able to save or load HDF5 data files.<br />
<br />
The problem is that there are multiple versions of the hdf5 package. Octave was written with the serial version in mind but it is likely to work with the others (OpenMPI and Mpich). Due to the naming scheme done in Debian, it may be required to specify the location of the libraries. See bug {{bug|38928}} for details (starting with comment #19) but basically, use the following when running configure:<br />
<br />
./configure --with-hdf5-includedir=/usr/include/hdf5/serial --with-hdf5-libdir=/usr/lib/x86_64-linux-gnu/hdf5/serial<br />
<br />
On older versions of Debian and Ubuntu, where only one flavor of the HDF5 library could be installed at a time, you may need to build Octave against one of the MPI-enabled flavors. On these older systems, configuring Octave like this may work:<br />
<br />
./configure CPPFLAGS="-I/usr/include/mpi -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX"<br />
<br />
[[Category:Building]]<br />
[[Category:Installation]]<br />
[[Category:GNU/Linux]]</div>87.163.179.198