Two Taylor Algorithms for Computing the Action of the Matrix Exponential on a Vector
<p>Experimental results for Set 1. (<b>a</b>) Normwise relative errors. (<b>b</b>) Performance profile. (<b>c</b>) Ratio of relative errors. (<b>d</b>) Lowest and highest relative error rate. (<b>e</b>) Polynomial, interpolation and subspace orders. (<b>f</b>) Ratio of matrix–vector products. (<b>g</b>) Execution time. (<b>h</b>) Ratio of execution time.</p> "> Figure 2
<p>Experimental results for Set 2. (<b>a</b>) Normwise relative errors. (<b>b</b>) Performance profile. (<b>c</b>) Ratio of relative errors. (<b>d</b>) Lowest and highest relative error rate. (<b>e</b>) Polynomial, interpolation and subspace orders. (<b>f</b>) Ratio of matrix–vector products. (<b>g</b>) Execution time. (<b>h</b>) Ratio of execution time.</p> "> Figure 3
<p>Experimental results for Set 3. (<b>a</b>) Normwise relative errors. (<b>b</b>) Performance profile. (<b>c</b>) Ratio of relative errors. (<b>d</b>) Lowest and highest relative error rate. (<b>e</b>) Polynomial, interpolation and subspace orders. (<b>f</b>) Ratio of matrix–vector products. (<b>g</b>) Execution time. (<b>h</b>) Ratio of execution time.</p> "> Figure 4
<p>Comparison of time (seconds) and performance (speed up) of <tt>expmvtay1</tt> and <tt>expmvtay2</tt> being executed on both a CPU and a GPU subsystems.</p> ">
Abstract
:1. Introduction
2. Algorithms for Computing the Action of the Matrix Exponential
Algorithm 1 Given a matrix , a vector , and minimum m and maximum M Taylor polynomial orders, , this algorithm computes by (5). |
|
Algorithm 2 Given a matrix , a vector , and minimum m and maximum M Taylor polynomial orders, , this algorithm computes by (5). |
|
3. Numerical Experiments
- expmvtay1: Implements the Algorithm 1, where absolute backward errors are assumed. The degree m of the Taylor polynomial used in the approximation will vary from 40 to 60. The maximum value allowed for the scaling parameter s, so as not to give rise to an excessively high number of matrix–vector products, will be equal to 45. The code is available at http://personales.upv.es/joalab/software/expmvtay1.m (accessed on 22 December 2021).
- expmvtay2: Based on Algorithm 2. As mentioned before, it attempts to reduce the number of matrix–vector products required by the code expmvtay1. It considers the same limits of m and s as the previous function. The implementation can be downloaded from http://personales.upv.es/joalab/software/expmvtay2.m (accessed on 22 December 2021).
- expmAvtay: Code where is firstly expressly computed, by using the function exptaynsv3 described in [26], and the matrix–vector product is then carried out. The code exptaynsv3 is based on a Taylor polynomial approximation to the matrix exponential function in combination with the scaling and squaring technique. The order m of the approximation polynomial will take values no greater than 30.
- expmv: This function, implemented by Al-mohy and Higham [17], computes without explicitly forming . It uses the scaling part of the scaling and squaring method together with a truncated Taylor series approximation to the matrix exponential.
- expm_newAv: Code that first explicitly calculates by means of the function expm_new, developed by Al-Mohy and Higham [27], and then multiplies it by the vector v to form . The function expm_new is based on Padé approximants and it implements an improved scaling and squaring algorithm.
- expleja: This code, based on the Leja interpolation method, computes the action of the matrix exponential of on a vector (or a matrix) v [28]. The result is similar to , but the matrix exponential is not explicitly worked out. In our experiments, H will be equal to 1 and default values of the tolerance will be provided.
- expv: Implementation of Sidje [23] that calculates by using Krylov subspace projection techniques with a fixed dimension for the corresponding subspace. It does not compute the matrix exponential in isolation but instead, it calculates directly the action of the exponential operator on the operand vector. The matrix under consideration interacts only via matrix–vector products (matrix-free method).
- (a)
- Set 1: One hundred diagonalizable complex matrices with the form , where D is a diagonal matrix with complex eigenvalues and V is an orthogonal matrix obtained as , being H a Hadamard matrix. The 2-norm of these randomly generated matrices varied from 0.1 to 339.4. The “exact” action of the matrix exponential of A on a vector v was calculated computing first (see [29], p. 10) and then .
- (b)
- Set 2: One hundred non-diagonalizable complex matrices generated as , where J is a Jordan matrix composed of complex eigenvalues with an algebraic multiplicity randomly varying between 1 and 3. V is an orthogonal matrix whose randomly obtained elements become progressively larger from one matrix to the next. The 2-norm of these matrices reached values from 3.76 to 323.59. The “exact” action of the matrix exponential on a vector was calculated as for the above set of matrices.
- (c)
- Set 3: Fifty matrices from the Matrix Computation Toolbox (MCT) [30] and twenty matrices from the Eigtool MATLAB Package (EMP) [31], all of them with a size. With the aim of calculating the “exact” action of the matrix exponential on a vector, the “exact” exponential function of each matrix A was initially computed according to the next algorithm consisting of the following three steps, employing the function vpa in each of them:
- Diagonalise the matrix A via the MATLAB function eig and obtain the matrices V and D such that . Then, the matrix will be computed as .
- Calculate the matrix exponential of A by means of the MATLAB function expm, i.e., .
- Take into account the “exact” matrix exponential of A only if:
Lastly, the “exact” action was worked out as , obviously again using the function vpa.Among the seventy-two matrices that initially constitute this third set, only forty-two of them (thirty-five from the MCT and seven from the EMP) could be satisfactorily processed in the numerical tests carried out. The 2-norm of these considered matrices ranged between 1 and 10,716. The reasons for the exclusion of the others are given below:- –
- The “exact” exponential function for matrices 4, 5, 10, 16, 17, 18, 21, 25, 26, 35, 40, 42, 43, 44, and 49 from the MCT and matrices 4, 6, 7, and 9 from the EMP could not be computed in accordance with the 3-step procedure previously described.
- –
- Matrices 2 and 15 incorporated in the MCT and matrices 1, 3, 5, 10, and 15 belonging to the EMP incurred in a very high relative error by some code, due to the ill-conditioning of these matrices.
- –
- Matrices 8, 11, 13, and 16 from the EMP were repeated, as they were also part of the MCT.
4. Algorithm Migration to a GPU-Based Computational Platform
5. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Gleich, D.F.; Kloster, K. Sublinear Column-wise Actions of the Matrix Exponential on Social Networks. Internet Math. 2015, 11, 352–384. [Google Scholar] [CrossRef]
- De la Cruz Cabrera, O.; Matar, M.; Reichel, L. Analysis of Directed Networks via the Matrix Exponential. J. Comput. Appl. Math. 2019, 355, 182–192. [Google Scholar] [CrossRef]
- De la Cruz Cabrera, O.; Matar, M.; Reichel, L. Centrality Measures for Node-weighted Networks via Line Graphs and the Matrix Exponential. Numer. Algorithms 2021, 88, 583–614. [Google Scholar] [CrossRef]
- Zhao, Y.L.; Ostermann, A.; Gu, X.M. A low-rank Lie-Trotter splitting approach for nonlinear fractional complex Ginzburg-Landau equations. J. Comput. Phys. 2021, 446, 110652. [Google Scholar] [CrossRef]
- Jian, H.Y.; Huang, T.Z.; Gu, X.M.; Zhao, Y.L. Fast compact implicit integration factor method with non-uniform meshes for the two-dimensional nonlinear Riesz space-fractional reaction-diffusion equation. Appl. Numer. Math. 2020, 156, 346–363. [Google Scholar] [CrossRef]
- Moler, C.; Van Loan, C. Nineteen Dubious Ways to Compute the Exponential of a Matrix, Twenty-Five Years Later. SIAM Rev. 2003, 45, 3–49. [Google Scholar] [CrossRef]
- Defez, E.; Ibáñez, J.; Alonso-Jordá, P.; Alonso, J.; Peinado, J. On Bernoulli matrix polynomials and matrix exponential approximation. J. Comput. Appl. Math. 2020, 404, 113207. [Google Scholar] [CrossRef]
- van den Eshof, J.; Frommer, A.; Lippert, T.; Schilling, K.; van der Vorst, H.A. Numerical methods for the QCDd overlap operator. I. Sign-function and error bounds. Comput. Phys. Commun. 2002, 146, 203–224. [Google Scholar] [CrossRef] [Green Version]
- Jian, H.Y.; Huang, T.Z.; Ostermann, A.; Gu, X.M.; Zhao, Y.L. Fast IIF–WENO Method on Non-uniform Meshes for Nonlinear Space-Fractional Convection–Diffusion–Reaction Equations. J. Sci. Comput. 2021, 89, 13. [Google Scholar] [CrossRef]
- Wang, S.; Peng, Z. Space-time parallel computation for time-domain Maxwell’s equations. In Proceedings of the 2017 International Conference on Electromagnetics in Advanced Applications (ICEAA), Verona, Italy, 11–15 September 2017; pp. 1680–1683. [Google Scholar]
- Reiman, C.; Das, D.; Rosenbaum, E. Discrete-Time Large-Signal Modeling and Numerical Methods for Flyback Converters. In Proceedings of the 2019 IEEE Power and Energy Conference at Illinois (PECI), Champaign, IL, USA, 28 February–1 March 2019; pp. 1–6. [Google Scholar]
- Araujo, E.S.; Pestana, R.C. Time evolution of the first-order linear acoustic/elastic wave equation using Lie product formula and Taylor expansion. Geophys. Prospect. 2021, 69, 70–84. [Google Scholar] [CrossRef]
- Kole, J. Solving seismic wave propagation in elastic media using the matrix exponential approach. Wave Motion 2003, 38, 279–293. [Google Scholar] [CrossRef] [Green Version]
- Falati, M.; Hojjati, G. Integration of chemical stiff ODEs using exponential propagation method. J. Math. Chem. 2011, 49, 2210–2230. [Google Scholar] [CrossRef]
- Hammoud, B.; Olivieri, L.; Righetti, L.; Carpentier, J.; Del Prete, A. Fast and accurate multi-body simulation with stiff viscoelastic contacts. arXiv 2021, arXiv:2101.06846. [Google Scholar]
- Caliari, M.; Kandolf, P.; Zivcovich, F. Backward error analysis of polynomial approximations for computing the action of the matrix exponential. BIT Numer. Math. 2018, 58, 907–935. [Google Scholar] [CrossRef]
- Al-Mohy, A.H.; Higham, N.J. Computing the Action of the Matrix Exponential, with an Application to Exponential Integrators. SIAM J. Sci. Comput. 2011, 33, 488–511. [Google Scholar] [CrossRef]
- Rostami, M.W.; Xue, F. Robust linear stability analysis and a new method for computing the action of the matrix exponential. SIAM J. Sci. Comput. 2018, 40, A3344–A3370. [Google Scholar] [CrossRef]
- Fischer, T.M. On the stability of some algorithms for computing the action of the matrix exponential. Linear Algebra Its Appl. 2014, 443, 1–20. [Google Scholar] [CrossRef]
- Fischer, T.M. On the algorithm by Al-Mohy and Higham for computing the action of the matrix exponential: A posteriori roundoff error estimation. Linear Algebra Its Appl. 2017, 531, 141–168. [Google Scholar] [CrossRef]
- Güttel, S.; Kressner, D.; Lund, K. Limited-memory polynomial methods for large-scale matrix functions. GAMM-Mitteilungen 2020, 43, e202000019. [Google Scholar]
- Caliari, M.; Kandolf, P.; Ostermann, A.; Rainer, S. Comparison of software for computing the action of the matrix exponential. BIT Numer. Math. 2014, 54, 113–128. [Google Scholar] [CrossRef]
- Sidje, R.B. Expokit: A Software Package for Computing Matrix Exponentials. ACM Trans. Math. Softw. (TOMS) 1998, 24, 130–156. [Google Scholar] [CrossRef]
- Zhu, X.; Li, C.; Gu, C. A new method for computing the matrix exponential operation based on vector valued rational approximations. J. Comput. Appl. Math. 2012, 236, 2306–2316. [Google Scholar] [CrossRef] [Green Version]
- Sastre, J.; Ibáñez, J.; Ruiz, P.; Defez, E. Accurate and efficient matrix exponential computation. Int. J. Comput. Math. 2013, 91, 97–112. [Google Scholar] [CrossRef]
- Ruiz, P.; Sastre, J.; Ibáñez, J.; Defez, E. High perfomance computing of the matrix exponential. J. Comput. Appl. Math. 2016, 291, 370–379. [Google Scholar] [CrossRef]
- Al-Mohy, A.H.; Higham, N.J. A New Scaling and Squaring Algorithm for the Matrix Exponential. SIAM J. Matrix Anal. Appl. 2009, 31, 970–989. [Google Scholar] [CrossRef] [Green Version]
- Caliari, M.; Kandolf, P.; Ostermann, A.; Rainer, S. The Leja Method Revisited: Backward Error Analysis for the Matrix Exponential. SIAM J. Sci. Comput. 2016, 38, A1639–A1661. [Google Scholar] [CrossRef]
- Higham, N.J. Functions of Matrices: Theory and Computation; Society for Industrial and Applied Mathematics: Philadelphia, PA, USA, 2008. [Google Scholar]
- Higham, N.J. The Matrix Computation Toolbox. 2002. Available online: http://www.ma.man.ac.uk/~higham/mctoolbox (accessed on 22 December 2021).
- Wright, T.G. Eigtool, Version 2.1. 2019. Available online: http://www.comlab.ox.ac.uk/pseudospectra/eigtool (accessed on 22 December 2021).
Computational Cost | Matrices to Be Stored | Vectors to Be Stored | |
---|---|---|---|
Algorithm 1 | 1 | ||
Algorithm 2 () | 1 | ||
Algorithm 2 () | 1 |
Set 1 | Set 2 | Set 3 | |
---|---|---|---|
Er(expmvtay1) < Er(expmvtay2) | 39% | 39% | 9.52% |
Er(expmvtay1) > Er(expmvtay2) | 36% | 38% | 9.52% |
Er(expmvtay1) = Er(expmvtay2) | 25% | 23% | 80.95% |
Er(expmvtay1) < Er(expmAvtay) | 69% | 65% | 61.90% |
Er(expmvtay1) > Er(expmAvtay) | 31% | 35% | 38.10% |
Er(expmvtay1) = Er(expmAvtay) | 0% | 0% | 0% |
Er(expmvtay1) < Er(expmv) | 69% | 58% | 61.90% |
Er(expmvtay1) > Er(expmv) | 31% | 42% | 38.10% |
Er(expmvtay1) = Er(expmv) | 0% | 0% | 0% |
Er(expmvtay1) < Er(expm_newAv) | 97% | 89% | 90.48% |
Er(expmvtay1) > Er(expm_newAv) | 3% | 11% | 9.52% |
Er(expmvtay1) = Er(expm_newAv) | 0% | 0% | 0% |
Er(expmvtay1) < Er(expleja) | 91% | 93% | 80.95% |
Er(expmvtay1) > Er(expleja) | 9% | 7% | 19.05% |
Er(expmvtay1) = Er(expleja) | 0% | 0% | 0% |
Er(expmvtay1) < Er(expv) | 100% | 98% | 88.10% |
Er(expmvtay1) > Er(expv) | 0% | 2% | 11.90% |
Er(expmvtay1) = Er(expv) | 0% | 0% | 0% |
Min. | Max. | Mean | Median | Std. Dev. | |
---|---|---|---|---|---|
expmvtay1 | |||||
expmvtay2 | |||||
expmAvtay | |||||
expmv | |||||
expm_newAv | |||||
expleja | |||||
expv | |||||
expmvtay1 | |||||
expmvtay2 | |||||
expmAvtay | |||||
expmv | |||||
expm_newAv | |||||
expleja | |||||
expv | |||||
expmvtay1 | |||||
expmvtay2 | |||||
expmAvtay | |||||
expmv | |||||
expm_newAv | |||||
expleja | |||||
expv |
m | s | |||||||
---|---|---|---|---|---|---|---|---|
Min. | Max. | Mean | Median | Min. | Max. | Mean | Median | |
expmvtay1 | 40 | 44 | 40.13 | 40.00 | 1 | 45 | 23.65 | 23.00 |
expmvtay2 | 40 | 58 | 45.07 | 44.00 | 1 | 43 | 17.77 | 20.00 |
expmAvtay | 9 | 30 | 27.54 | 30.00 | 0 | 7 | 5.29 | 6.00 |
expmv | 15 | 55 | 53.94 | 55.00 | 1 | 38 | 17.03 | 17.00 |
expm_newAv | 7 | 13 | 12.94 | 13.00 | 0 | 9 | 7.47 | 8.00 |
expleja | 16 | 100 | 97.63 | 99.00 | 1 | 9 | 4.40 | 4.50 |
expv | 30 | 30 | 30.00 | 30.00 | - | - | - | - |
expmvtay1 | 40 | 43 | 40.34 | 40.00 | 1 | 45 | 25.60 | 25.50 |
expmvtay2 | 40 | 58 | 45.85 | 44.00 | 1 | 44 | 19.08 | 21.00 |
expmAvtay | 25 | 30 | 27.50 | 27.50 | 0 | 7 | 5.50 | 6.00 |
expmv | 45 | 55 | 54.09 | 55.00 | 2 | 37 | 18.96 | 19.00 |
expm_newAv | 13 | 13 | 13.00 | 13.00 | 2 | 9 | 7.59 | 8.00 |
expleja | 66 | 100 | 98.05 | 99.00 | 2 | 11 | 5.80 | 5.00 |
expv | 30 | 30 | 30.00 | 30.00 | - | - | - | - |
expmvtay1 | 40 | 60 | 40.83 | 40.00 | 1 | 45 | 8.10 | 1.00 |
expmvtay2 | 40 | 60 | 41.52 | 40.00 | 1 | 45 | 7.26 | 1.00 |
expmAvtay | 12 | 30 | 25.45 | 25.00 | 0 | 8 | 2.07 | 0.00 |
expmv | 17 | 55 | 42.05 | 42.50 | 1 | 189 | 9.26 | 2.00 |
expm_newAv | 9 | 13 | 12.24 | 13.00 | 0 | 11 | 2.62 | 1.00 |
expleja | 18 | 100 | 65.48 | 72.00 | 1 | 583 | 105.44 | 6.00 |
expv | 30 | 30 | 30.00 | 30.00 | - | - | - | - |
Set 1 | Set 2 | Set 3 | |
---|---|---|---|
P(expmvtay1) | 95,292 | 104,037 | 15,240 |
P(expmvtay2) | 83,378 | 90,958 | 14,374 |
P(expmAvtay) | 207,195 | 210,389 | 64,988 |
P(expmv) | 108,172 | 116,018 | 17,985 |
P(expm_newAv) | 210,744 | 212,619 | 60,645 |
P(expleja) | 150,838 | 165,606 | 40,787 |
P(expv) | 2,490,385 | 3,663,677 | 1,278,078 |
Set 1 | Set 2 | Set 3 | |
---|---|---|---|
T(expmvtay1) | 2.53 | 2.80 | 3.01 |
T(expmvtay2) | 2.37 | 2.57 | 2.86 |
T(expmAvtay) | 3.89 | 3.89 | 23.29 |
T(expmv) | 4.56 | 4.79 | 4.34 |
T(expm_newAv) | 3.88 | 3.81 | 21.65 |
T(expleja) | 7.41 | 7.96 | 3.27 |
T(expv) | 444.14 | 648.40 | 72.89 |
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |
© 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Ibáñez, J.; Alonso, J.M.; Alonso-Jordá, P.; Defez, E.; Sastre, J. Two Taylor Algorithms for Computing the Action of the Matrix Exponential on a Vector. Algorithms 2022, 15, 48. https://doi.org/10.3390/a15020048
Ibáñez J, Alonso JM, Alonso-Jordá P, Defez E, Sastre J. Two Taylor Algorithms for Computing the Action of the Matrix Exponential on a Vector. Algorithms. 2022; 15(2):48. https://doi.org/10.3390/a15020048
Chicago/Turabian StyleIbáñez, Javier, José M. Alonso, Pedro Alonso-Jordá, Emilio Defez, and Jorge Sastre. 2022. "Two Taylor Algorithms for Computing the Action of the Matrix Exponential on a Vector" Algorithms 15, no. 2: 48. https://doi.org/10.3390/a15020048