PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_matop_complex_gen_matrix_cond_num (f01kb)
Purpose
nag_matop_complex_gen_matrix_cond_num (f01kb) computes an estimate of the absolute condition number of a matrix function of a complex by matrix in the -norm. Numerical differentiation is used to evaluate the derivatives of when they are required.
Syntax
[
a,
user,
iflag,
conda,
norma,
normfa,
ifail] = f01kb(
a,
f, 'n',
n, 'user',
user)
[
a,
user,
iflag,
conda,
norma,
normfa,
ifail] = nag_matop_complex_gen_matrix_cond_num(
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_num (f01kb) 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
-
The function
f evaluates
at a number of points
.
[iflag, fz, user] = f(iflag, nz, z, user)
Input Parameters
- 1:
– int64int32nag_int scalar
-
- 2:
– int64int32nag_int scalar
-
, the number of function values required.
- 3:
– complex array
-
The points at which the function is to be evaluated.
- 4:
– Any MATLAB object
f is called from
nag_matop_complex_gen_matrix_cond_num (f01kb) with the object supplied to
nag_matop_complex_gen_matrix_cond_num (f01kb).
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_num (f01kb) will terminate the computation, with
.
- 2:
– complex 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_gen_matrix_cond_num (f01kb), 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 while evaluating the matrix function
. You can investigate further by calling
nag_matop_complex_gen_matrix_fun_num (f01fl) 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_num (f01kb) 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_num (f01fl).
nag_matop_complex_gen_matrix_cond_num (f01kb) returns the matrix function
. This is computed using
nag_matop_complex_gen_matrix_fun_num (f01fl). 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_num (f01fl) directly.
Example
This example estimates the absolute and relative condition numbers of the matrix function
where
Open in the MATLAB editor:
f01kb_example
function f01kb_example
fprintf('f01kb example results\n\n');
a = [2+0i, 0+1i, 1+1i, 0+3i;
1+1i, 0+2i, 2+2i, 0+0i;
0+0i, 2+0i, 1+2i, 1+0i;
1+1i, 3+0i, 0+0i, 1+2i];
[a, user, iflag, conda, norma, normfa, ifail] = ...
f01kb(a, @fsin2);
fprintf('\nf(A) = sin(2A)\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] = fsin2(iflag, nz, z, user)
fz = sin(2*z);
f01kb example results
f(A) = sin(2A)
Estimated absolute condition number is: 2016.99
Estimated relative condition number is: 12.86
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015