NAG C Library Function Document

nag_matop_real_gen_matrix_actexp (f01gac)


nag_matop_real_gen_matrix_actexp (f01gac) computes the action of the matrix exponential etA, on the matrix B, where A is a real n by n matrix, B is a real n by m matrix and t is a real scalar.


#include <nag.h>
#include <nagf01.h>
void  nag_matop_real_gen_matrix_actexp (Integer n, Integer m, double a[], Integer pda, double b[], Integer pdb, double t, NagError *fail)


etAB is computed using the algorithm described in Al–Mohy and Higham (2011) which uses a truncated Taylor series to compute the product etAB without explicitly forming etA.


Al–Mohy A H and Higham N J (2011) Computing the action of the matrix exponential, with an application to exponential integrators SIAM J. Sci. Statist. Comput. 33(2) 488-511
Higham N J (2008) Functions of Matrices: Theory and Computation SIAM, Philadelphia, PA, USA


1:     n IntegerInput
On entry: n, the order of the matrix A.
Constraint: n0.
2:     m IntegerInput
On entry: m, the number of columns of the matrix B.
Constraint: m0.
3:     a[dim] doubleInput/Output
Note: the dimension, dim, of the array a must be at least pda×n.
The i,jth element of the matrix A is stored in a[j-1×pda+i-1].
On entry: the n by n matrix A.
On exit: A is overwritten during the computation.
4:     pda IntegerInput
On entry: the stride separating matrix row elements in the array a.
Constraint: pdan.
5:     b[dim] doubleInput/Output
Note: the dimension, dim, of the array b must be at least pdb×m.
The i,jth element of the matrix B is stored in b[j-1×pdb+i-1].
On entry: the n by m matrix B.
On exit: the n by m matrix etAB.
6:     pdb IntegerInput
On entry: the stride separating matrix row elements in the array b.
Constraint: pdbn.
7:     t doubleInput
On entry: the scalar t.
8:     fail NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).

Error Indicators and Warnings

Dynamic memory allocation failed.
See Section in How to Use the NAG Library and its Documentation for further information.
On entry, argument value had an illegal value.
On entry, m=value.
Constraint: m0.
On entry, n=value.
Constraint: n0.
On entry, pda=value and n=value.
Constraint: pdan.
On entry, pdb=value and n=value.
Constraint: pdbn.
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
etAB has been computed using an IEEE double precision Taylor series, although the arithmetic precision is higher than IEEE double precision.


For a symmetric matrix A (for which AT=A) the computed matrix etAB is guaranteed to be close to the exact matrix, that is, the method is forward stable. No such guarantee can be given for non-symmetric matrices. See Section 4 of Al–Mohy and Higham (2011) for details and further discussion.

Parallelism and Performance

nag_matop_real_gen_matrix_actexp (f01gac) is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
nag_matop_real_gen_matrix_actexp (f01gac) makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the x06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

Further Comments

The matrix etAB could be computed by explicitly forming etA using nag_real_gen_matrix_exp (f01ecc) and multiplying B by the result. However, experiments show that it is usually both more accurate and quicker to use nag_matop_real_gen_matrix_actexp (f01gac).
The cost of the algorithm is On2m. The precise cost depends on A since a combination of balancing, shifting and scaling is used prior to the Taylor series evaluation.
Approximately n2+ 2m+8 n  of real allocatable memory is required by nag_matop_real_gen_matrix_actexp (f01gac).
nag_matop_complex_gen_matrix_actexp (f01hac) can be used to compute etAB for complex A, B, and t. nag_matop_real_gen_matrix_actexp_rcomm (f01gbc) provides an implementation of the algorithm with a reverse communication interface, which returns control to the user when matrix multiplications are required. This should be used if A is large and sparse.


This example computes etAB, where
A = 0.7 -0.2 1.0 0.3 0.3 0.7 1.2 1.0 0.9 0.0 0.2 0.7 2.4 0.1 0.0 0.2 ,  
B = 0.1 1.2 1.3 0.2 0.0 1.0 0.4 -0.9  
t=1.2 .  

Program Text

Program Text (f01gace.c)

Program Data

Program Data (f01gace.d)

Program Results

Program Results (f01gace.r)