The routine may be called by the names f01blf or nagf_matop_real_gen_pseudinv.
3Description
Householder's factorization with column interchanges is used in the decomposition , where is with its columns permuted, is the first columns of an orthogonal matrix and is an upper-trapezoidal matrix of rank . The pseudo-inverse of is given by where
If the matrix is found to be of maximum rank, ,
is a nonsingular upper-triangular matrix and the pseudo-inverse of simplifies to . The transpose of the pseudo-inverse of is overwritten on .
4References
Peters G and Wilkinson J H (1970) The least squares problem and pseudo-inverses Comput. J.13 309–316
Wilkinson J H and Reinsch C (1971) Handbook for Automatic Computation II, Linear Algebra Springer–Verlag
5Arguments
1: – IntegerInput
2: – IntegerInput
On entry: and , the number of rows and columns in the matrix .
Constraint:
.
3: – Real (Kind=nag_wp)Input
On entry: the tolerance used to decide when elements can be regarded as zero (see Section 9).
4: – Real (Kind=nag_wp) arrayInput/Output
On entry: the rectangular matrix .
On exit: the transpose of the pseudo-inverse of .
5: – IntegerInput
On entry: the first dimension of the array a as declared in the (sub)program from which f01blf is called.
Constraint:
.
6: – Real (Kind=nag_wp) arrayOutput
On exit: contains the element of largest modulus in the reduced matrix at the th stage. If , then only the first elements of aijmax have values assigned to them; the remaining elements are unused. The ratio usually gives an indication of the condition number of the original matrix (see Section 9).
7: – IntegerOutput
On exit: , the rank of as determined using the tolerance t.
8: – Integer arrayOutput
On exit: the record of the column interchanges in the Householder factorization.
9: – Real (Kind=nag_wp) arrayWorkspace
10: – Real (Kind=nag_wp) arrayWorkspace
11: – IntegerInput
On entry: the first dimension of the array u as declared in the (sub)program from which f01blf is called.
Constraint:
.
12: – Real (Kind=nag_wp) arrayWorkspace
13: – IntegerInput/Output
On 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. When the value or is used it is essential to test the value of ifail on exit.
On 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
For most matrices the pseudo-inverse is the best possible having regard to the condition of and the choice of t. Note that only the singular value decomposition method can be relied upon to give maximum accuracy for the precision of computation used and correct determination of the condition of a matrix (see Wilkinson and Reinsch (1971)).
The computed factors and satisfy the relation where
in which is a modest function of and , is the value of t, and is the machine precision.
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
f01blf is not threaded in any implementation.
9Further Comments
The time taken by f01blf is approximately proportional to .
The most difficult practical problem is the determination of the rank of the matrix (see pages 314–315 of Peters and Wilkinson (1970)); only the singular value decomposition method gives a reliable indication of rank deficiency (see pages 134–151 of Wilkinson and Reinsch (1971) and f08kbf). In f01blf a tolerance, t, is used to recognize ‘zero’ elements in the remaining matrix at each step in the factorization. The value of t should be set at times the bound on possible errors in individual elements of the original matrix. If the elements of vary widely in their orders of magnitude, of course this presents severe difficulties. Sound decisions can only be made by somebody who appreciates the underlying physical problem.
If the condition number of is we expect to get figures wrong in the pseudo-inverse. An estimate of the condition number is usually given by .
10Example
A complete program follows which outputs the maximum of the moduli of the ‘remaining’ elements at each step in the factorization, the rank, as determined by the given value of t, and the transposed pseudo-inverse. Data and results are given for an example which is a matrix of deficient rank in which the last column is a linear combination of the other four. Setting t to times the norm of the matrix, the rank is correctly determined as and the pseudo-inverse is computed to full implementation accuracy.