?gesvd
?gesvd
Computes the singular value decomposition of a general rectangular matrix.
Syntax
lapack_int LAPACKE_sgesvd
(
int
matrix_layout
,
char
jobu
,
char
jobvt
,
lapack_int
m
,
lapack_int
n
,
float*
a
,
lapack_int
lda
,
float*
s
,
float*
u
,
lapack_int
ldu
,
float*
vt
,
lapack_int
ldvt
,
float*
superb
);
lapack_int LAPACKE_dgesvd
(
int
matrix_layout
,
char
jobu
,
char
jobvt
,
lapack_int
m
,
lapack_int
n
,
double*
a
,
lapack_int
lda
,
double*
s
,
double*
u
,
lapack_int
ldu
,
double*
vt
,
lapack_int
ldvt
,
double*
superb
);
lapack_int LAPACKE_cgesvd
(
int
matrix_layout
,
char
jobu
,
char
jobvt
,
lapack_int
m
,
lapack_int
n
,
lapack_complex_float*
a
,
lapack_int
lda
,
float*
s
,
lapack_complex_float*
u
,
lapack_int
ldu
,
lapack_complex_float*
vt
,
lapack_int
ldvt
,
float*
superb
);
lapack_int LAPACKE_zgesvd
(
int
matrix_layout
,
char
jobu
,
char
jobvt
,
lapack_int
m
,
lapack_int
n
,
lapack_complex_double*
a
,
lapack_int
lda
,
double*
s
,
lapack_complex_double*
u
,
lapack_int
ldu
,
lapack_complex_double*
vt
,
lapack_int
ldvt
,
double*
superb
);
Include Files
- mkl.h
Description
The routine computes the singular value decomposition (SVD) of a real/complex
m
-by-n
matrix A
, optionally computing the left and/or right singular vectors. The SVD is written asA
= U
*Σ
*V
T
A
= U
*Σ
*V
H
where
Σ
is an m
-by-n
matrix which is zero except for its min(m
,n
) diagonal elements, U
is an m
-by-m
orthogonal/unitary matrix, and V
is an n
-by-n
orthogonal/unitary matrix. The diagonal elements of Σ
are the singular values of A
; they are real and non-negative, and are returned in descending order. The first min(m
, n
) columns of U
and V
are the left and right singular vectors of A
. The routine returns (for real flavors) or
(for complex flavors), not
V
T
V
H
V
.Input Parameters
- matrix_layout
- Specifies whether matrix storage layout is row major (LAPACK_ROW_MAJOR) or column major (LAPACK_COL_MAJOR).
- jobu
- Must be'A','S','O', or'N'. Specifies options for computing all or part of the matrixU.If, alljobu='A'mcolumns ofUare returned in the arrayu;if, the first min(jobu='S'm,n) columns ofU(the left singular vectors) are returned in the arrayu;if, the first min(jobu='O'm,n) columns ofU(the left singular vectors) are overwritten on the arraya;if, no columns ofjobu='N'U(no left singular vectors) are computed.
- jobvt
- Must be'A','S','O', or'N'. Specifies options for computing all or part of the matrixV/TV.HIf, alljobvt='A'nrows ofV/TVare returned in the arrayHvt;if, the first min(jobvt='S'm,n) rows ofV/TV(the right singular vectors) are returned in the arrayHvt;if, the first min(jobvt='O'm,n) rows ofV/TV) (the right singular vectors) are overwritten on the arrayHa;if, no rows ofjobvt='N'V/TV(no right singular vectors) are computed.Hjobvtandjobucannot both be'O'.
- m
- The number of rows of the matrixA().m≥0
- n
- The number of columns inA().n≥0
- a
- Arrays:a(size at least max(1,is an array containing thelda*n) for column major layout and max(1,lda*m) for row major layout)m-by-nmatrixA.
- lda
- The leading dimension of the arraya.Must be at least max(1,m)for column major layout and at least max(1,.n) for row major layout
- ldu,ldvt
- The leading dimensions of the output arraysuandvt, respectively.Constraints:.ldu≥1;ldvt≥1If,jobu='A';ldu≥mIf,jobu='S'for column major layout andldu≥mldu≥min(m,n) for row major layout;If,jobvt='A';ldvt≥nIf,jobvt='S'(ldvt≥minm,n)for column major layout and.ldvt≥nfor row major layout
Output Parameters
- a
- On exit,If,jobu='O'ais overwritten with the first min(m,n) columns ofU(the left singular vectors stored columnwise);If,jobvt='O'ais overwritten with the first min(m,n) rows ofV/TV(the right singular vectors stored rowwise);HIfandjobu≠'O', the contents ofjobvt≠'O'aare destroyed.
- s
- Array, size at least max(1, min(m,n)). Contains the singular values ofAsorted so that.s[i]≥s[i+ 1]
- u,vt
- Arrays:Arrayuminimum size:Column major layoutRow major layoutjobu='A'max(1,ldu*m)max(1,ldu*m)jobu='S'max(1,ldu*min(m,n))max(1,ldu*m)If,jobu='A'ucontains them-by-morthogonal/unitary matrixU.If,jobu='S'ucontains the first min(m,n) columns ofU(the left singular vectors stored column-wise).Iforjobu='N''O',uis not referenced.Arrayvminimum size:Column major layoutRow major layoutjobvt='A'max(1,ldvt*n)max(1,ldvt*n)jobvt='S'max(1,ldvt*min(m,n))max(1,ldvt*n)If,jobvt='A'vtcontains then-by-northogonal/unitary matrixV/TV.HIf,jobvt='S'vtcontains the first min(m,n) rows ofV/TV(the right singular vectors stored row-wise).HIforjobvt='N''O',vtis not referenced.
- superb
- If?bdsqrdoes not converge (indicated by the return value), on exitinfo> 0contains the unconverged superdiagonal elements of an upper bidiagonal matrixsuperb(0:min(m,n)-2)Bwhose diagonal is ins(not necessarily sorted).Bsatisfies(real flavors) orA=u*B*VT(complex flavors), so it has the same singular values asA=u*B*VHA, and singular vectors related byuandvt.
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
= i
, then if ?bdsqr
did not converge, i
specifies how many superdiagonals of the intermediate bidiagonal form B
did not converge to zero (see the description of the superb
parameter for details).