NAG Library Function Document
nag_matop_complex_gen_matrix_actexp_rcomm (f01hbc)
1 Purpose
nag_matop_complex_gen_matrix_actexp_rcomm (f01hbc) 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
#include <nag.h> |
#include <nagf01.h> |
void |
nag_matop_complex_gen_matrix_actexp_rcomm (Integer *irevcm,
Integer n,
Integer m,
Complex b[],
Integer pdb,
Complex t,
Complex tr,
Complex b2[],
Integer pdb2,
Complex x[],
Integer pdx,
Complex y[],
Integer pdy,
Complex p[],
Complex r[],
Complex z[],
Complex ccomm[],
double comm[],
Integer icomm[],
NagError *fail) |
|
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 Arguments
Note: this function uses
reverse communication. Its use involves an initial entry, intermediate exits and re-entries, and a final exit, as indicated by the
argument irevcm. Between intermediate exits and re-entries,
all arguments other than b2, x, y, p and r must remain unchanged.
- 1:
irevcm – Integer *Input/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 nag_matop_complex_gen_matrix_actexp_rcomm (f01hbc) 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[] – ComplexInput/Output
-
Note: the dimension,
dim, of the array
b
must be at least
.
The th element of the matrix is stored in .
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:
pdb – IntegerInput
-
On entry: the stride separating matrix row elements in the array
b.
Constraint:
.
- 6:
t – ComplexInput
On entry: the scalar .
- 7:
tr – ComplexInput
-
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 9.
- 8:
b2[] – ComplexInput/Output
-
Note: the dimension,
dim, of the array
b2
must be at least
.
The th element of the matrix is stored in .
On initial entry: need not be set.
On intermediate re-entry: if , must contain .
On final exit: the array is undefined.
- 9:
pdb2 – IntegerInput
-
On entry: the stride separating matrix row elements in the array
b2.
Constraint:
.
- 10:
x[] – ComplexInput/Output
-
Note: the dimension,
dim, of the array
x
must be at least
.
The th element of the matrix is stored in .
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:
pdx – IntegerInput
-
On entry: the stride separating matrix row elements in the array
x.
Constraint:
.
- 12:
y[] – ComplexInput/Output
-
Note: the dimension,
dim, of the array
y
must be at least
.
The th element of the matrix is stored in .
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:
pdy – IntegerInput
-
On entry: the stride separating matrix row elements in the array
y.
Constraint:
.
- 14:
p[n] – ComplexInput/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] – ComplexInput/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] – ComplexInput/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[] – ComplexCommunication Array
- 18:
comm[] – doubleCommunication Array
- 19:
icomm[] – IntegerCommunication Array
- 20:
fail – NagError *Input/Output
-
The NAG error argument (see
Section 3.6 in the Essential Introduction).
6 Error Indicators and Warnings
- NE_BAD_PARAM
-
On entry, argument had an illegal value.
- NE_INT
-
On entry, .
Constraint: .
On entry, .
Constraint: .
On initial entry, .
Constraint: .
On intermediate re-entry, .
Constraint: , , , or .
- NE_INT_2
-
On entry, and .
Constraint: .
On entry, and .
Constraint: .
On entry, and .
Constraint: .
On entry, and .
Constraint: .
- NE_INTERNAL_ERROR
-
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.
- NW_SOME_PRECISION_LOSS
-
has been computed using an IEEE double precision Taylor series, although the arithmetic precision is higher than IEEE double precision.
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.
8 Parallelism and Performance
Not applicable.
The elements of are not explicitly required by nag_matop_complex_gen_matrix_actexp_rcomm (f01hbc). However, the trace of is used in the preprocessing phase of the algorithm. If is not available to the calling function then any number can be supplied ( is recommended). This will not affect the stability of the algorithm, but it may reduce its efficiency.
nag_matop_complex_gen_matrix_actexp_rcomm (f01hbc) is designed to be used when is large and sparse. Whenever a matrix multiplication is required, the function 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
nag_matop_complex_gen_matrix_actexp (f01hac) can be used to compute
without the use of a reverse communication interface.
The real analog of nag_matop_complex_gen_matrix_actexp_rcomm (f01hbc) is
nag_matop_real_gen_matrix_actexp_rcomm (f01gbc).
To compute
, the following skeleton code can normally be used:
do {
f01hbc(&irevcm,n,m,b,tdb,t,tr,b2,tdb2,x,tdx,y,tdy,p,r,z,ccomm,comm, &
icomm,&fail);
if (irevcm == 1) {
.. Code to compute B2=AB ..
}
else if (irevcm == 2){
.. Code to compute Y=AX ..
}
else if (irevcm == 3){
.. Code to compute X=A^H Y ..
}
else if (irevcm == 4){
.. Code to compute P=AZ ..
}
else if (irevcm == 5){
.. Code to compute R=A^H Z ..
}
} (while irevcm !=0)
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
nag_zgemm (f16zac) can be used. If
is triangular then
nag_ztrmm (f16zfc) should be used. If
is Hermitian, then
nag_zhemm (f16zcc) should be used. If
is symmetric, then
nag_zsymm (f16ztc) should be used. For sparse
stored in coordinate storage format
nag_sparse_nherm_matvec (f11xnc) and
nag_sparse_herm_matvec (f11xsc) can be used. For sparse
stored in compressed column storage format (CCS) the program text of
Section 10 contains the function matmul to perform matrix products.
10 Example
This example computes
where
and
is stored in compressed column storage format (CCS) and matrix multiplications are performed using the function matmul.
10.1 Program Text
Program Text (f01hbce.c)
10.2 Program Data
Program Data (f01hbce.d)
10.3 Program Results
Program Results (f01hbce.r)