Interval package: Difference between revisions

3,121 bytes added ,  12 April 2015
m
(→‎What to expect: Moved chapter)
Line 37: Line 37:
** Runs in GNU Octave 3.8.2 and 4.0 release candidates
** Runs in GNU Octave 3.8.2 and 4.0 release candidates
** Runs under GNU/Linux, Microsoft Windows (install from [[Octave-Forge#Installing_packages|Octave Forge]]), and Mac OS X ([[Create_a_MacOS_X_App_Bundle_Using_MacPorts|MacPorts]])
** Runs under GNU/Linux, Microsoft Windows (install from [[Octave-Forge#Installing_packages|Octave Forge]]), and Mac OS X ([[Create_a_MacOS_X_App_Bundle_Using_MacPorts|MacPorts]])
=== What to expect ===
The interval arithmetic provided by this interval package is '''slow''', but '''accurate'''.
''Why is the interval package slow?''
All arithmetic interval operations are simulated in high-level octave language using C99 or multi-precision floating-point routines, which is a lot slower than a hardware implementation [https://books.google.de/books?id=JTc4XdXFnQIC&pg=PA61]. Building interval arithmetic operations from floating-point routines is easy for simple monotonic functions, e. g., addition and subtraction, but is complex for others, e. g., [http://exp.ln0.de/heimlich-power-2011.htm interval power function], atan2, or [[#Reverse_arithmetic_operations|reverse functions]]. For some interval operations it is not even possible to rely on floating-point routines, since not all required routines are available in C99 or BLAS.
For example, multiplication of matrices with many elements becomes unfeasible as it takes a lot of time.
{| class="wikitable" style="margin: auto; align:right"
|+ Approximate runtime (wall clock time in seconds) <span style="font-weight: normal">— Results have been produced with GNU Octave 3.8.2 and Interval package 0.1.4 on an Intel® Core™ i5-4340M CPU (2.9–3.6 GHz)</span>
!rowspan="2"|Interval matrix size
!valign="top" style="min-width:6em"|<code>plus</code>
!valign="top" style="min-width:6em"|<code>times</code>
!valign="top" style="min-width:6em"|<code>log</code>
!valign="top" style="min-width:6em"|<code>pow</code>
!valign="top" style="min-width:6em"|<code>mtimes</code>
!valign="top" style="min-width:6em"|<code>mtimes</code>
!valign="top" style="min-width:6em"|<code>inv</code>
|-
!style="font-weight:normal"|tightest<br/>accuracy
!style="font-weight:normal"|tightest<br/>accuracy
!style="font-weight:normal"|tightest<br/>accuracy
!style="font-weight:normal"|tightest<br/>accuracy
!style="font-weight:normal"|valid<br/>accuracy
!style="font-weight:normal"|tightest<br/>accuracy
!style="font-weight:normal"|valid<br/>accuracy
|-
| 10 × 10
|align="right"| < 0.001
|align="right"| < 0.001
|align="right"| 0.001
|align="right"| 0.008
|align="right"| 0.001
|align="right"| 0.002
|align="right"| 0.025
|-
| 100 × 100
|align="right"| 0.003
|align="right"| 0.010
|align="right"| 0.055
|align="right"| 0.61
|align="right"| 0.012
|align="right"| 0.53
|align="right"| 0.30
|-
| 500 × 500
|align="right"| 0.060
|align="right"| 0.24
|align="right"| 1.3
|align="right"| 15
|align="right"| 0.30
|align="right"| 63
|align="right"| 4.2
|-
|}
''Why is the interval package accurate?''
The GNU Octave built-in floating-point routines are not useful for interval arithmetic: Their results depend on hardware, system libraries and compilation options.
The interval package handles all arithmetic functions with the help of the [http://www.mpfr.org/ GNU MPFR library]. With MPFR it is possible to compute system-independent, valid and tight enclosures of the correct results for most functions. However, it should be noted that some reverse operations and matrix operations do not exists in GNU MPFR and therefore cannot be computed with the same accuracy.


== Motivation ==
== Motivation ==
240

edits