NAG Library Routine Document
F08MSF (ZBDSQR)
1 Purpose
F08MSF (ZBDSQR) computes the singular value decomposition of a complex general matrix which has been reduced to bidiagonal form.
2 Specification
SUBROUTINE F08MSF ( |
UPLO, N, NCVT, NRU, NCC, D, E, VT, LDVT, U, LDU, C, LDC, WORK, INFO) |
INTEGER |
N, NCVT, NRU, NCC, LDVT, LDU, LDC, INFO |
REAL (KIND=nag_wp) |
D(*), E(*), WORK(*) |
COMPLEX (KIND=nag_wp) |
VT(LDVT,*), U(LDU,*), C(LDC,*) |
CHARACTER(1) |
UPLO |
|
The routine may be called by its
LAPACK
name zbdsqr.
3 Description
F08MSF (ZBDSQR) computes the singular values and, optionally, the left or right singular vectors of a real upper or lower bidiagonal matrix
. In other words, it can compute the singular value decomposition (SVD) of
as
Here
is a diagonal matrix with real diagonal elements
(the singular values of
), such that
is an orthogonal matrix whose columns are the left singular vectors
;
is an orthogonal matrix whose rows are the right singular vectors
. Thus
To compute
and/or
, the arrays
U and/or
VT must be initialized to the unit matrix before F08MSF (ZBDSQR) is called.
The routine stores the real orthogonal matrices
and
in complex arrays
U and
VT, so that it may also be used to compute the SVD of a complex general matrix
which has been reduced to bidiagonal form by a unitary transformation:
. If
is
by
with
, then
is
by
and
is
by
; if
is
by
with
, then
is
by
and
is
by
. In this case, the matrices
and/or
must be formed explicitly by
F08KTF (ZUNGBR) and passed to F08MSF (ZBDSQR) in the arrays
U and/or
VT respectively.
F08MSF (ZBDSQR) also has the capability of forming , where is an arbitrary complex matrix; this is needed when using the SVD to solve linear least squares problems.
F08MSF (ZBDSQR) uses two different algorithms. If any singular vectors are required (i.e., if
or
or
), the bidiagonal
algorithm is used, switching between zero-shift and implicitly shifted forms to preserve the accuracy of small singular values, and switching between
and
variants in order to handle graded matrices effectively (see
Demmel and Kahan (1990)). If only singular values are required (i.e., if
), they are computed by the differential qd algorithm (see
Fernando and Parlett (1994)), which is faster and can achieve even greater accuracy.
The singular vectors are normalized so that , but are determined only to within a complex factor of absolute value .
4 References
Demmel J W and Kahan W (1990) Accurate singular values of bidiagonal matrices SIAM J. Sci. Statist. Comput. 11 873–912
Fernando K V and Parlett B N (1994) Accurate singular values and differential qd algorithms Numer. Math. 67 191–229
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
5 Parameters
- 1: UPLO – CHARACTER(1)Input
On entry: indicates whether
is an upper or lower bidiagonal matrix.
- is an upper bidiagonal matrix.
- is a lower bidiagonal matrix.
Constraint:
or .
- 2: N – INTEGERInput
On entry: , the order of the matrix .
Constraint:
.
- 3: NCVT – INTEGERInput
On entry: , the number of columns of the matrix of right singular vectors. Set of right singular vectors. Set if no right singular vectors are required.
Constraint:
.
- 4: NRU – INTEGERInput
On entry: , the number of rows of the matrix of left singular vectors. Set if no left singular vectors are required.
Constraint:
.
- 5: NCC – INTEGERInput
On entry: , the number of columns of the matrix . Set if no matrix is supplied.
Constraint:
.
- 6: D() – REAL (KIND=nag_wp) arrayInput/Output
-
Note: the dimension of the array
D
must be at least
.
On entry: the diagonal elements of the bidiagonal matrix .
On exit: the singular values in decreasing order of magnitude, unless
(in which case see
Section 6).
- 7: E() – REAL (KIND=nag_wp) arrayInput/Output
-
Note: the dimension of the array
E
must be at least
.
On entry: the off-diagonal elements of the bidiagonal matrix .
On exit:
E is overwritten, but if
see
Section 6.
- 8: VT(LDVT,) – COMPLEX (KIND=nag_wp) arrayInput/Output
-
Note: the second dimension of the array
VT
must be at least
.
On entry: if
,
VT must contain an
by
matrix. If the right singular vectors of
are required,
and
VT must contain the unit matrix; if the right singular vectors of
are required,
VT must contain the unitary matrix
returned by
F08KTF (ZUNGBR) with
.
On exit: the
by
matrix
or
of right singular vectors, stored by rows.
If
,
VT is not referenced.
- 9: LDVT – INTEGERInput
On entry: the first dimension of the array
VT as declared in the (sub)program from which F08MSF (ZBDSQR) is called.
Constraints:
- if , ;
- otherwise .
- 10: U(LDU,) – COMPLEX (KIND=nag_wp) arrayInput/Output
-
Note: the second dimension of the array
U
must be at least
.
On entry: if
,
U must contain an
by
matrix. If the left singular vectors of
are required,
and
U must contain the unit matrix; if the left singular vectors of
are required,
U must contain the unitary matrix
returned by
F08KTF (ZUNGBR) with
.
On exit: the
by
matrix
or
of left singular vectors, stored as columns of the matrix.
If
,
U is not referenced.
- 11: LDU – INTEGERInput
On entry: the first dimension of the array
U as declared in the (sub)program from which F08MSF (ZBDSQR) is called.
Constraint:
.
- 12: C(LDC,) – COMPLEX (KIND=nag_wp) arrayInput/Output
-
Note: the second dimension of the array
C
must be at least
.
On entry: the by matrix if .
On exit:
C is overwritten by the matrix
. If
,
C is not referenced.
- 13: LDC – INTEGERInput
On entry: the first dimension of the array
C as declared in the (sub)program from which F08MSF (ZBDSQR) is called.
Constraints:
- if , ;
- otherwise .
- 14: WORK() – REAL (KIND=nag_wp) arrayWorkspace
-
Note: the dimension of the array
WORK
must be at least
if
and
and
, and at least
otherwise.
- 15: INFO – INTEGEROutput
On exit:
unless the routine detects an error (see
Section 6).
6 Error Indicators and Warnings
Errors or warnings detected by the routine:
If , argument had an illegal value. An explanatory message is output, and execution of the program is terminated.
The algorithm failed to converge and
INFO specifies how many off-diagonals did not converge. In this case,
D and
E contain on exit the diagonal and off-diagonal elements, respectively, of a bidiagonal matrix orthogonally equivalent to
.
7 Accuracy
Each singular value and singular vector is computed to high relative accuracy. However, the reduction to bidiagonal form (prior to calling the routine) may exclude the possibility of obtaining high relative accuracy in the small singular values of the original matrix if its singular values vary widely in magnitude.
If
is an exact singular value of
and
is the corresponding computed value, then
where
is a modestly increasing function of
and
, and
is the
machine precision. If only singular values are computed, they are computed more accurately (i.e., the function
is smaller), than when some singular vectors are also computed.
If
is an exact left singular vector of
, and
is the corresponding computed left singular vector, then the angle
between them is bounded as follows:
where
is the relative gap between
and the other singular values, defined by
A similar error bound holds for the right singular vectors.
The total number of real floating point operations is roughly proportional to if only the singular values are computed. About additional operations are required to compute the left singular vectors and about to compute the right singular vectors. The operations to compute the singular values must all be performed in scalar mode; the additional operations to compute the singular vectors can be vectorized and on some machines may be performed much faster.
The real analogue of this routine is
F08MEF (DBDSQR).
9 Example
See
Section 9 in F08KTF (ZUNGBR), which illustrates the use of the routine to compute the singular value decomposition of a general matrix.