NAG FL Interface
f01gaf (real_​gen_​matrix_​actexp)

1 Purpose

f01gaf 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.

2 Specification

Fortran Interface
Subroutine f01gaf ( n, m, a, lda, b, ldb, t, ifail)
Integer, Intent (In) :: n, m, lda, ldb
Integer, Intent (Inout) :: ifail
Real (Kind=nag_wp), Intent (In) :: t
Real (Kind=nag_wp), Intent (Inout) :: a(lda,*), b(ldb,*)
C Header Interface
#include <nag.h>
void  f01gaf_ (const Integer *n, const Integer *m, double a[], const Integer *lda, double b[], const Integer *ldb, const double *t, Integer *ifail)
The routine may be called by the names f01gaf or nagf_matop_real_gen_matrix_actexp.

3 Description

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.

4 References

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

5 Arguments

1: n Integer Input
On entry: n, the order of the matrix A.
Constraint: n0.
2: m Integer Input
On entry: m, the number of columns of the matrix B.
Constraint: m0.
3: alda* Real (Kind=nag_wp) array Input/Output
Note: the second dimension of the array a must be at least n.
On entry: the n by n matrix A.
On exit: A is overwritten during the computation.
4: lda Integer Input
On entry: the first dimension of the array a as declared in the (sub)program from which f01gaf is called.
Constraint: ldan.
5: bldb* Real (Kind=nag_wp) array Input/Output
Note: the second dimension of the array b must be at least m.
On entry: the n by m matrix B.
On exit: the n by m matrix etAB.
6: ldb Integer Input
On entry: the first dimension of the array b as declared in the (sub)program from which f01gaf is called.
Constraint: ldbn.
7: t Real (Kind=nag_wp) Input
On entry: the scalar t.
8: ifail Integer Input/Output
On entry: ifail must be set to 0, -1 or 1. If you are unfamiliar with this argument you should refer to Section 4 in the Introduction to the NAG Library FL Interface for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1 or 1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this argument, the recommended value is 0. When the value -1 or 1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6 Error Indicators and Warnings

If on entry ifail=0 or -1, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
ifail=2
etAB has been computed using an IEEE double precision Taylor series, although the arithmetic precision is higher than IEEE double precision.
ifail=-1
On entry, n=value.
Constraint: n0.
ifail=-2
On entry, m=value.
Constraint: m0.
ifail=-4
On entry, lda=value and n=value.
Constraint: ldan.
ifail=-6
On entry, ldb=value and n=value.
Constraint: ldbn.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7 Accuracy

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.

8 Parallelism and Performance

f01gaf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
f01gaf 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 routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9 Further Comments

The matrix etAB could be computed by explicitly forming etA using f01ecf and multiplying B by the result. However, experiments show that it is usually both more accurate and quicker to use f01gaf.
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 f01gaf.
f01haf can be used to compute etAB for complex A, B, and t. f01gbf 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.

10 Example

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  
and
t=1.2 .  

10.1 Program Text

Program Text (f01gafe.f90)

10.2 Program Data

Program Data (f01gafe.d)

10.3 Program Results

Program Results (f01gafe.r)