PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_matop_complex_herm_matrix_fun (f01ff)
Purpose
nag_matop_complex_herm_matrix_fun (f01ff) computes the matrix function, , of a complex Hermitian by matrix . must also be a complex Hermitian matrix.
Syntax
Description
is computed using a spectral factorization of
where
is the real diagonal matrix whose diagonal elements,
, are the eigenvalues of
,
is a unitary matrix whose columns are the eigenvectors of
and
is the conjugate transpose of
.
is then given by
where
is the diagonal matrix whose
th diagonal element is
. See for example Section 4.5 of
Higham (2008).
is assumed to be real.
References
Higham N J (2008) Functions of Matrices: Theory and Computation SIAM, Philadelphia, PA, USA
Parameters
Compulsory Input Parameters
- 1:
– string (length ≥ 1)
-
If
, the upper triangle of the matrix
is stored.
If , the lower triangle of the matrix is stored.
Constraint:
or .
- 2:
– complex array
-
The first dimension of the array
a must be at least
.
The second dimension of the array
a must be at least
.
The
by
Hermitian matrix
.
- If , the upper triangular part of must be stored and the elements of the array below the diagonal are not referenced.
- If , the lower triangular part of must be stored and the elements of the array above the diagonal are not referenced.
- 3:
– function handle or string containing name of m-file
-
The function
f evaluates
at a number of points
.
[iflag, fx, user] = f(iflag, n, x, user)
Input Parameters
- 1:
– int64int32nag_int scalar
-
- 2:
– int64int32nag_int scalar
-
, the number of function values required.
- 3:
– double array
-
The points at which the function is to be evaluated.
- 4:
– Any MATLAB object
f is called from
nag_matop_complex_herm_matrix_fun (f01ff) with the object supplied to
nag_matop_complex_herm_matrix_fun (f01ff).
Output Parameters
- 1:
– int64int32nag_int scalar
-
iflag should either be unchanged from its entry value of zero, or may be set nonzero to indicate that there is a problem in evaluating the function
; for instance
may not be defined, or may be complex. If
iflag is returned as nonzero then
nag_matop_complex_herm_matrix_fun (f01ff) will terminate the computation, with
.
- 2:
– double array
-
The function values.
should return the value , for .
- 3:
– Any MATLAB object
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the first dimension of the array
a.
, the order of the matrix .
Constraint:
.
- 2:
– Any MATLAB object
user is not used by
nag_matop_complex_herm_matrix_fun (f01ff), but is passed to
f. Note that for large objects it may be more efficient to use a global variable which is accessible from the m-files than to use
user.
Output Parameters
- 1:
– complex array
-
The first dimension of the array
a will be
.
The second dimension of the array
a will be
.
If , the upper or lower triangular part of the by matrix function, .
- 2:
– Any MATLAB object
- 3:
– int64int32nag_int scalar
-
, unless you have set
iflag nonzero inside
f, in which case
iflag will be the value you set and
ifail will be set to
.
- 4:
– 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:
-
-
The computation of the spectral factorization failed to converge.
-
-
Constraint: or .
-
-
Constraint: .
-
-
An internal error occurred when computing the spectral factorization. Please contact
NAG.
-
-
Constraint: .
-
-
iflag was set to a nonzero value in
f.
-
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
Provided that
can be computed accurately then the computed matrix function will be close to the exact matrix function. See Section 10.2 of
Higham (2008) for details and further discussion.
Further Comments
The integer allocatable memory required is
n, the double allocatable memory required is
and the complex allocatable memory required is approximately
, where
nb is the block size required by
nag_lapack_zheev (f08fn).
The cost of the algorithm is
plus the cost of evaluating
.
If
is the
th computed eigenvalue of
, then the user-supplied function
f will be asked to evaluate the function
at
, for
.
For further information on matrix functions, see
Higham (2008).
nag_matop_real_symm_matrix_fun (f01ef) can be used to find the matrix function
for a real symmetric matrix
.
Example
This example finds the matrix cosine,
, of the Hermitian matrix
Open in the MATLAB editor:
f01ff_example
function f01ff_example
fprintf('f01ff example results\n\n');
uplo = 'u';
a = [ 1, 2 + 1i, 3 + 2i, 4 + 3i;
0, 1 + 0i, 2 + 1i, 3 + 2i;
0, 0, 1 + 0i, 2 + 1i;
0, 0, 0, 1 + 0i];
[cosa, user, iflag, ifail] = ...
f01ff(uplo, a, @f);
[ifail] = x04da( ...
uplo, 'n', cosa, 'Hermitian f(A) = cos(A)');
function [iflag, fx, user] = f(iflag, n, x, user)
fx = cos(x);
f01ff example results
Hermitian f(A) = cos(A)
1 2 3 4
1 0.0904 -0.3377 -0.1009 -0.1092
0.0000 -0.0273 -0.0594 -0.1586
2 0.4265 -0.3139 -0.1009
0.0000 -0.0273 -0.0594
3 0.4265 -0.3377
0.0000 -0.0273
4 0.0904
0.0000
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015