hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_matop_complex_gen_matrix_cond_std (f01ka)

Purpose

nag_matop_complex_gen_matrix_cond_std (f01ka) computes an estimate of the absolute condition number of a matrix function ff at a complex nn by nn matrix AA in the 11-norm, where ff is either the exponential, logarithm, sine, cosine, hyperbolic sine (sinh) or hyperbolic cosine (cosh). The evaluation of the matrix function, f(A)f(A), is also returned.

Syntax

[a, conda, norma, normfa, ifail] = f01ka(fun, a, 'n', n)
[a, conda, norma, normfa, ifail] = nag_matop_complex_gen_matrix_cond_std(fun, a, 'n', n)

Description

The absolute condition number of ff at AA, condabs(f,A)condabs(f,A) is given by the norm of the Fréchet derivative of ff, L(A,E)L(A,E), which is defined by
L(X) := maxE0 (L(X,E))/(E) .
L(X) := maxE0 L(X,E) E .
The Fréchet derivative in the direction EE, L(X,E)L(X,E) is linear in EE and can therefore be written as
vec (L(X,E)) = K(X) vec(E) ,
vec ( L(X,E) ) = K(X) vec(E) ,
where the vecvec operator stacks the columns of a matrix into one vector, so that K(X)K(X) is n2 × n2n2×n2. nag_matop_complex_gen_matrix_cond_std (f01ka) computes an estimate γγ such that γ K(X)1 γ K(X) 1 , where K(X)1 [ n1 L(X)1 , n L(X)1 ] K(X) 1 [ n-1 L(X) 1 , n L(X) 1 ] . The relative condition number can then be computed via
condrel (f,A) = ( condabs (f,A) A1 )/(f(A)1) .
cond rel (f,A) = cond abs (f,A) A1 f(A) 1 .
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:     fun – string
Indicates which matrix function will be used.
fun = 'exp'fun='exp'
The matrix exponential, eAeA, will be used.
fun = 'sin'fun='sin'
The matrix sine, sin(A)sin(A), will be used.
fun = 'cos'fun='cos'
The matrix cosine, cos(A)cos(A), will be used.
fun = 'sinh'fun='sinh'
The hyperbolic matrix sine, sinh(A)sinh(A), will be used.
fun = 'cosh'fun='cosh'
The hyperbolic matrix cosine, cosh(A)cosh(A), will be used.
fun = 'log'fun='log'
The matrix logarithm, log(A)log(A), will be used.
Constraint: fun = 'exp'fun='exp', 'sin''sin', 'cos''cos', 'sinh''sinh', 'cosh''cosh' or 'log''log'.
2:     a(lda, : :) – complex array
The first dimension of the array a must be at least max (1,n)max(1,n)
The second dimension of the array must be at least nn
The nn by nn matrix AA.

Optional Input Parameters

1:     n – int64int32nag_int scalar
Default: The first dimension of the array a.
nn, the order of the matrix AA.
Constraint: n0n0.

Input Parameters Omitted from the MATLAB Interface

lda

Output Parameters

1:     a(lda, : :) – complex array
The first dimension of the array a will be max (1,n)max(1,n)
The second dimension of the array will be nn
ldamax (1,n)ldamax(1,n).
The nn by nn matrix, f(A)f(A).
2:     conda – double scalar
An estimate of the absolute condition number of ff at AA.
3:     norma – double scalar
The 11-norm of AA.
4:     normfa – double scalar
The 11-norm of f(A)f(A).
5:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

Error Indicators and Warnings

Errors or warnings detected by the function:
  ifail = 1ifail=1
An internal error occurred when estimating the norm of the Fréchet derivative of ff at AA. Please contact NAG.
  ifail = 2ifail=2
An internal error occurred when evaluating the matrix function f(A)f(A). You can investigate further by calling nag_matop_complex_gen_matrix_exp (f01fc), nag_matop_complex_gen_matrix_log (f01fj) or nag_matop_complex_gen_matrix_fun_std (f01fk) with the matrix AA.
  ifail = 1ifail=-1
On entry, fun = 'exp'fun='exp', 'sin''sin', 'cos''cos', 'sinh''sinh', 'cosh''cosh' or 'log''log'.
Input argument number __ is invalid.
  ifail = 2ifail=-2
On entry, n < 0n<0.
Input argument number __ is invalid.
  ifail = 4ifail=-4
On entry, parameter lda is invalid.
Constraint: ldanldan.
  ifail = 999ifail=-999
Allocation of memory failed.

Accuracy

nag_matop_complex_gen_matrix_cond_std (f01ka) uses the norm estimation function nag_linsys_complex_gen_norm_rcomm (f04zd) to estimate a quantity γγ, where γ K(X)1 γ K(X) 1  and K(X)1 [ n1 L(X)1 , n L(X)1 ] K(X) 1 [ n-1 L(X) 1 , n L(X) 1 ] . For further details on the accuracy of norm estimation, see the documentation for nag_linsys_complex_gen_norm_rcomm (f04zd).

Further Comments

Approximately 6n26n2 of complex allocatable memory is required by the routine, in addition to the memory used by the underlying matrix function routines nag_matop_complex_gen_matrix_exp (f01fc), nag_matop_complex_gen_matrix_log (f01fj) or nag_matop_complex_gen_matrix_fun_std (f01fk).
nag_matop_complex_gen_matrix_cond_std (f01ka) returns the matrix function f(A)f(A). This is computed using nag_matop_complex_gen_matrix_exp (f01fc) if fun = 'exp'fun='exp', nag_matop_complex_gen_matrix_log (f01fj) if fun = 'log'fun='log' and nag_matop_complex_gen_matrix_fun_std (f01fk) otherwise. If only f(A)f(A) is required, without an estimate of the condition number, then it is far more efficient to use nag_matop_complex_gen_matrix_exp (f01fc), nag_matop_complex_gen_matrix_log (f01fj) or nag_matop_complex_gen_matrix_fun_std (f01fk) directly.
nag_matop_real_gen_matrix_cond_std (f01ja) can be used to find the condition number of the exponential, logarithm, sine, cosine, sinh or cosh at a real matrix.

Example

function nag_matop_complex_gen_matrix_cond_std_example
a = [0+1i, -1+0i,  1+0i,  2+0i;
     2+1i,  0-1i,  0+0i,  1+0i;
     0+1i,  0+0i,  1+1i,  0+2i;
     1+0i,  2+0i, -2+3i,  0+1i];
fun = 'sinh';
% Find absolute condition number estimate
[a, conda, norma, normfa, ifail] = ...
    nag_matop_complex_gen_matrix_cond_std(fun, a);

fprintf('\nF(a) = %s(A)\n', fun);
fprintf('Estimated absolute condition number is: %7.2f\n', conda);

%  Find relative condition number estimate
eps = nag_machine_precision;
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 and so the\nrelative condition number is undefined.\n');
end
 

F(a) = sinh(A)
Estimated absolute condition number is:    7.33
Estimated relative condition number is:    4.94

function f01ka_example
a = [0+1i, -1+0i,  1+0i,  2+0i;
     2+1i,  0-1i,  0+0i,  1+0i;
     0+1i,  0+0i,  1+1i,  0+2i;
     1+0i,  2+0i, -2+3i,  0+1i];
fun = 'sinh';
% Find absolute condition number estimate
[a, conda, norma, normfa, ifail] = f01ka(fun, a);

fprintf('\nF(a) = %s(A)\n', fun);
fprintf('Estimated absolute condition number is: %7.2f\n', conda);

%  Find relative condition number estimate
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 and so the\nrelative condition number is undefined.\n');
end
 

F(a) = sinh(A)
Estimated absolute condition number is:    7.33
Estimated relative condition number is:    4.94


PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013