A MATLAB Tool for the Stable Generation of Matrix Polynomial Evaluation Schemes with Two-Product Savings

The efficient evaluation of high-degree matrix polynomials is central to the numerical approximation of matrix functions. For decades, the Paterson–Stockmeyer (PS) method has provided the standard benchmark for reducing the number of matrix–matrix multiplications required by these computations. Recent theoretical advances, however, have shown that further savings are possible through evaluation schemes that eliminate two matrix products (2M) relative to the classical approach. Despite this progress, numerically stable implementations of such schemes have remained largely restricted to a few specific polynomial degrees and applications.

Javier Ibáñez, Jorge Sastre, José M. Alonso, and Emilio Defez address this limitation by developing a software-assisted procedure that extends the 2M reduction to polynomials of degrees m∈{18,21,24,26,27,28} and to every degree m≥30, provided that the leading coefficient is nonzero. The main numerical challenge lies in determining the coefficients that define the evaluation schemes. These coefficients are obtained by solving systems of nonlinear equations, whose solutions may differ substantially in their numerical stability. The authors therefore introduce an automated verification procedure to identify and validate coefficient sets suitable for floating-point computations.

The central contribution is a MATLAB implementation that combines symbolic computation with variable-precision arithmetic to construct the reduced nonlinear systems, identify suitable solutions, assess their numerical stability, and estimate the precision required for reliable evaluation. Beyond the 2M cases, the framework also identifies polynomial degrees for which a one-product reduction is attainable, thereby extending the range of available evaluation strategies.

Numerical experiments involving several matrix functions show that the resulting schemes maintain accuracy comparable to that of the classical Paterson–Stockmeyer method and, in some cases, improve upon it, while consistently achieving the predicted reduction of two matrix–matrix multiplications. These results demonstrate that the proposed software provides a practical route from theoretical evaluation formulas to numerically reliable implementations, making the computational savings accessible to a substantially broader class of matrix polynomials.


Publication details


Main Contributions

  • Software procedure extending the two-matrix-product reduction to a broad range of polynomial degrees.
  • Automated verification routine for selecting numerically stable coefficient sets.
  • MATLAB implementation using variable-precision arithmetic and numerical validation on matrix functions.

Why This Matters

The reduction of two matrix–matrix multiplications represents both a theoretical and a practical improvement in the computational cost of evaluating high-degree polynomials. The developed tool makes this reduction reliably accessible across a broad range of polynomial degrees, potentially benefiting matrix function algorithms that rely on polynomial approximations.

A Systematic Framework for the Stable Evaluation of Matrix Polynomials with Product Savings

Evaluating high-degree matrix polynomials is a common task in matrix function approximation. A recently proposed evaluation scheme reduces the computational cost by one matrix multiplication (1M) compared with the Paterson–Stockmeyer (PS) method, offering a direct reduction in execution time for large matrices. The main difficulty, however, lies in determining suitable coefficients for these optimized formulas. Since they are obtained by solving nonlinear polynomial systems, several possible solutions may arise, with substantially different numerical stability properties. Selecting an unsuitable solution can lead to significant accuracy loss in floating-point arithmetic.

J. M. Alonso, J. Sastre, J. Ibáñez, and E. Defez address this issue by developing a systematic framework and its MATLAB implementation, MatrixPolEval1, for computing and validating stable coefficient sets for matrix polynomials of degrees m∈{8,10,12} and beyond. The framework automates coefficient selection using variable precision arithmetic (VPA) and assesses numerical stability through coefficient reconstruction errors, providing a reliability indicator for the expected accuracy. It also incorporates alternative evaluation structures to handle cases in which the original formulation fails to provide a robust solution, including degenerate configurations that require separate treatment.

Numerical experiments involving matrix polynomials arising in applications such as the matrix exponential and geometric series demonstrate that the proposed framework retains the one-multiplication advantage over the PS method while achieving comparable numerical accuracy. These results provide a practical basis for applying multiplication-efficient evaluation schemes without compromising numerical reliability.


Publication Details


Main Contributions

  • A systematic framework for identifying stable coefficient sets in evaluation schemes that save one matrix multiplication.
  • MATLAB implementation (MatrixPolEval1), featuring variable-precision verification and a reliability indicator.
  • Numerical validation for polynomials of degrees 8, 10, 12, and higher, including applications to the matrix exponential and geometric series.

Why This Matters

Saving one matrix multiplication can directly reduce execution time in large-scale problems. The proposed framework facilitates the reliable use of these optimized schemes without compromising numerical stability.

Polynomial approximations for the matrix logarithm with computation graphs

Polynomial approximations for the matrix logarithm with computation graphs, E. Jarlebring, J. Sastre, J. Ibáñez, Linear Algebra Applications, in Press (open access), 2024. https://doi.org/10.1016/j.laa.2024.10.024, https://arxiv.org/abs/2401.10089, code.

In this article the matrix logarithm is computed by using matrix polynomial approximations evaluated by using matrix polynomial multiplications and additions. The most popular method for computing the matrix logarithm is a combination of the inverse scaling and squaring method in conjunction with a Padé approximation, sometimes accompanied by the Schur decomposition. The main computational effort lies in matrix-matrix multiplications and left matrix division. In this work we illustrate that the number of such operations can be substantially reduced, by using a graph based representation of an efficient polynomial evaluation scheme. A technique to analyze the rounding error is proposed, and backward error analysis is adapted. We provide substantial simulations illustrating competitiveness both in terms of computation time and rounding errors.

Efficient Evaluation of Matrix Polynomials beyond the Paterson–Stockmeyer Method

Efficient Evaluation of Matrix Polynomials beyond the Paterson–Stockmeyer Method (License CC BY 4.0), J. Sastre, J. Ibáñez, Mathematics 2021, 9(14), 1600; https://doi.org/10.3390/math9141600, Researchgate link

Two general methods for evaluating matrix polynomials requiring one matrix product less than the Paterson–Stockmeyer method were proposed in J. Sastre, Efficient evaluation of Matrix Polynomials, Linear Algebra Applications, where the cost of evaluating a matrix polynomial is given asymptotically by the total number of matrix product evaluations.

An analysis of the stability of those methods was given and the methods have been applied to Taylor-based implementations for computing the exponential, the cosine and the hyperbolic tangent matrix functions. Moreover, a particular example for the evaluation of the matrix exponential Taylor approximation of degree 15 requiring four matrix products was given, whereas the maximum polynomial degree available using Paterson–Stockmeyer method with four matrix products is 9.

Based on this example, a new family of methods for evaluating matrix polynomials more efficiently than the Paterson–Stockmeyer method was proposed, having the potential to achieve a much higher efficiency, i.e., requiring less matrix products for evaluating a matrix polynomial of certain degree, or increasing the available degree for the same cost. However, the difficulty of these family of methods lies in the calculation of the coefficients involved for the evaluation of general matrix polynomials and approximations.

In this paper, we provide a general matrix polynomial evaluation method for evaluating matrix polynomials requiring two matrix products less than the Paterson-Stockmeyer method for degrees higher than 30. Moreover, we provide general methods for evaluating matrix polynomial approximations of degrees 15 and 21 with four and five matrix product evaluations, respectively, whereas the maximum available degrees for the same cost with the Paterson–Stockmeyer method are 9 and 12, respectively. Finally, practical examples for evaluating Taylor approximations of the matrix cosine and the matrix logarithm accurately and efficiently with these new methods are given.

Advances in the Approximation of the Matrix Hyperbolic Tangent

Advances in the Approximation of the Matrix Hyperbolic Tangent (License CC BY 4.0), J. Ibáñez, J.M. Alonso, J. Sastre, E. Defez, P.A. Alonso, Mathematics 2021, 9(11), 1219; https://doi.org/10.3390/math9111219, Researchgate Link.

In this paper, we introduce two approaches to compute the matrix hyperbolic tangent. While one of them is based on its own definition and uses the matrix exponential, the other one is focused on the expansion of its Taylor series. For this second approximation, we analyse two different alternatives to evaluate the corresponding matrix polynomials. This resulted in three stable and accurate codes, which we implemented in MATLAB and numerically and computationally compared by means of a battery of tests composed of distinct state-of-the-art matrices.

Our results show that the Taylor series-based methods were more accurate, although somewhat more computationally expensive, compared with the approach based on the exponential matrix. To avoid this drawback, we propose the use of a set of formulas that allows us to evaluate polynomials in a more efficient way compared with that of the traditional Paterson–Stockmeyer method, thus, substantially reducing the number of matrix products (practically equal in number to the approach based on the matrix exponential), without penalising the accuracy of the result.

New matrix series expansions for the matrix cosine approximations

New matrix series expansions for the matrix cosine approximations, E. Defez, J. Ibáñez, P. Alonso, J.M. Alonso J. Peinado, and P. Alonso-Jordá, in the International Conference Mathematical Modelling in Engineering and Human Behaviour 2019,  Mathematical Modelling Conference Series at the Institute for Multidisciplinary Mathematics, Universitat Politècnica de València,  July, 10-12, 2019, Valencia (Spain).

An efficient and accurate algorithm for computing the matrix cosine based on New Hermite approximations

An efficient and accurate algorithm for computing the matrix cosine based on New Hermite approximations, E. Defez, J. Ibáñez, J. Peinado, J. Sastre and P. Alonso, Journal of Computational and Applied Mathematics, Volume 348, pp. 1-13. March 2019. https://doi.org/10.1016/j.cam.2018.08.047, Preprint, Matlab code cosmtayher.m.

In this work, we introduce new rational-polynomial Hermite matrix expansions which allow us to obtain a new accurate and efficient method for computing the matrix cosine. This method is compared with other state-of-the-art methods for computing the matrix cosine, including a method based on Padé approximants, showing a far superior efficiency, and higher accuracy. The algorithm implemented on the basis of this method can also be executed either in one or two NVIDIA GPUs, which demonstrates its great computational capacity.

Boosting the computation of the matrix exponential

Boosting the computation of the matrix exponential, J. Sastre, J. Ibáñez, E. Defez, Appl. Math. Comput. in press, 2018, doi:10.1016/j.amc.2018.08.017, Preprint, Matlab code expmpol.m.

This paper presents new Taylor algorithms for the computation of the matrix exponential based on recent new matrix polynomial evaluation methods. Those methods are more efficient than the well known Paterson–Stockmeyer method. The cost of the proposed algorithms is reduced with respect to previous algorithms based on Taylor approximations. Tests have been performed to compare the MATLAB implementations of the new algorithms to a state-of-the-art Padé algorithm for the computation of the matrix exponential, providing higher accuracy and cost performances.

First article with an application of the new matrix polynomial evaluation methods from J. Sastre, Efficient evaluation of matrix polynomials, Linear Algebra Appl. 539, (2018) 229-250. With the new matrix polynomial evaluation methods, Taylor approximation methods are more efficient than Padé approximant based methods.