Multiprecision Computing Toolbox for MATLAB
The Multiprecision Computing Toolbox is the MATLAB extension for computing with arbitrary precision.
The toolbox equips MATLAB with a new multiple precision floating-point numeric type and extensive set of mathematical functions that are capable of computing with arbitrary precision.
The multiprecision numbers and matrices can be seamlessly used in place of the built-in
double entities following standard MATLAB syntax rules. As a result, existing MATLAB programs can be converted to run with arbitrary precision with no (or minimal) changes to source code.
Toolbox provides a comprehensive library of computational routines covering the following areas:
- Real and complex numbers, matrices and multidimensional arrays
- Elementary mathematical functions and constants
- Matrix analysis functions and solvers for linear system of equations
- Eigenvalues and eigenvectors (including generalized problem)
- Singular value decomposition
- Matrix and array functions
- Numerical integration (including full set of Gaussian quadrature)
- Optimization and polynomial roots finding
- Ordinary Differential Equations Solvers
- Data analysis and Fourier transforms
- Special functions
Please visit the Function Reference page for a complete list of supported functions.
Toolbox is highly optimized for quadruple precision computations and allows fast computing even for reasonably large matrices (
Core i7 930, 2.8GHz):
>> mp.Digits(34); % Set quadruple precision mode (34 decimal digits) >> A = mp(rand(100)); % Use 100 x 100 test matrix >> tic; svd(A); toc; % Compute singular values Elapsed time is 0.103123 seconds. >> tic; [U,S,V] = svd(A); toc; % Perform full SVD and do accuracy check Elapsed time is 0.516001 seconds. >> norm(A-U*S*V',1) 1.605428118251356861603279613248978e-31 >> tic; [V,D] = eig(A); toc; % Compute eigenvalues and vectors Elapsed time is 1.060912 seconds. >> norm(A*V - V*D,1) 3.520599938339867139386327679045247e-31 >> tic; [Q,R] = qr(A); toc; % Compute QR Decomposition Elapsed time is 0.179136 seconds. >> norm(A-Q*R,1) 4.758852521959335590660505497505944e-32
In quadruple precision mode toolbox is faster than Symbolic Math Toolbox by
The two plots below demonstrate the advantage of the Multiprecision Computing Toolbox when compared to the standard MATLAB. Figures 1 and 2 show the eigenvalues of the Grcar matrix computed by MATLAB and the Multiprecision Computing Toolbox, respectively.
The eigenvalues of the Grcar matrix are displayed in black, and the eigenvalues of the transposed Grcar matrix – in red. In theory they should coincide:
The toolbox removes MATLAB’s inherent limitation on computing precision, thus enabling the user to solve a variety of important problems previously impossible to handle with MATLAB:
- Allows solving of numerically unstable problems (e.g. solving of ill-conditioned matrices or finding roots of high-degree polynomials with high accuracy).
- Enables checking of accuracy of results by re-running existing MATLAB programs in extended precision.
- Minimizes rounding and cancellation errors in computations (e.g. summation of series with alternating signs).
- Allows computing of reference constants and coefficients of algorithms with high accuracy.
- Comprehensive set of mathematical functions. Multiprecision Computing Toolbox supplies arbitrary-precision analogs to the majority of the functions listed in the famous MATLAB Top 500, from simple arithmetic operations to advanced numerical algorithms (e.g.
fft, eig, svd, quad, ode45, fminsearch), and adds original functionality not available in MATLAB. Please visit the Function Reference page for a complete list of supported routines.
- Easy porting of existing MATLAB programs to arbitrary precision.
The Toolbox employs an operator overloading technique which allows easy porting of pre-existing programs to calculations done with arbitrary precision – with little or no modifications to the source code. In most cases the conversion is automatic, and no extra action is required by the user. For further examples, visit Arbitrary precision Gauss-Legendre Quadrature, Iterative Solver – GMRES, Gauss-Kronrod Quadrature.
- Algorithms. Multiprecision Computing Toolbox stands on the shoulders of giants – comprehensive open source libraries for matrix computations – LAPACK, Eigen with arbitrary precision support. Also, Toolbox utilizes the best multiprecision arithmetic engines available – GMP/MPIR, MPFR and MPC. They are the de facto standards for high quality algorithms, both in performance and accuracy.
- High-performance. Our product is developed using compiled programming languages C/C++ and Assembler with only a thin M-file interface for smooth integration to MATLAB. Toolbox is specifically optimized for computations with quadruple precision.
- Ease of access and user-friendliness.
We provide comprehensive instructions and step-by-step installation help, making it easy to install and use the Multiprecision Computing Toolbox. Both 32-bit and 64-bit versions are available for GNU Linux, Microsoft Windows, and Apple Mac OS X. The Quick Start User’s Manual, Function Reference, and our frequently updated Blog provide examples, tips, and announcements about our product.
We encourage inquiries – please contact us with any questions, suggestion, or other feedback.