F02XUF returns all, or part, of the singular value decomposition of a complex upper triangular matrix.
SUBROUTINE F02XUF ( |
N, A, LDA, NCOLB, B, LDB, WANTQ, Q, LDQ, SV, WANTP, RWORK, CWORK, IFAIL) |
INTEGER |
N, LDA, NCOLB, LDB, LDQ, IFAIL |
REAL (KIND=nag_wp) |
SV(N), RWORK(*) |
COMPLEX (KIND=nag_wp) |
A(LDA,*), B(LDB,*), Q(LDQ,*), CWORK(max(1,N-1)) |
LOGICAL |
WANTQ, WANTP |
|
The
n by
n upper triangular matrix
R is factorized as
where
Q and
P are
n by
n unitary matrices and
S is an
n by
n diagonal matrix with real non-negative diagonal elements,
sv1,sv2,…,svn, ordered such that
The columns of
Q are the left-hand singular vectors of
R, the diagonal elements of
S are the singular values of
R and the columns of
P are the right-hand singular vectors of
R.
Either or both of
Q and
PH may be requested and the matrix
C given by
where
B is an
n by
ncolb given matrix, may also be requested.
Good background descriptions to the singular value decomposition are given in
Dongarra et al. (1979),
Hammarling (1985) and
Wilkinson (1978).
Note that if
K is any unitary diagonal matrix so that
then
is also a singular value decomposition of
A.
Dongarra J J, Moler C B, Bunch J R and Stewart G W (1979)
LINPACK Users' Guide SIAM, Philadelphia
Hammarling S (1985) The singular value decomposition in multivariate statistics
SIGNUM Newsl. 20(3) 2–25
Wilkinson J H (1978) Singular Value Decomposition – Basic Aspects
Numerical Software – Needs and Availability (ed D A H Jacobs) Academic Press
If on entry
IFAIL=0 or
-1, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
The computed factors
Q,
S and
P satisfy the relation
where
ε is the
machine precision,
c is a modest function of
n and
. denotes the spectral (two) norm. Note that
A=sv1.
For given values of
NCOLB,
WANTQ and
WANTP, the number of floating point operations required is approximately proportional to
n3.
Following the use of this routine the rank of
R may be estimated by a call to the INTEGER FUNCTION
F06KLF. The statement
IRANK = F06KLF(N,SV,1,TOL)
returns the value
k-1 in
IRANK, where
k is the smallest integer for which
svk<tol×sv1, where
tol is the tolerance supplied in
TOL, so that
IRANK is an estimate of the rank of
S and thus also of
R. If
TOL is supplied as negative then the
machine precision is used in place of
TOL.
This example finds the singular value decomposition of the
3 by
3 upper triangular matrix
together with the vector
QHb for the vector