Intel® oneAPI Math Kernel Library Developer Reference - C
Computes the singular value decomposition of a general rectangular matrix using a divide and conquer method.
lapack_int LAPACKE_sgesdd( int matrix_layout, char jobz, lapack_int m, lapack_int n, float* a, lapack_int lda, float* s, float* u, lapack_int ldu, float* vt, lapack_int ldvt );
lapack_int LAPACKE_dgesdd( int matrix_layout, char jobz, lapack_int m, lapack_int n, double* a, lapack_int lda, double* s, double* u, lapack_int ldu, double* vt, lapack_int ldvt );
lapack_int LAPACKE_cgesdd( int matrix_layout, char jobz, 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 );
lapack_int LAPACKE_zgesdd( int matrix_layout, char jobz, 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 );
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.
If singular vectors are desired, it uses a divide-and-conquer algorithm. The SVD is written
A = U*Σ*VT for real routines,
A = U*Σ*VH for complex routines,
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.
Note that the routine returns vt = VT (for real flavors) or vt =VH (for complex flavors), not V.
Specifies whether matrix storage layout is row major (LAPACK_ROW_MAJOR) or column major (LAPACK_COL_MAJOR).
Must be 'A', 'S', 'O', or 'N'.
Specifies options for computing all or part of the matrices U and V.
If jobz = 'A', all m columns of U and all n rows of VT or VH are returned in the arrays u and vt;
if jobz = 'S', the first min(m, n) columns of U and the first min(m, n) rows of VT or VH are returned in the arrays u and vt;
if jobz = 'O', then
if m≥ n, the first n columns of U are overwritten in the array a and all rows of VT or VH are returned in the array vt;
if m<n, all columns of U are returned in the array u and the first m rows of VT or VH are overwritten in the array a;
if jobz = 'N', no columns of U or rows of VT or VH are computed.
The number of rows of the matrix A (m≥ 0).
The number of columns in A (n≥ 0).
a(size max(1, lda*n) for column major layout and max(1, lda*m) for row major layout) is an array containing the m-by-n matrix A.
The leading dimension of the array a. Must be at least max(1, m) for column major layout and at least max(1, n) for row major layout.
The leading dimensions of the output arrays u and vt, respectively.
The minimum size of ldu is
jobz |
m≥n |
m < n |
---|---|---|
'N' |
1 |
1 |
'A' |
m |
m |
'S' |
m for column major layout; n for row major layout |
m |
'O' |
1 |
m |
The minimum size of ldvt is
jobz |
m≥n |
m < n |
---|---|---|
'N' |
1 |
1 |
'A' |
n |
n |
'S' |
n |
m for column major layout; n for row major layout |
'O' |
n |
1 |
On exit:
If jobz = 'O', then if m≥ n, a is overwritten with the first n columns of U (the left singular vectors, stored columnwise). If m < n, a is overwritten with the first m rows of VT (the right singular vectors, stored rowwise);
If jobz≠'O', the contents of a are destroyed.
Array, size at least max(1, min(m,n)). Contains the singular values of A sorted so that s(i) ≥ s(i+1).
Arrays:
Array u is of size:
jobz |
m≥n |
m < n |
---|---|---|
'N' |
1 |
1 |
'A' |
max(1, ldu*m) |
max(1, ldu*m) |
'S' |
max(1, ldu*n) for column major layout; max(1, ldu*m) for row major layout |
max(1, ldu*m) |
'O' |
1 |
max(1, ldu*m) |
If jobz = 'A'or jobz = 'O' and m < n, u contains the m-by-m orthogonal/unitary matrix U.
If jobz = 'S', u contains the first min(m, n) columns of U (the left singular vectors, stored columnwise).
If jobz = 'O' and m≥n, or jobz = 'N', u is not referenced.
Array vt is of size:
jobz |
m≥n |
m < n |
---|---|---|
'N' |
1 |
1 |
'A' |
max(1, ldvt*n) |
max(1, ldvt*n) |
'S' |
max(1, ldvt*n) |
max(1, ldvt*n ) for column major layout; max(1, ldvt*m ) for row major layout; |
'O' |
max(1, ldvt*n) |
1 |
If jobz = 'A'or jobz = 'O' and m≥n, vt contains the n-by-n orthogonal/unitary matrix VT.
If jobz = 'S', vt contains the first min(m, n) rows of VT (the right singular vectors, stored rowwise).
If jobz = 'O' and m < n, or jobz = 'N', vt is not referenced.
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 = -4, A had a NAN entry.
If info = i, then ?bdsdc did not converge, updating process failed.