hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_matop_real_gen_matrix_exp (f01ec)

Purpose

nag_matop_real_gen_matrix_exp (f01ec) computes the matrix exponential, eAeA, of a real nn by nn matrix AA.

Syntax

[a, ifail] = f01ec(a, 'n', n)
[a, ifail] = nag_matop_real_gen_matrix_exp(a, 'n', n)

Description

eAeA is computed using a Padé approximant and the scaling and squaring method described in Higham (2005) and Higham (2008).
If AA has a full set of eigenvectors VV then AA can be factorized as
A = V D V1 ,
A = V D V-1 ,
where DD is the diagonal matrix whose diagonal elements, didi, are the eigenvalues of AA. eAeA is then given by
eA = V eD V1 ,
eA = V eD V-1 ,
where eDeD is the diagonal matrix whose iith diagonal element is ediedi.
Note that eAeA is not computed this way as to do so would, in general, be unstable.

References

Higham N J (2005) The scaling and squaring method for the matrix exponential revisited SIAM J. Matrix Anal. Appl. 26(4) 1179–1193
Higham N J (2008) Functions of Matrices: Theory and Computation SIAM, Philadelphia, PA, USA
Moler C B and Van Loan C F (2003) Nineteen dubious ways to compute the exponential of a matrix, twenty-five years later SIAM Rev. 45 3–49

Parameters

Compulsory Input Parameters

1:     a(lda, : :) – double array
The first dimension of the array a must be at least max (1,n)max(1,n)
The second dimension of the array must be at least nn
The nn by nn matrix AA.

Optional Input Parameters

1:     n – int64int32nag_int scalar
Default: The first dimension of the array a.
nn, the order of the matrix AA.
Constraint: n0n0.

Input Parameters Omitted from the MATLAB Interface

lda

Output Parameters

1:     a(lda, : :) – double array
The first dimension of the array a will be max (1,n)max(1,n)
The second dimension of the array will be nn
ldamax (1,n)ldamax(1,n).
The nn by nn matrix exponential eAeA.
2:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

Error Indicators and Warnings

Errors or warnings detected by the function:

Cases prefixed with W are classified as warnings and do not generate an error of type NAG:error_n. See nag_issue_warnings.

  ifail < 0andifail4ifail<0andifail-4
If ifail = iifail=-i, the iith argument had an illegal value.
  ifail = 999ifail=-999
Allocation of memory failed. The integer allocatable memory required is n, and the double allocatable memory required is approximately 6 × n26×n2.
  ifail = 1ifail=1
Note: this failure should not occur, and suggests that the function has been called incorrectly.
The linear equations to be solved for the Padé approximant are singular.
  ifail = 2ifail=2
Note: this failure should not occur, and suggests that the function has been called incorrectly.
The linear equations to be solved are nearly singular and the Padé approximant probably has no correct figures.
W ifail = N + 2ifail=N+2
eAeA has been computed using an IEEE double precision Padé approximant, although the arithmetic precision is higher than IEEE double precision.

Accuracy

For a normal matrix AA (for which ATA = AATATA=AAT) the computed matrix, eAeA, is guaranteed to be close to the exact matrix, that is, the method is forward stable. No such guarantee can be given for non-normal matrices. See Section 10.3 of Higham (2008) for details and further discussion.
For discussion of the condition of the matrix exponential see Section 10.2 of Higham (2008).

Further Comments

The cost of the algorithm is O(n3)O(n3); see Algorithm 10.20 of Higham (2008).
If estimates of the condition number of the matrix exponential are required then nag_matop_real_gen_matrix_cond_std (f01ja) should be used.
As well as the excellent book cited above, the classic reference for the computation of the matrix exponential is Moler and Van Loan (2003).

Example

function nag_matop_real_gen_matrix_exp_example
a = [1, 2, 2, 2;
     3, 1, 1, 2;
     3, 2, 1, 2;
     3, 3, 3, 1];
[aOut, ifail] = nag_matop_real_gen_matrix_exp(a)
 

aOut =

  740.7038  610.8500  542.2743  549.1753
  731.2510  603.5524  535.0884  542.2743
  823.7630  679.4257  603.5524  610.8500
  998.4355  823.7630  731.2510  740.7038


ifail =

                    0


function f01ec_example
a = [1, 2, 2, 2;
     3, 1, 1, 2;
     3, 2, 1, 2;
     3, 3, 3, 1];
[aOut, ifail] = f01ec(a)
 

aOut =

  740.7038  610.8500  542.2743  549.1753
  731.2510  603.5524  535.0884  542.2743
  823.7630  679.4257  603.5524  610.8500
  998.4355  823.7630  731.2510  740.7038


ifail =

                    0



PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013