NAG Library Routine Document
F04YDF
1 Purpose
F04YDF estimates the -norm of a real rectangular matrix without accessing the matrix explicitly. It uses reverse communication for evaluating matrix products. The routine may be used for estimating condition numbers of square matrices.
2 Specification
SUBROUTINE F04YDF ( |
IREVCM, M, N, X, LDX, Y, LDY, ESTNRM, T, SEED, WORK, IWORK, IFAIL) |
INTEGER |
IREVCM, M, N, LDX, LDY, T, SEED, IWORK(2*N+5*T+20), IFAIL |
REAL (KIND=nag_wp) |
X(LDX,*), Y(LDY,*), ESTNRM, WORK(M*T) |
|
3 Description
F04YDF computes an estimate (a lower bound) for the
-norm
of an
by
real matrix
. The routine 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 routine 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 routine 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 F04YDF may be computed by back- and forward-substitutions, without computing .
The routine 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 , F04YDF 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 Parameters
Note: this routine uses
reverse communication. Its use involves an initial entry, intermediate exits and re-entries, and a final exit, as indicated by the parameter
IREVCM. Between intermediate exits and re-entries,
all parameters other than X and Y must remain unchanged.
- 1: IREVCM – INTEGERInput/Output
-
On initial entry: must be set to .
On intermediate exit:
or
, and
X and
Y contain the elements of
and
matrices respectively. The calling program must
(a) |
if , evaluate and store the result in Y
or
if , evaluate and store the result in X, |
(b) |
call F04YDF once again, with all the other parameters 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(LDX,) – REAL (KIND=nag_wp) arrayInput/Output
-
Note: the second dimension of the array
X
must be at least
.
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: LDX – INTEGERInput
On initial entry: the leading dimension of the array
X as declared in the (sub)program from which F04YDF is called.
Constraint:
.
- 6: Y(LDY,) – REAL (KIND=nag_wp) arrayInput/Output
-
Note: the second dimension of the array
Y
must be at least
.
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: LDY – INTEGERInput
On initial entry: the leading dimension of the array
Y as declared in the (sub)program from which F04YDF is called.
Constraint:
.
- 8: ESTNRM – REAL (KIND=nag_wp)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 a parameter 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.
- 11: WORK() – REAL (KIND=nag_wp) arrayCommunication Array
- 12: IWORK() – INTEGER arrayCommunication Array
-
On initial entry: need not be set.
On intermediate re-entry: must not be changed.
- 13: IFAIL – INTEGERInput/Output
On initial entry:
IFAIL must be set to
,
. If you are unfamiliar with this parameter you should refer to
Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, because for this routine the values of the output parameters may be useful even if
on exit, the recommended value is
.
When the value is used it is essential to test the value of IFAIL on exit.
On final exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6 Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Errors or warnings detected by the routine:
-
Internal error; please contact
NAG.
-
On entry, .
Constraint: , or .
On initial entry, .
Constraint: .
-
On entry, .
Constraint: .
-
On entry, .
Constraint: .
-
On entry, and .
Constraint: .
-
On entry, and .
Constraint: .
-
On entry, and .
Constraint: .
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.1 Timing
For most problems the time taken during calls to F04YDF will be negligible compared with the time spent evaluating matrix products between calls to F04YDF.
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 .
8.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 , F04YDF should not be called if one of the factors is exactly singular – otherwise division by zero may occur in the substitutions.
8.3 Choice of
The parameter 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 value of
SEED should be kept constant.
A value of is recommended for new users.
8.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:
... code to factorize A ...
IF (A is not singular) THEN
IREVCM = 0
10 CALL F04YDF (IREVCM,M,N,X,LDX,Y,LDY,ESTNRM,T,SEED,WORK, &
IWORK,IFAIL)
IF (IREVCM.NE.0) THEN
IF (IREVCM.EQ.1) THEN
... code to compute Y=inv(A)X ...
ELSE
... code to compute X=inv(transpose(A))Y ...
END IF
GO TO 10
END IF
END IF
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 routine used to factorize
.
The factorization will normally have been performed by a suitable routine from
Chapters F01,
F03 or
F07. Note also that many of the ‘Black Box’ routines in
Chapter F04 for solving systems of equations also return a factorization of the matrix. The example program in
Section 9 illustrates how F04YDF can be used in conjunction with NAG Library routines for
factorization of a real matrix
F07ADF (DGETRF).
It is straightforward to use F04YDF for the following other types of matrix, using the named routines for factorization and solution:
For upper or lower triangular matrices, no factorization routine is needed:
and
may be computed by calls to
F06PJF (DTRSV) (or
F06PKF (DTBSV) if the matrix is banded, or
F06PLF (DTPSV) if the matrix is stored in packed form).
9 Example
For this routine two examples are provided. There is a single example program for F04YDF, with a main program and the code to solve the two example problems is given in Example 1 (EX1) and Example 2 (EX2).
Example 1 (EX1)
This example estimates the condition number
of the matrix
given by
Example 2 (EX2)
This example estimates the condition number of the sparse matrix
(stored in symmetric coordinate storage format) given by
9.1 Program Text
Program Text (f04ydfe.f90)
9.2 Program Data
Program Data (f04ydfe.d)
9.3 Program Results
Program Results (f04ydfe.r)