Developer Reference for Intel® oneAPI Math Kernel Library for C

ID 766684
Date 12/16/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

?gesdd

Computes the singular value decomposition of a general rectangular matrix using a divide and conquer method.

Syntax

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 );

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.

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.

Input Parameters
matrix_layout

Specifies whether matrix storage layout is row major (LAPACK_ROW_MAJOR) or column major (LAPACK_COL_MAJOR).

jobz

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.

m

The number of rows of the matrix A (m 0).

n

The number of columns in A (n 0).

a

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.

lda

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.

ldu, ldvt

The leading dimensions of the output arrays u and vt, respectively.

The minimum size of ldu is

jobz

mn

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

mn

m < n

'N'

1

1

'A'

n

n

'S'

n

m for column major layout; n for row major layout

'O'

n

1

Output Parameters
a

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.

s

Array, size at least max(1, min(m,n)). Contains the singular values of A sorted so that s(i)  s(i+1).

u, vt

Arrays:

Array u is of size:

jobz

mn

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 mn, or jobz = 'N', u is not referenced.

Array vt is of size:

jobz

mn

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 mn, 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.

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 = -4, A had a NAN entry.

If info = i, then ?bdsdc did not converge, updating process failed.