NAG Library Routine Document
F01HBF
1 Purpose
F01HBF computes the action of the matrix exponential , on the matrix , where is a complex by matrix, is a complex by matrix and is a complex scalar. It uses reverse communication for evaluating matrix products, so that the matrix is not accessed explicitly.
2 Specification
SUBROUTINE F01HBF ( |
IREVCM, N, M, B, LDB, T, TR, B2, LDB2, X, LDX, Y, LDY, P, R, Z, CCOMM, COMM, ICOMM, IFAIL) |
INTEGER |
IREVCM, N, M, LDB, LDB2, LDX, LDY, ICOMM(2*N+40), IFAIL |
REAL (KIND=nag_wp) |
COMM(3*N+14) |
COMPLEX (KIND=nag_wp) |
B(LDB,*), T, TR, B2(LDB2,*), X(LDX,*), Y(LDY,*), P(N), R(N), Z(N), CCOMM(N*(M+2)) |
|
3 Description
is computed using the algorithm described in
Al–Mohy and Higham (2011) which uses a truncated Taylor series to compute the
without explicitly forming
.
The algorithm does not explicity need to access the elements of ; it only requires the result of matrix multiplications of the form or . A reverse communication interface is used, in which control is returned to the calling program whenever a matrix product is required.
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 Parameters
Note: this routine uses
reverse communication. Its use involves an initial entry, intermediate exits and re-entries, and a final exit, as indicated by the
parameter IREVCM. Between intermediate exits and re-entries,
all parameters other than B2, X, Y, P and R must remain unchanged.
- 1: IREVCM – INTEGERInput/Output
On initial entry: must be set to .
On intermediate exit:
,
,
,
or
. The calling program must:
(a) |
if : evaluate , where is an by matrix, and store the result in B2;
if : evaluate , where and are by matrices, and store the result in Y;
if : evaluate and store the result in X;
if : evaluate and store the result in P;
if : evaluate and store the result in R. |
(b) |
call F01HBF again with all other parameters unchanged. |
On final exit: .
- 2: N – INTEGERInput
On entry: , the order of the matrix .
Constraint:
.
- 3: M – INTEGERInput
On entry: the number of columns of the matrix .
Constraint:
.
- 4: B(LDB,) – COMPLEX (KIND=nag_wp) arrayInput/Output
-
Note: the second dimension of the array
B
must be at least
.
On initial entry: the by matrix .
On intermediate exit:
if , contains the by matrix .
On intermediate re-entry: must not be changed.
On final exit: the by matrix .
- 5: LDB – INTEGERInput
On entry: the first dimension of the array
B as declared in the (sub)program from which F01HBF is called.
Constraint:
.
- 6: T – COMPLEX (KIND=nag_wp)Input
On entry: the scalar .
- 7: TR – COMPLEX (KIND=nag_wp)Input
-
On entry: the trace of
. If this is not available then any number can be supplied (
is a reasonable default); however, in the trivial case,
, the result
is immediately returned in the first row of
. See
Section 8.
- 8: B2(LDB2,) – COMPLEX (KIND=nag_wp) arrayInput/Output
-
Note: the second dimension of the array
B2
must be at least
.
On initial entry: need not be set.
On intermediate re-entry: if , must contain .
On final exit: the array is undefined.
- 9: LDB2 – INTEGERInput
On initial entry: the first dimension of the array
B2 as declared in the (sub)program from which F01HBF is called.
Constraint:
.
- 10: X(LDX,) – COMPLEX (KIND=nag_wp) arrayInput/Output
-
Note: the second dimension of the array
X
must be at least
.
On initial entry: need not be set.
On intermediate exit:
if , contains the current by matrix .
On intermediate re-entry: if , must contain .
On final exit: the array is undefined.
- 11: LDX – INTEGERInput
On entry: the first dimension of the array
X as declared in the (sub)program from which F01HBF is called.
Constraint:
.
- 12: Y(LDY,) – COMPLEX (KIND=nag_wp) arrayInput/Output
-
Note: the second dimension of the array
Y
must be at least
.
On initial entry: need not be set.
On intermediate exit:
if , contains the current by matrix .
On intermediate re-entry: if , must contain .
On final exit: the array is undefined.
- 13: LDY – INTEGERInput
On entry: the first dimension of the array
Y as declared in the (sub)program from which F01HBF is called.
Constraint:
.
- 14: P(N) – COMPLEX (KIND=nag_wp) arrayInput/Output
On initial entry: need not be set.
On intermediate re-entry: if , must contain .
On final exit: the array is undefined.
- 15: R(N) – COMPLEX (KIND=nag_wp) arrayInput/Output
On initial entry: need not be set.
On intermediate re-entry: if , must contain .
On final exit: the array is undefined.
- 16: Z(N) – COMPLEX (KIND=nag_wp) arrayInput/Output
On initial entry: need not be set.
On intermediate exit:
if or , contains the vector .
On intermediate re-entry: must not be changed.
On final exit: the array is undefined.
- 17: CCOMM() – COMPLEX (KIND=nag_wp) arrayCommunication Array
- 18: COMM() – REAL (KIND=nag_wp) arrayCommunication Array
- 19: ICOMM() – INTEGER arrayCommunication Array
- 20: IFAIL – INTEGERInput/Output
-
On entry:
IFAIL must be set to
,
. If you are unfamiliar with this parameter you should refer to
Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is
.
When the value is used it is essential to test the value of IFAIL on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6 Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Errors or warnings detected by the routine:
-
Note: this failure should not occur, and suggests that the routine has been called incorrectly. An unexpected internal error occurred when estimating a matrix norm.
-
An unexpected internal error has occurred. Please contact
NAG.
-
On initial entry, .
Constraint: .
On intermediate re-entry, .
Constraint: , , , or .
-
On initial entry, .
Constraint: .
-
On initial entry, .
Constraint: .
-
On initial entry, and .
Constraint: .
-
On initial entry, and .
Constraint: .
-
On initial entry, and .
Constraint: .
-
On initial entry, and .
Constraint: .
7 Accuracy
For an Hermitian matrix
(for which
) the computed matrix
is guaranteed to be close to the exact matrix, that is, the method is forward stable. No such guarantee can be given for non-Hermitian matrices. See Section 4 of
Al–Mohy and Higham (2011) for details and further discussion.
The elements of are not explicitly required by F01HBF. However, the trace of is used in the preprocessing phase of the algorithm. If is not available to the calling subroutine then any number can be supplied ( is recommended). This will not affect the stability of the algorithm, but it may reduce its efficiency.
F01HBF is designed to be used when is large and sparse. Whenever a matrix multiplication is required, the routine will return control to the calling program so that the multiplication can be done in the most efficient way possible. Note that will not, in general, be sparse even if is sparse.
If
is small and dense then
F01HAF can be used to compute
without the use of a reverse communication interface.
The real analog of F01HBF is
F01GBF.
To compute
, the following skeleton code can normally be used:
revcm: Do
Call F01HBF(IREVCM,N,M,B,LDB,T,TR,B2,LDB2,X,LDX,Y,LDX,P,R,Z, &
CCOMM,COMM,ICOMM,IFAIL)
If (IREVCM == 0) Then
Exit revcm
Else If (IREVCM == 1) Then
.. Code to compute B2=AB ..
Else If (IREVCM == 2) Then
.. Code to compute Y=AX ..
Else If (IREVCM == 3) Then
.. Code to compute X=A^H Y ..
Else If (IREVCM == 4) Then
.. Code to compute P=AZ ..
Else If (IREVCM == 5) Then
.. Code to compute R=A^H Z ..
End If
End Do revcm
The code used to compute the matrix products will vary depending on the way
is stored. If all the elements of
are stored explicitly, then
F06ZAF (ZGEMM) can be used. If
is triangular then
F06ZFF (ZTRMM) should be used. If
is Hermitian, then
F06ZCF (ZHEMM) should be used. If
is symmetric, then
F06ZTF (ZSYMM) should be used. For sparse
stored in coordinate storage format
F11XNF and
F11XSF can be used.
9 Example
This example computes
where
and
9.1 Program Text
Program Text (f01hbfe.f90)
9.2 Program Data
Program Data (f01hbfe.d)
9.3 Program Results
Program Results (f01hbfe.r)