Recent papers citing the toolbox (updating):
- E. Carson and N. Higham, A New Analysis of Iterative Refinement and its Application to Accurate Solution of Ill-Conditioned Sparse Linear Systems, March 2017.
- B. Jin, B. Li, Z. Zhou, Correction of high-order BDF convolution quadrature for fractional evolution equations, March 28, 2017
- S. Sarra, The Matlab Radial Basis Function Toolbox, Journal of Open Research Software, March 27, 2017.
- A. Shirin, I. Klickstein, F. Sorrentino, Optimal control of complex networks: Balancing accuracy and energy of the control action, Chaos: An Interdisciplinary Journal of Nonlinear Science, Volume 27, Issue 4, April 2017.
- Á. Rózsás, Z. Mogyorósi, The effect of copulas on time-variant reliability involving time-continuous stochastic processes, Structural Safety, Volume 66, May 2017, Pages 94–105.
- C. Asplund, R.M. von Würtemberg, L. Höglund, Modeling Tools For Design Of Type-II Superlattice Photodetectors, Infrared Physics and Technology, 9 March 2017.
- E.J. Kansa, P. Holoborodko, On the ill-conditioned nature of C-inf RBF strong collocation, Engineering Analysis with Boundary Elements, Volume 78, May 2017, Pages 26–30.
- M. Capek, V. Losenicky, L. Jelinek, M. Gustafsson, Validating the Characteristic Modes Solvers, arXiv:1702.07037, February 24, 2017.
- D. Clamond, D. Dutykh, Accurate fast computation of steady two-dimensional surface gravity waves in arbitrary depth, February 13, 2017.
- G. Veneziano, S. Yankielovicz, E. Onofri, A model for pion-pion scattering in large-N QCD, arXiv:1701.06315, January 30, 2017.
- S. Sarra, S. Cogar, An examination of evaluation algorithms for the RBF method, Engineering Analysis with Boundary Elements, Volume 75, February 2017, Pages 36–45.
- M. Barel, F. Tisseur, Polynomial eigenvalue solver based on tropically scaled Lagrange linearization, The University of Manchester, December 25, 2016.
- C. Zanoci, B. Swingle, Entanglement and thermalization in open fermion systems, arXiv:1612.04840v1, 14 December 2016.
- W.T. de Carvalho, C.A. Aguilar, N.A. Dumont, Some issues in the generalized nonlinear eigenvalue analysis of time-dependent problems in the simplified boundary element. CILAMCE 2016 Proceedings of the XXXVII Iberian Latin-American Congress on Computational Methods in Engineering Suzana Moreira Ávila (Editor), ABMEC,Brasília, DF, Brazil, November 6-9, 2016.
Previous issues: digest v.8, digest v.7, digest v.6, digest v.5, digest v.4, digest v.3 and digest v.2.
MATLAB allows flexible adjustment of visibility of warning messages. Some, or even all, messages can be disabled from showing on the screen by
The little known fact is that status of some warnings may be used to change the execution path in algorithms. For example, if warning
'MATLAB:nearlySingularMatrix' is disabled, then linear system solver (operator MLDIVIDE) might skip estimation of reciprocal condition number which is used exactly for the purpose of detection of nearly singular matrices. If the trick is used, it allows
20%-50% boost in solver performance, since
rcond estimation is a time consuming process.
Therefore it is important to be able to retrieve status of warnings in MATLAB. Especially in MEX libraries targeted for improved performance. Unfortunately MATLAB provides no simple way to check status of warning message from MEX module.
Article outlines two workarounds for the issue.
In connection to our previous article on Architecture of linear systems solver we decided to outline structure of eigensolver implemented in our toolbox. As with linear system solver – we have plethora of algorithms targeted for matrices with specific properties. Toolbox analyses input matrices and automatically selects the best matching method to find the eigendecomposition.
Computational complexity of direct algorithms for solving linear systems of equations is O(n3). The only way to reduce enormous effect of cubic growth is to take advantage of various matrix properties and use specialized solvers1.
Toolbox follows this strategy by relying on poly-solver which automatically detects matrix properties and applies the best matching algorithm for the particular case. In this post we outline our solver architecture for full/dense matrices.
Poly-solver for dense input matrices (click on flowchart to see it in higher resolution):
Toolbox analyses the structure of input matrix, computes its bandwidth, checks symmetry/Hermitianity, determines permutation to convert matrix to trivial cases (diagonal or triangular) if possible. Then solver selects the most appropriate algorithm depending on matrix properties. Special attention is paid to n-diagonal matrices (banded), frequently encountered in solution of PDE.
Recent papers citing the toolbox:
- W. Gaddah, A higher-order finite-difference approximation with Richardson’s extrapolation to the energy eigenvalues of the quartic, sextic and octic anharmonic oscillators, European Journal of Physics, Volume 36, Number 3, 2015.
- M. Rahmanian, R.D. Firouz-Abadia, E. Cigeroglub. Dynamics and stability of conical/cylindrical shells conveying subsonic compressible fluid flows with general boundary conditions, November 11, 2016.
- S. Klickstein, A. Shirin, F. Sorrentino, Energy Scaling of Targeted Optimal Control of Complex Networks, Department of Mechanical Engineering, University of New Mexico, November 9, 2016.
- V. Druskin, S. Güttel, L. Knizhnerman, Compressing variable-coefficient exterior Helmholtz problems via RKFIT, November 2016.
- G. Wright, B. Fornberg, Stable computations with flat radial basis functions using vector-valued rational approximations, arXiv:1610.05374, October 17, 2016.
- J. Reeger, B. Fornberg, L. Watts, Numerical quadrature over smooth, closed surfaces, October 5, 2016.
- B. Fornberg, Fast calculation of Laurent expansions for matrix inverses. Journal of Computational Physics, September 15, 2016.
- L. Yan, J.P. Bouchaud, M. Wyart, Edge Mode Amplification in Disordered Elastic Networks, arXiv:1608.07222, August 25, 2016.
- N. Higham, P. Kandolf, Computing the Action of Trigonometric and Hyperbolic Matrix Functions, arXiv:1607.04012, July 14, 2016.
Previous issues: digest v.7, digest v.6, digest v.5, digest v.4, digest v.3 and digest v.2.
One of the main design goals of toolbox is ability to run existing scripts in extended precision with minimum changes to code itself. Thanks to object-oriented programming the goal is accomplished to great extent. Thus, for example, MATLAB decides which function to call (its own or from toolbox) based on type of input parameter, automatically and absolutely transparently to user:
>> A = rand(100); % create double-precision random matrix
>> B = mp(rand(100)); % create multi-precision random matrix
>> [U,S,V] = svd(A); % built-in functions are called for double-precision matrices
>> [U,S,V] = svd(B); % Same syntax, but now functions from toolbox are used
Syntax doesn’t change, allowing researcher to port code to multi-precision almost without modifications.
However there are several situations which are not handled automatically and it is not so obvious how to avoid manual changes:
- Conversion of constants, e.g.
1/3 -> mp('1/3'),
pi -> mp('pi'),
eps -> mp('eps').
- Creation of basic arrays, e.g.
zeros(...) -> mp(zeros(...)),
ones(...) -> mp(ones(...)).
In this post we want to show technique on how to handle these situations and write pure precision-independent code in MATLAB, so that no modifications are required at all. Code will be able to run with standard numeric types
'double'/'single' as well as with multi-precision numeric type
'mp' from toolbox.
Recent works citing the toolbox:
- D. Tkachenko, Global Identification in DSGE Models Allowing for Indeterminacy, July 12, 2016.
- T. Ogita, Y. Kobayashi, Accurate and efficient algorithm for solving ill-conditioned linear systems by preconditioning methods, Nonlinear Theory and Its Applications, IEICE Vol. 7 (2016) No. 3 pp. 374-385, July 1, 2016.
- T. Ogita, K. Aishima, Iterative Refinement for Symmetric Eigenvalue Decomposition Adaptively Using Higher-Precision Arithmetic, The University of Tokyo, June 2016.
Please note that timing results in two papers above are provided for
126.96.36.19959 version of toolbox. Newer versions (
>3.8.8) include multi-threaded MRRR algorithm for symmetric eigen-problems, which is 4-6 times faster depending on matrix size. The speed of linear system solver has been improved for 2-4 times s well.
- V. Oryshchenko, Exact mean integrated squared error of kernel distribution function estimators, The University of Manchester, June 22, 2016.
- L. Liu, D. W. Matolak, C. Tao, Y. Li, Sum-Rate Capacity Investigation of Multiuser Massive MIMO Uplink Systems in Semi-Correlated Channels, 2016 IEEE 83rd Vehicular Technology Conference, 15-18 May 2016.
Previous issues: digest v.6, digest v.5, digest v.4, digest v.3 and digest v.2.
There seems to be growing interest in how to detect user interrupt (
Ctrl-C) inside compiled MEX library. The main difficulty is that TheMathWorks provides no official API to recognize and handle the situation.
As a workaround, Wotao Yin found undocumented function
utIsInterruptPending which can be used to check if
Ctrl-C was pressed. The most obvious usage pattern is to include calls to the function in lengthy computational code (loops, etc.) and exit the computations if needed. Collection of various improvements on using
utIsInterruptPending can be found in recent Yair Altman’s post.
Unfortunately, despite all these efforts the most important issue was not addressed and was not resolved up to date – asynchronous handling of Ctrl-C.
In order to respond to user interrupt, source code of the MEX module have to be changed to include
utIsInterruptPending calls. Every sub-module, every loop of the code needs to be revised. This is not only time-consuming and error-prone process, but also makes pure computational code dependent on MEX API.
Most importantly, it is not possible to do all the modifications if MEX uses third-party libraries with no access to its source code.
The ideal solution would be to avoid any of the changes to computational code in MEX. Here we propose one of the ways to do so.
New version of toolbox includes a lot of updates released over the course of six months. We focused on speed, better support of sparse matrices, special functions and stability. Upgrade to the newest version is highly recommended as it contains critical updates for all platforms.
Short summary of changes:
- The Core
Recent works citing the toolbox:
- J. Rashidinia, G.E. Fasshauer, M. Khasi, A stable method for the evaluation of Gaussian radial basis function solutions of interpolation and collocation problems, Computers & Mathematics with Applications, Available online 21 May 2016.
- Aprahamian M., Theory and Algorithms for Periodic Functions of Matrices, PhD Thesis, The University of Manchester, May 16, 2016.
- Berljafa M., Güttel S., The FEAST algorithm for Hermitian eigenproblems, Accessed on May 12, 2016.
- S. Melkoumian, B. Protas, Drift Due to Two Obstacles in Different Arrangements, Journal of Theoretical and Computational Fluid Dynamics, May 6, 2016, Pages 1–14.
- Jussi Lehtonen, Geoff A. Parker and Lukas Schärer, Why anisogamy drives ancestral sex roles. Evolution: International Journal on Organic Evolution, May 5, 2016.
- M. Rahmanian, b, R.D. Firouz-Abadia, E. Cigeroglub. Free vibrations of moderately thick truncated conical shells filled with quiescent fluid, Journal of Fluids and Structures, Volume 63, May 2016, Pages 280–301.
- Isaac S. Klickstein, Afroza Shirin, and Francesco Sorrentino. Feasible Strategies to Target Complex Networks, Department of Mechanical Engineering, University of New Mexico, April 14, 2016.
- Z. Qu, D. Tkachenko, Global Identification in DSGE Models Allowing for Indeterminacy, April 5, 2016.
Previous issues: digest v.5, digest v.4, digest v.3 and digest v.2.