?bdsqr
?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 where , as computed by
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
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 P
H
*VT
instead of P
H
, 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
?gebrd
, then A
= (U
*Q
)*S
*(P
H
VT
) is the SVD of
A
. Optionally, the subroutine may also compute Q
H
*C
for a given real/complex input matrix C
. 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'Bis an upper bidiagonal matrix.If,uplo='L'Bis a lower bidiagonal matrix.
- n
- The order of the matrixB().n≥0
- ncvt
- The number of columns of the matrixVT, that is, the number of right singular vectors ().ncvt≥0Setif no right singular vectors are required.ncvt= 0
- nru
- The number of rows inU, that is, the number of left singular vectors ().nru≥0Setif no left singular vectors are required.nru= 0
- ncc
- The number of columns in the matrixCused for computing the productQ*HC(). Setncc≥0if no matrixncc= 0Cis supplied.
- d,e
- Arrays:dcontains the diagonal elements ofB.The size ofdmust be at leastmax(1,.n)econtains the(off-diagonal elements ofn-1)B.The size ofemust be at leastmax(1,.n- 1)
- vt,u,c
- Arrays:vt, size max(1,contains anldvt*ncvt) for column major layout and max(1,ldvt*n) for row major layout,n-by-ncvtmatrixVT.vtis not referenced if.ncvt= 0u, size max(1,contains anldu*n) for column major layout and max(1,ldu*nru) for row major layout,nrubynmatrixU.uis not referenced if.nru= 0c, size max(1,contains theldc*ncc) for column major layout and max(1,ldc*n) for row major layout,n-by-nccmatrixCfor computing the product.Q*HC
- ldvt
- The leading dimension ofvt. Constraints:ifldvt≥max(1,n)ncvt> 0for column major layout and;ldvt≥max(1,ncvt) for row major layoutifldvt≥1.ncvt= 0
- ldu
- The leading dimension ofu. Constraint:ldu≥max(1,nru)for column major layout and.ldu≥max(1,n) for row major layout
- ldc
- The leading dimension ofc. Constraints:ldc≥max(1,n) ifncc> 0for column major layout and;for row major layoutldc≥max(1,ncc)ldc≥1 otherwise.
Output Parameters
- d
- On exit, if, overwritten by the singular values in decreasing order (seeinfo= 0info).
- e
- On exit, if,info= 0eis destroyed. See alsoinfobelow.
- c
- Overwritten by the productQ*HC.
- vt
- On exit, this array is overwritten byP*HVT. Not referenced ifncvt= 0.
- u
- On exit, this array is overwritten byU*Q. Not referenced ifnru= 0.
Return Values
This function returns a value
info
.If , the execution is successful.
info
= 0If , the
info
= -i
i
-th parameter had an illegal value. If ,
info
> 0 If = ,
ncvt
= nru
ncc
= 0- , a split was marked by a positive value ininfo= 1e
- , the current block ofinfo= 2znot diagonalized after 100*niterations (in the innerwhileloop)
- , termination criterion of the outerinfo= 3whileloop is not met (the program created more thannunreduced blocks).
In all other cases when , the algorithm did not converge; ,
ncvt
, nru
, or ncc
> 0d
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.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 is an exact singular value of is the corresponding computed value, then
s
i
B
, and s
i
| - |
s
i
σ
i
≤
p
*(m
,n
)*ε
*σ
i
where
p
(m
, n
) is a modestly increasing function of m
and n
, and ε
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 is the corresponding exact left singular vector of is the corresponding computed left singular vector, then the angle , ) between them is bounded as follows:
u
i
B
, and w
i
θ
(u
i
w
i
θ
(u
i
w
i
≤
p
(m
,n
)*ε
/ min i
≠
j
σ
i
- σ
j
|/|σ
i
σ
j
|)Here and the other singular values. A similar error bound holds for the right singular vectors.
min(| - |/| + |)
is the i
≠
j
σ
i
σ
j
σ
i
σ
j
relative gap
between σ
i
The total number of real floating-point operations is roughly proportional to
n
2
if only the singular values are computed. About 6
additional operations (n
2
*nru
12
for complex flavors) are required to compute the left singular vectors and about n
2
*nru
6
operations (n
2
*ncvt
12
for complex flavors) to compute the right singular vectors. n
2
*ncvt