NAG Library Function Document
nag_linsys_real_gen_norm_rcomm (f04ydc)
1 Purpose
nag_linsys_real_gen_norm_rcomm (f04ydc) estimates the -norm of a real rectangular matrix without accessing the matrix explicitly. It uses reverse communication for evaluating matrix products. The function may be used for estimating condition numbers of square matrices.
2 Specification
#include <nag.h> |
#include <nagf04.h> |
void |
nag_linsys_real_gen_norm_rcomm (Integer *irevcm,
Integer m,
Integer n,
double x[],
Integer pdx,
double y[],
Integer pdy,
double *estnrm,
Integer t,
Integer seed,
double work[],
Integer iwork[],
NagError *fail) |
|
3 Description
nag_linsys_real_gen_norm_rcomm (f04ydc) computes an estimate (a lower bound) for the
-norm
of an
by
real matrix
. The function regards the matrix
as being defined by a user-supplied ‘Black Box’ which, given an
matrix
(with
) or an
matrix
, can return
or
. A reverse communication interface is used; thus control is returned to the calling program whenever a matrix product is required.
Note: this function is
not recommended for use when the elements of
are known explicitly; it is then more efficient to compute the
-norm directly from formula
(1) above.
The main use of the function is for estimating for a square matrix, , and hence the condition number , without forming explicitly ( above).
If, for example, an factorization of is available, the matrix products and required by nag_linsys_real_gen_norm_rcomm (f04ydc) may be computed by back- and forward-substitutions, without computing .
The function can also be used to estimate
-norms of matrix products such as
and
, without forming the products explicitly. Further applications are described by
Higham (1988).
Since , nag_linsys_real_gen_norm_rcomm (f04ydc) can be used to estimate the -norm of by working with instead of .
The algorithm used is described in
Higham and Tisseur (2000).
4 References
Higham N J (1988) FORTRAN codes for estimating the one-norm of a real or complex matrix, with applications to condition estimation ACM Trans. Math. Software 14 381–396
Higham N J and Tisseur F (2000) A block algorithm for matrix -norm estimation, with an application to -norm pseudospectra SIAM J. Matrix. Anal. Appl. 21 1185–1201
5 Arguments
Note: this function uses
reverse communication. Its use involves an initial entry, intermediate exits and re-entries, and a final exit, as indicated by the argument
irevcm. Between intermediate exits and re-entries,
all arguments other than x and y must remain unchanged.
- 1:
irevcm – Integer *Input/Output
-
On initial entry: must be set to .
On intermediate exit:
or
, and
x contains the
matrix
and
y contains the
matrix
.
The calling program must
(a) |
if , evaluate and store the result in y
or
if , evaluate and store the result in x, |
(b) |
call nag_linsys_real_gen_norm_rcomm (f04ydc) once again, with all the other arguments unchanged. |
On intermediate re-entry:
irevcm must be unchanged.
On final exit: .
- 2:
m – IntegerInput
On entry: the number of rows of the matrix .
Constraint:
.
- 3:
n – IntegerInput
On entry: , the number of columns of the matrix .
Constraint:
.
- 4:
x[] – doubleInput/Output
-
Note: the dimension,
dim, of the array
x
must be at least
.
The th element of the matrix is stored in .
On initial entry: need not be set.
On intermediate exit:
if , contains the current matrix .
On intermediate re-entry: if , must contain .
On final exit: the array is undefined.
- 5:
pdx – IntegerInput
-
On entry: the stride separating matrix row elements in the array
x.
Constraint:
.
- 6:
y[] – doubleInput/Output
-
Note: the dimension,
dim, of the array
y
must be at least
.
The th element of the matrix is stored in .
On initial entry: need not be set.
On intermediate exit:
if , contains the current matrix .
On intermediate re-entry: if , must contain .
On final exit: the array is undefined.
- 7:
pdy – IntegerInput
-
On entry: the stride separating matrix row elements in the array
y.
Constraint:
.
- 8:
estnrm – double *Input/Output
-
On initial entry: need not be set.
On intermediate re-entry: must not be changed.
On final exit: an estimate (a lower bound) for .
- 9:
t – IntegerInput
On entry: the number of columns
of the matrices
and
. This is an argument that can be used to control the accuracy and reliability of the estimate and corresponds roughly to the number of columns of
that are visited during each iteration of the algorithm.
If then a partly random starting matrix is used in the algorithm.
Suggested value:
.
Constraint:
.
- 10:
seed – IntegerInput
On entry: the seed used for random number generation.
If
,
seed is not used.
Constraint:
if , .
- 11:
work[] – doubleCommunication Array
- 12:
iwork[] – IntegerCommunication Array
-
On initial entry: need not be set.
On intermediate re-entry: must not be changed.
- 13:
fail – NagError *Input/Output
-
The NAG error argument (see
Section 3.6 in the Essential Introduction).
6 Error Indicators and Warnings
- NE_BAD_PARAM
-
On entry, argument had an illegal value.
- NE_INT
-
On entry, .
Constraint: , or .
On entry, .
Constraint: .
On entry, .
Constraint: .
On initial entry, .
Constraint: .
- NE_INT_2
-
On entry, and .
Constraint: .
On entry, and .
Constraint: .
On entry, and .
Constraint: .
On entry, and .
Constraint: if , .
- NE_INTERNAL_ERROR
-
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact
NAG for assistance.
7 Accuracy
In extensive tests on
random matrices of size up to
the estimate
estnrm has been found always to be within a factor two of
; often the estimate has many correct figures. However, matrices exist for which the estimate is smaller than
by an arbitrary factor; such matrices are very unlikely to arise in practice. See
Higham and Tisseur (2000) for further details.
8 Parallelism and Performance
Not applicable.
9.1 Timing
For most problems the time taken during calls to nag_linsys_real_gen_norm_rcomm (f04ydc) will be negligible compared with the time spent evaluating matrix products between calls to nag_linsys_real_gen_norm_rcomm (f04ydc).
The number of matrix products required depends on the matrix . At most six products of the form and five products of the form will be required. The number of iterations is independent of the choice of .
9.2 Overflow
It is your responsibility to guard against potential overflows during evaluation of the matrix products. In particular, when estimating using a triangular factorization of , nag_linsys_real_gen_norm_rcomm (f04ydc) should not be called if one of the factors is exactly singular – otherwise division by zero may occur in the substitutions.
9.3 Choice of
The argument controls the accuracy and reliability of the estimate. For , the algorithm behaves similarly to the LAPACK estimator xLACON. Increasing typically improves the estimate, without increasing the number of iterations required.
For
, random matrices are used in the algorithm, so for repeatable results the same value of
seed should be used each time.
A value of is recommended for new users.
9.4 Use in Conjunction with NAG Library Routines
To estimate the
-norm of the inverse of a matrix
, the following skeleton code can normally be used:
do {
f04ydc(&irevcm,m,n,x,pdx,y,pdy,&estnrm,t,seed,work,iwork,&fail);
if (irevcm == 1){
.. Code to compute y = A^(-1) x ..
}
else if (irevcm == 2){
.. Code to compute x = A^(-T) y ..
}
} (while irevcm != 0)
To compute
or
, solve the equation
or
, storing the result in
y or
x respectively. The code will vary, depending on the type of the matrix
, and the NAG function used to factorize
.
The factorization will normally have been performed by a suitable function from
Chapters f01,
f03 or
f07. Note also that many of the ‘Black Box’ functions in
Chapter f04 for solving systems of equations also return a factorization of the matrix. The example program in
Section 10 illustrates how nag_linsys_real_gen_norm_rcomm (f04ydc) can be used in conjunction with NAG C Library functions for
factorization of a real matrix
nag_dgetrf (f07adc).
It is straightforward to use nag_linsys_real_gen_norm_rcomm (f04ydc) for the following other types of matrix, using the named functions for factorization and solution:
For upper or lower triangular matrices, no factorization function is needed:
and
may be computed by calls to
nag_dtrsv (f16pjc) (or
nag_dtbsv (f16pkc) if the matrix is banded, or
nag_dtpsv (f16plc) if the matrix is stored in packed form).
10 Example
This example estimates the condition number
of the matrix
given by
10.1 Program Text
Program Text (f04ydce.c)
10.2 Program Data
Program Data (f04ydce.d)
10.3 Program Results
Program Results (f04ydce.r)