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_complex_gen_matrix_exp (f01fc)

Purpose

nag_matop_complex_gen_matrix_exp (f01fc) computes the matrix exponential, eAeA, of a complex nn by nn matrix AA.

Syntax

[a, ifail] = f01fc(a, 'n', n)
[a, ifail] = nag_matop_complex_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, : :) – complex 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, : :) – complex 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).
With ifail = 0ifail=0, 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:
  ifail = 1ifail=1
The linear equations to be solved for the Padé approximant are singular; it is likely that this function has been called incorrectly.
  ifail = 2ifail=2
The linear equations to be solved are nearly singular and the Padé approximant probably has no correct figures; it is likely that this function has been called incorrectly.
  ifail = 3ifail=3
The arithmetic precision is higher than that used for the Padé approximant computed matrix exponential.
  ifail = 4ifail=4
An unexpected internal error has occurred. Please contact NAG.
  ifail = 1ifail=-1
Constraint: n0n0.
  ifail = 2ifail=-2
An internal error occurred when computing the Padé approximant. Please contact NAG.
  ifail = 3ifail=-3
Constraint: ldanldan.
  ifail = 999ifail=-999
Dynamic memory allocation failed.

Accuracy

For a normal matrix AA (for which AHA = AAHAHA=AAH) 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 in Higham (2008).
If estimates of the condition number of the matrix exponential are required then nag_matop_complex_gen_matrix_cond_std (f01ka) 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_complex_gen_matrix_exp_example
a = [ 1 + 1i,  2 + 1i,  2 + 1i,  2 + 1i;
      3 + 2i,  1 + 0i,  1 + 0i,  2 + 1i;
      3 + 2i,  2 + 1i,  1 + 0i,  2 + 1i;
      3 + 2i,  3 + 2i,  3 + 2i,  1 + 1i];
% Compute exp(a)
[aOut, ifail] = nag_matop_complex_gen_matrix_exp(a);
% Display results
[ifail] = nag_file_print_matrix_complex_gen('g', ' ', aOut, 'Exp(a)')
 
 Exp(a)
             1          2          3          4
 1   -157.9003  -194.6526  -186.5627  -155.7669
     -754.3717  -555.0507  -475.4533  -520.1876

 2   -206.8899  -225.4985  -212.4414  -186.5627
     -694.7443  -505.3938  -431.0611  -475.4533

 3   -208.7476  -238.4962  -225.4985  -194.6526
     -808.2090  -590.8045  -505.3938  -555.0507

 4   -133.3958  -208.7476  -206.8899  -157.9003
    -1085.5496  -808.2090  -694.7443  -754.3717

ifail =

                    0


function f01fc_example
a = [ 1 + 1i,  2 + 1i,  2 + 1i,  2 + 1i;
      3 + 2i,  1 + 0i,  1 + 0i,  2 + 1i;
      3 + 2i,  2 + 1i,  1 + 0i,  2 + 1i;
      3 + 2i,  3 + 2i,  3 + 2i,  1 + 1i];
% Compute exp(a)
[aOut, ifail] = f01fc(a);
% Display results
[ifail] = x04da('g', ' ', aOut, 'Exp(a)')
 
 Exp(a)
             1          2          3          4
 1   -157.9003  -194.6526  -186.5627  -155.7669
     -754.3717  -555.0507  -475.4533  -520.1876

 2   -206.8899  -225.4985  -212.4414  -186.5627
     -694.7443  -505.3938  -431.0611  -475.4533

 3   -208.7476  -238.4962  -225.4985  -194.6526
     -808.2090  -590.8045  -505.3938  -555.0507

 4   -133.3958  -208.7476  -206.8899  -157.9003
    -1085.5496  -808.2090  -694.7443  -754.3717

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