Developer Reference for Intel® oneAPI Math Kernel Library for C
?bdsqr
Computes the singular value decomposition of a general matrix that has been reduced to bidiagonal form.
Syntax
lapack_int LAPACKE_sbdsqr(int matrix_layout, char uplo, lapack_int n, lapack_int ncvt,
lapack_int nru, lapack_int ncc, float *d, float *e, float *vt,
lapack_int ldvt, float *u, lapack_int ldu, float *c,
lapack_int ldc);
lapack_int LAPACKE_dbdsqr(int matrix_layout, char uplo, lapack_int n, lapack_int ncvt,
lapack_int nru, lapack_int ncc, double *d, double *e,
double *vt, lapack_int ldvt, double *u, lapack_int ldu,
double *c, lapack_int ldc);
lapack_int LAPACKE_cbdsqr(int matrix_layout, char uplo, lapack_int n, lapack_int ncvt,
lapack_int nru, lapack_int ncc, float *d, float *e,
lapack_complex_float *vt, lapack_int ldvt,
lapack_complex_float *u, lapack_int ldu,
lapack_complex_float *c, lapack_int ldc);
lapack_int LAPACKE_zbdsqr(int matrix_layout, char uplo, lapack_int n, lapack_int ncvt,
lapack_int nru, lapack_int ncc, double *d, double *e,
lapack_complex_double *vt, lapack_int ldvt,
lapack_complex_double *u, lapack_int ldu,
lapack_complex_double *c, lapack_int ldc);
Include Files
mkl.h
Description
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
- matrix_layout
-
Specifies whether matrix storage layout is row major ( LAPACK_ROW_MAJOR ) or column major ( LAPACK_COL_MAJOR ).
uplo
Must be ‘U’ or ‘L’ .
If uplo = 'U' , B is an upper bidiagonal matrix. If uplo = 'L' , B is a lower bidiagonal matrix.
n
The order of the matrix B ( n≥ 0 ).
ncvt
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
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
The number of columns in the matrix C used for computing the product QH * 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,*) , size max(1, ldvt * ncvt ) for column major layout and max(1, ldvt * n ) for row major layout, 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,*) , size max(1, ldu * n ) for column major layout and max(1, ldu * nru ) for row major layout, 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 , size max(1, ldc * ncc ) for column major layout and max(1, ldc * n ) for row major layout, 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
The leading dimension of vt . Constraints:
ldvt≥ max(1, n) if ncvt > 0 for column major layout and ldvt ≥ max(1, ncvt ) for row major layout ;
ldvt≥ 1 if ncvt = 0 .
ldu
The leading dimension of u . Constraint:
ldu≥ max(1, nru) for column major layout and ldu ≥ max(1, n ) for row major layout .
ldc
The leading dimension of c . Constraints:
ldc ≥ max(1, n ) if ncc > 0 for column major layout and ldc≥ max(1, ncc) for row major layout ; 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 QH * C .
- vt
-
On exit, this array is overwritten by PH * VT . Not referenced if ncvt = 0.
- u
-
On exit, this array is overwritten by U * Q . Not referenced if nru = 0.
Return Values
This function returns a value info .
If info = 0 , the execution is successful.
If info = -i , the i -th parameter had an illegal value.
If info > 0 ,
info = 1 , a split was marked by a positive value in e
info = 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.
LAPACK 95 Interface Notes
There exist FORTRAN 77 and FORTRAN 95 interfaces for this routine. See the Intel® oneMKL Fortran Developer Reference for details.
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.