PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_matop_complex_gen_matrix_actexp_rcomm (f01hb)
Purpose
nag_matop_complex_gen_matrix_actexp_rcomm (f01hb) 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.
Syntax
[
irevcm,
b,
b2,
x,
y,
p,
r,
z,
ccomm,
comm,
icomm,
ifail] = f01hb(
irevcm,
m,
b,
t,
b2,
x,
y,
p,
r,
z,
ccomm,
comm,
icomm, 'n',
n, 'tr',
tr)
[
irevcm,
b,
b2,
x,
y,
p,
r,
z,
ccomm,
comm,
icomm,
ifail] = nag_matop_complex_gen_matrix_actexp_rcomm(
irevcm,
m,
b,
t,
b2,
x,
y,
p,
r,
z,
ccomm,
comm,
icomm, 'n',
n, 'tr',
tr)
Note: the interface to this routine has changed since earlier releases of the toolbox:
At Mark 25: |
m was made optional |
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.
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
Parameters
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.
Compulsory Input Parameters
- 1:
– int64int32nag_int scalar
-
On initial entry: must be set to .
- 2:
– int64int32nag_int scalar
-
The number of columns of the matrix .
Constraint:
.
- 3:
– complex array
-
The first dimension of the array
b must be at least
.
The second dimension of the array
b must be at least
.
On initial entry: the by matrix .
On intermediate re-entry: must not be changed.
- 4:
– complex scalar
-
The scalar .
- 5:
– complex array
-
The first dimension of the array
b2 must be at least
.
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 .
- 6:
– complex array
-
The first dimension of the array
x must be at least
.
The second dimension of the array
x must be at least
.
On initial entry: need not be set.
On intermediate re-entry: if , must contain .
- 7:
– complex array
-
The first dimension of the array
y must be at least
.
The second dimension of the array
y must be at least
.
On initial entry: need not be set.
On intermediate re-entry: if , must contain .
- 8:
– complex array
-
On initial entry: need not be set.
On intermediate re-entry: if , must contain .
- 9:
– complex array
-
On initial entry: need not be set.
On intermediate re-entry: if , must contain .
- 10:
– complex array
-
On initial entry: need not be set.
On intermediate re-entry: must not be changed.
- 11:
– complex array
-
- 12:
– double array
-
- 13:
– int64int32nag_int array
-
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the first dimension of the arrays
b,
b2,
x,
y,
ccomm and the dimension of the arrays
p,
r,
z. (An error is raised if these dimensions are not equal.)
, the order of the matrix .
Constraint:
.
- 2:
– complex scalar
Default:
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
Further Comments.
Output Parameters
- 1:
– int64int32nag_int scalar
-
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 (f01hb) again with all other parameters unchanged. |
On final exit: .
- 2:
– complex array
-
The first dimension of the array
b will be
.
The second dimension of the array
b will be
.
On intermediate exit:
if , contains the by matrix .
On final exit: the by matrix .
- 3:
– complex array
-
The first dimension of the array
b2 will be
.
The second dimension of the array
b2 will be
.
On final exit: the array is undefined.
- 4:
– complex array
-
The first dimension of the array
x will be
.
The second dimension of the array
x will be
.
On intermediate exit:
if , contains the current by matrix .
On final exit: the array is undefined.
- 5:
– complex array
-
The first dimension of the array
y will be
.
The second dimension of the array
y will be
.
On intermediate exit:
if , contains the current by matrix .
On final exit: the array is undefined.
- 6:
– complex array
-
On final exit: the array is undefined.
- 7:
– complex array
-
On final exit: the array is undefined.
- 8:
– complex array
-
On intermediate exit:
if or , contains the vector .
On final exit: the array is undefined.
- 9:
– complex array
-
- 10:
– double array
-
- 11:
– int64int32nag_int array
-
- 12:
– int64int32nag_int scalar
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.
- W
-
has been computed using an IEEE double precision Taylor series, although the arithmetic precision is higher than IEEE double precision.
-
-
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: .
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
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.
Further Comments
Use of TrA
The elements of are not explicitly required by nag_matop_complex_gen_matrix_actexp_rcomm (f01hb). 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.
When to use nag_matop_complex_gen_matrix_actexp_rcomm (f01hb)
nag_matop_complex_gen_matrix_actexp_rcomm (f01hb) 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 (f01ha) can be used to compute
without the use of a reverse communication interface.
The real analog of
nag_matop_complex_gen_matrix_actexp_rcomm (f01hb) is
nag_matop_real_gen_matrix_actexp_rcomm (f01gb).
Use in Conjunction with NAG Toolbox Functions
To compute
, the following skeleton code can normally be used:
while irevcm ~= 0
switch irevcm
case {1}
% Compute ab and store in b2
case {2}
% Compute ax and store in y
case {3}
% Compute a^Hy and store in x
case {4}
% compute az and store in p
case {5}
% compute a^Hz and store in r
end
Example
This example computes
where
and
is stored in compressed column storage format (CCS) and matrix multiplications are performed using the function matmul.
Open in the MATLAB editor:
f01hb_example
function f01hb_example
fprintf('f01hb example results\n\n');
a = [0.7+0.8i, -0.2+0.0i, 1.0+0.0i, 0.6+0.5i;
0.3+0.7i, 0.7+0.0i, 0.9+3.0i, 1.0+0.8i;
0.3+3.0i, -7.0+0.0i, 0.2+0.6i, 0.7+0.5i;
0.0+0.9i, 4.0+0.0i, 0.0+0.0i, 0.2+0.0i];
b = [0.1+0.0i, 1.2+0.1i;
1.3+0.9i, -0.2+2.0i;
4.0+0.6i, -1.0+0.8i;
0.4+0.0i, -0.9+0.0i];
n = 4;
m = 2;
t = complex(1.1);
b2 = b; x = b; y = b;
p = complex(zeros(n, 1)); r = p; z = p;
comm = zeros(3*n+14, 1);
icomm = zeros(2*n+40, 1, 'int64');
ccomm = complex(zeros(n*(m+2), 1));
tr = trace(a);
irevcm = int64(0);
done = false;
while ~done
[irevcm, b, b2, x, y, p, r, z, ccomm, comm, icomm, ifail] = ...
f01hb( ...
irevcm, b, t, b2, x, y, p, r, z, ccomm, comm, icomm, 'tr', tr);
switch irevcm
case {0}
done = true;
case {1}
b2 = a*b;
case {2}
y = a*x;
case {3}
x = a'*y;
case {4}
p = a*z;
case {5}
r = a'*z;
end
end
fprintf('\n exp(tA)B\n');
disp(b);
f01hb example results
exp(tA)B
-15.3125 + 5.9123i -4.5605 - 2.4288i
12.3396 -50.6993i 9.2005 -10.3632i
-65.4353 +34.3271i -17.6075 - 1.0019i
45.6506 -28.3253i 11.3339 + 0.1127i
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015