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.
The routine may be called by the names f04ydf or nagf_linsys_real_gen_norm_rcomm.
3Description
f04ydf computes an estimate (a lower bound) for the -norm
(1)
of an 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 .
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. Software14 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
5Arguments
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 argument irevcm. Between intermediate exits and re-entries, all arguments other thanx and y must remain unchanged.
1: – IntegerInput/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 f04ydf once again, with all the other arguments unchanged.
On intermediate re-entry: irevcm must be unchanged.
On final exit: .
Note: any values you return to f04ydf as part of the reverse communication procedure should not include floating-point NaN (Not a Number) or infinity values, since these are not handled by f04ydf. If your code does inadvertently return any NaNs or infinities, f04ydf is likely to produce unexpected results.
2: – IntegerInput
On entry: the number of rows of the matrix .
Constraint:
.
3: – IntegerInput
On entry: , the number of columns of the matrix .
Constraint:
.
4: – 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: – IntegerInput
On initial entry: the leading dimension of the array x as declared in the (sub)program from which f04ydf is called.
Constraint:
.
6: – 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: – IntegerInput
On initial entry: the leading dimension of the array y as declared in the (sub)program from which f04ydf is called.
Constraint:
.
8: – 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: – 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: – IntegerInput
On entry: the seed used for random number generation.
On initial entry: ifail must be set to , or to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value or is recommended. If message printing is undesirable, then the value is recommended. Otherwise, the value is recommended since useful values can be provided in some output arguments even when on exit. When the value or 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).
6Error Indicators and Warnings
If on entry or , explanatory error messages are output on the current error message unit (as defined by x04aaf).
An unexpected error has been triggered by this routine. Please
contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
7Accuracy
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.
8Parallelism and Performance
f04ydf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.
9Further Comments
9.1Timing
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 .
9.2Overflow
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.
9.3Choice 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.4Use 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 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.
It is straightforward to use f04ydf for the following other types of matrix, using the named routines for factorization and solution:
nonsymmetric sparse (f11mefandf11mff; note that f11mgf can also be used here).
For upper or lower triangular matrices, no factorization routine is needed: and may be computed by calls to f06pjf (or f06pkf if the matrix is banded, or f06plf if the matrix is stored in packed form).
10Example
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