PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_matop_real_gen_matrix_cond_usd (f01jc)
Purpose
nag_matop_real_gen_matrix_cond_usd (f01jc) computes an estimate of the absolute condition number of a matrix function at a real by matrix in the -norm, using analytical derivatives of you have supplied.
Syntax
[
a,
user,
iflag,
conda,
norma,
normfa,
ifail] = f01jc(
a,
f, 'n',
n, 'user',
user)
[
a,
user,
iflag,
conda,
norma,
normfa,
ifail] = nag_matop_real_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_real_gen_matrix_cond_usd (f01jc) 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).
The function
, and the derivatives of
, are returned by function
f which, given an integer
, evaluates
at a number of (generally complex) points
, for
. For any
on the real line,
must also be real.
nag_matop_real_gen_matrix_cond_usd (f01jc) is therefore appropriate for functions that can be evaluated on the complex plane and whose derivatives, of arbitrary order, can also be evaluated on the complex plane.
References
Higham N J (2008) Functions of Matrices: Theory and Computation SIAM, Philadelphia, PA, USA
Parameters
Compulsory Input Parameters
- 1:
– double 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_real_gen_matrix_cond_usd (f01jc) with the object supplied to
nag_matop_real_gen_matrix_cond_usd (f01jc).
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_real_gen_matrix_cond_usd (f01jc) will terminate the computation, with
.
- 2:
– complex array
-
The function or derivative values.
should return the value , for . If lies on the real line, then so must .
- 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_real_gen_matrix_cond_usd (f01jc), 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:
– double 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_real_gen_matrix_fun_usd (f01em) with the matrix
and the function
.
-
-
iflag has been set nonzero by the user-supplied function.
-
-
On entry, .
Input argument number is invalid.
-
-
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_real_gen_matrix_cond_usd (f01jc) uses the norm estimation routine
nag_linsys_real_gen_norm_rcomm (f04yd) to estimate a quantity
, where
and
. For further details on the accuracy of norm estimation, see the documentation for
nag_linsys_real_gen_norm_rcomm (f04yd).
Further Comments
The matrix function is computed using the underlying matrix function routine
nag_matop_real_gen_matrix_fun_usd (f01em). Approximately
of real allocatable memory is required by the routine, in addition to the memory used by the underlying matrix function routine.
If only is required, without an estimate of the condition number, then it is far more efficient to use the underlying matrix function routine directly.
Example
This example estimates the absolute and relative condition numbers of the matrix function
where
Open in the MATLAB editor:
f01jc_example
function f01jc_example
fprintf('f01jc example results\n\n');
a = [ 0, -1, -1, 1;
-2, 0, 1, -1;
2, -1, 2, -2;
-1, -2, 0, -1];
[a, user, iflag, conda, norma, normfa, ifail] = ...
f01jc(a, @fexp2);
fprintf('\nf(A) = exp(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] = fexp2(m, iflag, nz, z, user)
fz = 2^double(m)*exp(2*z);
f01jc example results
f(A) = exp(2A)
Estimated absolute condition number is: 183.90
Estimated relative condition number is: 13.90
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015