Developer Reference for Intel® oneAPI Math Kernel Library for Fortran
?bdsqr
Computes the singular value decomposition of a general matrix that has been reduced to bidiagonal form.
Syntax
call sbdsqr ( uplo , n , ncvt , nru , ncc , d , e , vt , ldvt , u , ldu , c , ldc , work , info )
call dbdsqr ( uplo , n , ncvt , nru , ncc , d , e , vt , ldvt , u , ldu , c , ldc , work , info )
call cbdsqr ( uplo , n , ncvt , nru , ncc , d , e , vt , ldvt , u , ldu , c , ldc , rwork , info )
call zbdsqr ( uplo , n , ncvt , nru , ncc , d , e , vt , ldvt , u , ldu , c , ldc , rwork , info )
call rbdsqr ( d , e [ , vt ] [ , u ] [ , c ] [ , uplo ] [ , info ] )
call bdsqr ( d , e [ , vt ] [ , u ] [ , c ] [ , uplo ] [ , info ] )
Include Files
mkl.fi , mkl_lapack.f90
Description
sbdsqr dbdsqr cbdsqr zbdsqr rbdsqr bdsqr
The routine computes the singular values and, optionally, the right and/or left singular vectors from the Singular Value Decomposition (SVD) of a real n -by- n (upper or lower) bidiagonal matrix B using the implicit zero-shift QR algorithm. The SVD of B has the form B = Q*S*P^{H} where S is the diagonal matrix of singular values, Q is an orthogonal matrix of left singular vectors, and P is an orthogonal matrix of right singular vectors. If left singular vectors are requested, this subroutine actually returns U * Q instead of Q , and, if right singular vectors are requested, this subroutine returns PH * VT instead of PH , for given real/complex input matrices U and VT . When U and VT are the orthogonal/unitary matrices that reduce a general matrix A to bidiagonal form: A = U*B*VT , as computed by ?gebrd , then
A = (U*Q)*S*(P^{H}*VT)
is the SVD of A . Optionally, the subroutine may also compute QH * C for a given real/complex input matrix C .
See also lasq1 , lasq2 , lasq3 , lasq4 , lasq5 , lasq6 used by this routine.
Input Parameters
uplo
CHARACTER*1 . Must be ‘U’ or ‘L’ .
If uplo = 'U' , B is an upper bidiagonal matrix. If uplo = 'L' , B is a lower bidiagonal matrix.
n
INTEGER . The order of the matrix B ( n≥ 0 ).
ncvt
INTEGER . The number of columns of the matrix VT , that is, the number of right singular vectors ( ncvt≥ 0 ).
Set ncvt = 0 if no right singular vectors are required.
nru
INTEGER . The number of rows in U , that is, the number of left singular vectors ( nru≥ 0 ).
Set nru = 0 if no left singular vectors are required.
ncc
INTEGER . The number of columns in the matrix C used for computing the product Q:code:`H` * C ( ncc≥ 0 ). Set ncc = 0 if no matrix C is supplied.
- d , e
-
REAL for single-precision flavors DOUBLE PRECISION for double-precision flavors. Arrays: d(*) contains the diagonal elements of B . The size of d must be at least max(1, n) . e(*) contains the (n-1) off-diagonal elements of B . The size of e must be at least max(1, n - 1) .
- work
-
REAL for sbdsqr DOUBLE PRECISION for dbdsqr . work(*) is a workspace array. The size of work must be at least max(1, 4*n) .
- rwork
-
REAL for cbdsqr DOUBLE PRECISION for zbdsqr . rwork(*) is a workspace array. The size of rwork must be at least max(1, 4*n) .
- vt , u , c
-
REAL for sbdsqr DOUBLE PRECISION for dbdsqr COMPLEX for cbdsqr DOUBLE COMPLEX for zbdsqr . Arrays:
vt(ldvt,*) contains an n -by- ncvt matrix VT .
The second dimension of vt must be at least max(1, ncvt) . vt is not referenced if ncvt = 0 .
u(ldu,*) contains an nru by n matrix U .
The second dimension of u must be at least max(1, n) . u is not referenced if nru = 0 .
c ( ldc ,*) contains the n -by- ncc matrix C for computing the product Q^{H}*C .
The second dimension of c must be at least max(1, ncc) . The array is not referenced if ncc = 0 .
ldvt
INTEGER . The leading dimension of vt . Constraints:
ldvt≥ max(1, n) if ncvt > 0 ;
ldvt≥ 1 if ncvt = 0 .
ldu
INTEGER . The leading dimension of u . Constraint:
ldu≥ max(1, nru) .
ldc
INTEGER . The leading dimension of c . Constraints:
ldc ≥ max(1, n ) if ncc > 0 ; ldc ≥ 1 otherwise.
Output Parameters
- d
-
On exit, if info = 0 , overwritten by the singular values in decreasing order (see info ).
- e
-
On exit, if info = 0 , e is destroyed. See also info below.
- c
-
Overwritten by the product Q:code:`H` * C .
- vt
-
On exit, this array is overwritten by P:code:`H` * VT . Not referenced if ncvt = 0.
- u
-
On exit, this array is overwritten by U * Q . Not referenced if nru = 0.
info
INTEGER .
If info = 0 , the execution is successful.
If info = -i , the i -th parameter had an illegal value.
If info > 0 ,
If ncvt = nru = ncc = 0 , info = 1 , a split was marked by a positive value in einfo = 2 , the current block of z not diagonalized after 100* n iterations (in the inner while loop) info = 3 , termination criterion of the outer while loop is not met (the program created more than n unreduced blocks).
In all other cases when ncvt , nru , or ncc > 0 , the algorithm did not converge; d and e contain the elements of a bidiagonal matrix that is orthogonally similar to the input matrix B ; if info = i , i elements of e have not converged to zero.
Return Values
No return value, info is an Output Parameter.
LAPACK 95 Interface Notes
Routines in Fortran 95 interface have fewer arguments in the calling sequence than their FORTRAN 77 counterparts. For general conventions applied to skip redundant or restorable arguments, see LAPACK 95 Interface Conventions .
Specific details for the routine bdsqr interface are the following:
d
Holds the vector of length ( n ).
e
Holds the vector of length ( n ).
vt
Holds the matrix VT of size (n, ncvt) .
u
Holds the matrix U of size ( nru,n ).
c
Holds the matrix C of size ( n,ncc ).
uplo
Must be ‘U’ or ‘L’ . The default value is ‘U’ .
ncvt
If argument vt is present, then ncvt is equal to the number of columns in matrix VT ; otherwise, ncvt is set to zero.
nru
If argument u is present, then nru is equal to the number of rows in matrix U ; otherwise, nru is set to zero.
ncc
If argument c is present, then ncc is equal to the number of columns in matrix C ; otherwise, ncc is set to zero.
Note that two variants of Fortran 95 interface for bdsqr routine are needed because of an ambiguous choice between real and complex cases appear when vt , u , and c are omitted. Thus, the name rbdsqr is used in real cases (single or double precision), and the name bdsqr is used in complex cases (single or double precision).
Application Notes
Each singular value and singular vector is computed to high relative accuracy. However, the reduction to bidiagonal form (prior to calling the routine) may decrease the relative accuracy in the small singular values of the original matrix if its singular values vary widely in magnitude.
If si is an exact singular value of \(B\) , and si is the corresponding computed value, then
\(|s_{i} - \sigma_{i}| \leq p(m,n) \varepsilon \sigma_{i}\)
where p ( m , n ) is a modestly increasing function of m and n , and \(\varepsilon\) is the machine precision.
If only singular values are computed, they are computed more accurately than when some singular vectors are also computed (that is, the function p ( m , n ) is smaller).
If ui is the corresponding exact left singular vector of \(B\) , and wi is the corresponding computed left singular vector, then the angle \(\theta\) ( ui , wi ) between them is bounded as follows:
\(\theta(u_{i}, w_{i}) \leq p(m,n) \varepsilon / min _{i\neq j}(|\sigma i - \sigma j|/|\sigma_{i} + \sigma j|)\) .
Here \(min_{i\neq j}(|\sigma_{i} - \sigma_{j}|/|\sigma_{i} + \sigma_{j}|)\) is the relative gap between σ i and the other singular values. A similar error bound holds for the right singular vectors.
The total number of real floating-point operations is roughly proportional to n2 if only the singular values are computed. About \(6n^{2} nru\) additional operations ( \(12n^{2} nru\) for complex flavors) are required to compute the left singular vectors and about \(6n^{2} ncvt\) operations ( \(12n^{2} ncvt\) for complex flavors) to compute the right singular vectors.