Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quadruple Precision Eigenvalues, Eigenvectors and Matrix Logarithms

I am attempting to diagonalize matrices in quadruple precision, and to take their logarithms. Is there a language in which I can accomplish this using built-in functions?

Note, the languages/packages in the tags are insufficient, suffering from the following deficiencies:

Matlab: Does not support quad precision.

Python/NumPy/SciPy: Matrices with dtype float128 yield eigenvectors in float64.

Sage: Interface through GP/PARI yields cryptic error messages.

Has anyone performed diagonalization and matrix logarithms to quad precision, and if so, how?

like image 975
Ben Criger Avatar asked Feb 29 '12 00:02

Ben Criger


2 Answers

@Matlab: Does not support quad precision.

Multiprecision Computing Toolbox for MATLAB provides routines for linear algebra computations in arbitrary precision.

It covers many other fields - basic math, numerical methods (integration, ode, optimization), special functions and basic data analysis.

Besides it allows running existing Matlab's programs in arbitrary precision with only minimal (or without any) modifications to source code.

Update (March 27, 2013): Now toolbox also includes fast quadruple precision mode, which is nearly 100 times faster compared to alternatives. See Fast Quadruple Precision Computations in MATLAB for comparisons and details.


Critics on suggested alternatives:

Symbolic Math Toolbox (MATLAB) from Mathworks targeted to symbolic computations. As such it lacks many essential features needed for arbitrary precision numerical computing.

For example, it is not even possible to compare two vpa() numbers since they are of "symbolic" type (by design). This only limitation rules out 99% of algorithms from numerical analysis.

Other basic linear algebra functions missing in Symbolic Math Toolbox are: norm, cond, max, min, sort, lu, qr, chol, schur.

Free Multiple Precision Toolbox (MATLAB).

Besides being extremely slow (it performs number-to-string conversion of operands on every arithmetic operation: +, -, ...) and lacking essential functionality (eig, det, cond, \, ...), it gives wrong results in functions it has.

E.g. incorrect results delivered by svd function made my research senseless at some point and error was painful to find.

mpmath (Python)

Mainly targeted to special functions computing (hypergeometric family in particular). And has no support for more or less advanced numerical algorithms. Has very little support for matrices. Although seems to have matrix logarithm you are looking for in the latest version.


Actually all these drawbacks pushed me to develop my own extension for MATLAB to enable it with arbitrary precision computing (referred at the beginning - Multiprecision Computing Toolbox for MATLAB). I just need it for my work.

It is under active development (but already fixes all listed problems with other alternatives) - I would appreciate any feedback.

like image 129
Pavel Holoborodko Avatar answered Sep 29 '22 19:09

Pavel Holoborodko


Regarding diagonalization, maybe this can help you (he also needed more accurate eigenvalues than what doubles where giving him and ended up using quadruple precision).

He is using fortran. Changing to quads involved defining an integer to be 16 instead of 8 and recompiling LAPACK with gfortran using "-fdefault-real-8" to promote doubles to quads. ¿Maybe you can build LAPACK like this and then use it from NumPy? I don't know.

Of course, since this precision is actually simulated, the program got 10 times slower.

Sorry for not being more specific: I've not tried anything like this but I remembered the blog post and it may be enough for you to at least get started.

like image 22
jorgeca Avatar answered Sep 29 '22 20:09

jorgeca