PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_matop_complex_gen_matrix_cond_usd (f01kc)
Purpose
nag_matop_complex_gen_matrix_cond_usd (f01kc) computes an estimate of the absolute condition number of a matrix function of a complex by matrix in the -norm, using analytical derivatives of you have supplied.
Syntax
[
a,
user,
iflag,
conda,
norma,
normfa,
ifail] = f01kc(
a,
f, 'n',
n, 'user',
user)
[
a,
user,
iflag,
conda,
norma,
normfa,
ifail] = nag_matop_complex_gen_matrix_cond_usd(
a,
f, 'n',
n, 'user',
user)
Description
The absolute condition number of
at
,
is given by the norm of the Fréchet derivative of
,
, which is defined by
where
is the Fréchet derivative in the direction
.
is linear in
and can therefore be written as
where the
operator stacks the columns of a matrix into one vector, so that
is
.
nag_matop_complex_gen_matrix_cond_usd (f01kc) computes an estimate
such that
, where
. The relative condition number can then be computed via
The algorithm used to find
is detailed in Section 3.4 of
Higham (2008).
References
Higham N J (2008) Functions of Matrices: Theory and Computation SIAM, Philadelphia, PA, USA
Parameters
Compulsory Input Parameters
- 1:
– 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 matrix .
- 2:
– function handle or string containing name of m-file
-
Given an integer
, the function
f evaluates
at a number of points
.
[iflag, fz, user] = f(m, iflag, nz, z, user)
Input Parameters
- 1:
– int64int32nag_int scalar
-
The order,
, of the derivative required.
If , should be returned. For , should be returned.
- 2:
– int64int32nag_int scalar
-
- 3:
– int64int32nag_int scalar
-
, the number of function or derivative values required.
- 4:
– complex array
-
The points at which the function is to be evaluated.
- 5:
– Any MATLAB object
f is called from
nag_matop_complex_gen_matrix_cond_usd (f01kc) with the object supplied to
nag_matop_complex_gen_matrix_cond_usd (f01kc).
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. If
iflag is returned as nonzero then
nag_matop_complex_gen_matrix_cond_usd (f01kc) will terminate the computation, with
.
- 2:
– complex array
-
The function or derivative 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_gen_matrix_cond_usd (f01kc), 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
.
The by matrix, .
- 2:
– Any MATLAB object
- 3:
– int64int32nag_int scalar
-
, unless
iflag has been set nonzero inside
f, in which case
iflag will be the value set and
ifail will be set to
.
- 4:
– double scalar
-
An estimate of the absolute condition number of at .
- 5:
– double scalar
-
The -norm of .
- 6:
– double scalar
-
The -norm of .
- 7:
– 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:
-
-
An internal error occurred when estimating the norm of the Fréchet derivative of
at
. Please contact
NAG.
-
-
An internal error occurred when evaluating the matrix function
. You can investigate further by calling
nag_matop_complex_gen_matrix_fun_usd (f01fm) with the matrix
and the function
.
-
-
iflag has been set nonzero by the user-supplied function.
-
-
On entry, .
-
-
On entry, argument lda is invalid.
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
nag_matop_complex_gen_matrix_cond_usd (f01kc) uses the norm estimation function
nag_linsys_complex_gen_norm_rcomm (f04zd) to estimate a quantity
, where
and
. For further details on the accuracy of norm estimation, see the documentation for
nag_linsys_complex_gen_norm_rcomm (f04zd).
Further Comments
Approximately
of complex allocatable memory is required by the routine, in addition to the memory used by the underlying matrix function routine
nag_matop_complex_gen_matrix_fun_usd (f01fm).
nag_matop_complex_gen_matrix_cond_usd (f01kc) returns the matrix function
. This is computed using
nag_matop_complex_gen_matrix_fun_usd (f01fm). If only
is required, without an estimate of the condition number, then it is far more efficient to use
nag_matop_complex_gen_matrix_fun_usd (f01fm) directly.
Example
This example estimates the absolute and relative condition numbers of the matrix function
where
Open in the MATLAB editor:
f01kc_example
function f01kc_example
fprintf('f01kc example results\n\n');
a = [1+1i, 0+1i, 1+0i, 2+0i;
0+0i, 2+0i, 0+2i, 1+0i;
0+1i, 0+1i, 0+0i, 2+0i;
1+0i, 0+1i, 1+0i, 0+1i];
[a, user, iflag, conda, norma, normfa, ifail] = ...
f01kc(a, @fexp3);
fprintf('\nf(A) = exp(3A)\n');
fprintf('Estimated absolute condition number is: %7.2f\n', conda);
eps = x02aj;
if normfa > eps
cond_rel = conda*norma/normfa;
fprintf('Estimated relative condition number is: %7.2f\n', cond_rel);
else
fprintf('The estimated norm of f(A) is effectively zero;\n');
fprintf('the relative condition number is therefore undefined.\n');
end
function [iflag, fz, user] = fexp3(m, iflag, nz, z, user)
fz = 3^double(m)*exp(3*z);
f01kc example results
f(A) = exp(3A)
Estimated absolute condition number is: 9474.43
Estimated relative condition number is: 13.74
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015