single precision
[SVD: driver]

Functions

magma_int_t magma_sgesdd (magma_vec_t jobz, magma_int_t m, magma_int_t n, float *A, magma_int_t lda, float *s, float *U, magma_int_t ldu, float *VT, magma_int_t ldvt, float *work, magma_int_t lwork, float *rwork, magma_int_t *iwork, magma_int_t *info)
 SGESDD computes the singular value decomposition (SVD) of a real M-by-N matrix A, optionally computing the left and right singular vectors, by using divide-and-conquer method.
magma_int_t magma_sgesvd (magma_vec_t jobu, magma_vec_t jobvt, magma_int_t m, magma_int_t n, float *A, magma_int_t lda, float *s, float *U, magma_int_t ldu, float *VT, magma_int_t ldvt, float *work, magma_int_t lwork, float *rwork, magma_int_t *info)
 SGESVD computes the singular value decomposition (SVD) of a real M-by-N matrix A, optionally computing the left and/or right singular vectors.

Function Documentation

magma_int_t magma_sgesdd ( magma_vec_t  jobz,
magma_int_t  m,
magma_int_t  n,
float *  A,
magma_int_t  lda,
float *  s,
float *  U,
magma_int_t  ldu,
float *  VT,
magma_int_t  ldvt,
float *  work,
magma_int_t  lwork,
float *  rwork,
magma_int_t *  iwork,
magma_int_t *  info 
)

SGESDD computes the singular value decomposition (SVD) of a real M-by-N matrix A, optionally computing the left and right singular vectors, by using divide-and-conquer method.

The SVD is written

A = U * SIGMA * transpose(V)

where SIGMA is an M-by-N matrix which is zero except for its min(m,n) diagonal elements, U is an M-by-M orthogonal matrix, and V is an N-by-N orthogonal matrix. The diagonal elements of SIGMA 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 = V**T, not V.

The divide and conquer algorithm makes very mild assumptions about floating point arithmetic. It will work on machines with a guard digit in add/subtract, or on those binary machines without guard digits which subtract like the Cray X-MP, Cray Y-MP, Cray C-90, or Cray-2. It could conceivably fail on hexadecimal or decimal machines without guard digits, but we know of none.

Parameters:
[in] jobz magma_vec_t Specifies options for computing all or part of the matrix U:

  • = MagmaAllVec: all M columns of U and all N rows of V**T are returned in the arrays U and VT;
  • = MagmaSomeVec: the first min(M,N) columns of U and the first min(M,N) rows of V**T are returned in the arrays U and VT;
  • = MagmaOverwriteVec: If M >= N, the first N columns of U are overwritten on the array A and all rows of V**T are returned in the array VT; otherwise, all columns of U are returned in the array U and the first M rows of V**T are overwritten on the array A;
  • = MagmaNoVec: no columns of U or rows of V**T are computed.
[in] m INTEGER The number of rows of the input matrix A. M >= 0.
[in] n INTEGER The number of columns of the input matrix A. N >= 0.
[in,out] A REAL array, dimension (LDA,N) On entry, the M-by-N matrix A. On exit,

  • if JOBZ = MagmaOverwriteVec, if M >= N, A is overwritten with the first N columns of U (the left singular vectors, stored columnwise); otherwise, A is overwritten with the first M rows of V**T (the right singular vectors, stored owwise).
  • if JOBZ != MagmaOverwriteVec, the contents of A are destroyed.
[in] lda INTEGER The leading dimension of the array A. LDA >= max(1,M).
[out] s REAL array, dimension (min(M,N)) The singular values of A, sorted so that S(i) >= S(i + 1).
[out] U REAL array, dimension (LDU,UCOL) UCOL = M if JOBZ = MagmaAllVec or JOBZ = MagmaOverwriteVec and M < N; UCOL = min(M,N) if JOBZ = MagmaSomeVec.

  • If JOBZ = MagmaAllVec or JOBZ = MagmaOverwriteVec and M < N, U contains the M-by-M orthogonal matrix U;
  • if JOBZ = MagmaSomeVec, U contains the first min(M,N) columns of U (the left singular vectors, stored columnwise);
  • if JOBZ = MagmaOverwriteVec and M >= N, or JOBZ = MagmaNoVec, U is not referenced.
[in] ldu INTEGER The leading dimension of the array U. LDU >= 1; if JOBZ = MagmaSomeVec or MagmaAllVec or JOBZ = MagmaOverwriteVec and M < N, LDU >= M.
[out] VT REAL array, dimension (LDVT,N)

  • If JOBZ = MagmaAllVec or JOBZ = MagmaOverwriteVec and M >= N, VT contains the N-by-N orthogonal matrix V**T;
  • if JOBZ = MagmaSomeVec, VT contains the first min(M,N) rows of V**T (the right singular vectors, stored rowwise);
  • if JOBZ = MagmaOverwriteVec and M < N, or JOBZ = MagmaNoVec, VT is not referenced.
[in] ldvt INTEGER The leading dimension of the array VT. LDVT >= 1; if JOBZ = MagmaAllVec or JOBZ = MagmaOverwriteVec and M >= N, LDVT >= N; if JOBZ = MagmaSomeVec, LDVT >= min(M,N).
[out] work (workspace) REAL array, dimension (MAX(1,LWORK)) On exit, if INFO = 0, WORK[0] returns the optimal LWORK.
[in] lwork INTEGER The dimension of the array WORK. Let x = max(M,N) and y = min(M,N). The optimal block size nb can be obtained through magma_get_sgesvd_nb(N). The threshold for x >> y currently is x >= y*11/6. Required size different than in LAPACK.* In most cases, these sizes should give optimal performance for both MAGMA and LAPACK.

  • If JOBZ = MagmaNoVec, if x >> y, LWORK >= 3*y + max( (2*y)*nb, 7*y ); otherwise, LWORK >= 3*y + max( (x+y)*nb, 7*y ).
  • If JOBZ = MagmaOverwriteVec, if x >> y, LWORK >= y*y + 3*y + max( (2*y)*nb, 4*y*y + 4*y ), prefer LWORK >= y*y + 3*y + max( (2*y)*nb, 4*y*y + 4*y, y*y + y*nb ); otherwise, LWORK >= 3*y + max( (x+y)*nb, 4*y*y + 4*y ).
  • If JOBZ = MagmaSomeVec, if x >> y, LWORK >= y*y + 3*y + max( (2*y)*nb, 3*y*y + 4*y ); otherwise, LWORK >= 3*y + max( (x+y)*nb, 3*y*y + 4*y ).
  • If JOBZ = MagmaAllVec, if x >> y, LWORK >= y*y + max( 3*y + max( (2*y)*nb, 3*y*y + 4*y ), y + x ), prefer LWORK >= y*y + max( 3*y + max( (2*y)*nb, 3*y*y + 4*y ), y + x*nb ); otherwise, LWORK >= 3*y + max( (x+y)*nb, 3*y*y + 4*y ).
    If LWORK = -1 but other input arguments are legal, WORK[0] returns the optimal LWORK.
iwork (workspace) INTEGER array, dimension (8*min(M,N))
[out] info INTEGER

  • = 0: successful exit.
  • < 0: if INFO = -i, the i-th argument had an illegal value.
  • > 0: SBDSDC did not converge, updating process failed.

Further Details --------------- Based on contributions by Ming Gu and Huan Ren, Computer Science Division, University of California at Berkeley, USA

magma_int_t magma_sgesvd ( magma_vec_t  jobu,
magma_vec_t  jobvt,
magma_int_t  m,
magma_int_t  n,
float *  A,
magma_int_t  lda,
float *  s,
float *  U,
magma_int_t  ldu,
float *  VT,
magma_int_t  ldvt,
float *  work,
magma_int_t  lwork,
float *  rwork,
magma_int_t *  info 
)

SGESVD computes the singular value decomposition (SVD) of a real M-by-N matrix A, optionally computing the left and/or right singular vectors.

The SVD is written

A = U * SIGMA * conjugate-transpose(V)

where SIGMA is an M-by-N matrix which is zero except for its min(m,n) diagonal elements, U is an M-by-M orthogonal matrix, and V is an N-by-N orthogonal matrix. The diagonal elements of SIGMA 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 V**T, not V.

Parameters:
[in] jobu magma_vec_t Specifies options for computing all or part of the matrix U:

  • = MagmaAllVec: all M columns of U are returned in array U:
  • = MagmaSomeVec: the first min(m,n) columns of U (the left singular vectors) are returned in the array U;
  • = MagmaOverwriteVec: the first min(m,n) columns of U (the left singular vectors) are overwritten on the array A;
  • = MagmaNoVec: no columns of U (no left singular vectors) are computed.
[in] jobvt magma_vec_t Specifies options for computing all or part of the matrix V**T:

  • = MagmaAllVec: all N rows of V**T are returned in the array VT;
  • = MagmaSomeVec: the first min(m,n) rows of V**T (the right singular vectors) are returned in the array VT;
  • = MagmaOverwriteVec: the first min(m,n) rows of V**T (the right singular vectors) are overwritten on the array A;
  • = MagmaNoVec: no rows of V**T (no right singular vectors) are computed.
    JOBVT and JOBU cannot both be MagmaOverwriteVec.
[in] m INTEGER The number of rows of the input matrix A. M >= 0.
[in] n INTEGER The number of columns of the input matrix A. N >= 0.
[in,out] A REAL array, dimension (LDA,N) On entry, the M-by-N matrix A. On exit,

  • if JOBU = MagmaOverwriteVec, A is overwritten with the first min(m,n) columns of U (the left singular vectors, stored columnwise);
  • if JOBVT = MagmaOverwriteVec, A is overwritten with the first min(m,n) rows of V**T (the right singular vectors, stored rowwise);
  • if JOBU != MagmaOverwriteVec and JOBVT != MagmaOverwriteVec, the contents of A are destroyed.
[in] lda INTEGER The leading dimension of the array A. LDA >= max(1,M).
[out] s REAL array, dimension (min(M,N)) The singular values of A, sorted so that S(i) >= S(i+1).
[out] U REAL array, dimension (LDU,UCOL) (LDU,M) if JOBU = MagmaAllVec or (LDU,min(M,N)) if JOBU = MagmaSomeVec.

  • If JOBU = MagmaAllVec, U contains the M-by-M orthogonal matrix U;
  • if JOBU = MagmaSomeVec, U contains the first min(m,n) columns of U (the left singular vectors, stored columnwise);
  • if JOBU = MagmaNoVec or MagmaOverwriteVec, U is not referenced.
[in] ldu INTEGER The leading dimension of the array U. LDU >= 1; if JOBU = MagmaSomeVec or MagmaAllVec, LDU >= M.
[out] VT REAL array, dimension (LDVT,N)

  • If JOBVT = MagmaAllVec, VT contains the N-by-N orthogonal matrix V**T;
  • if JOBVT = MagmaSomeVec, VT contains the first min(m,n) rows of V**T (the right singular vectors, stored rowwise);
  • if JOBVT = MagmaNoVec or MagmaOverwriteVec, VT is not referenced.
[in] ldvt INTEGER The leading dimension of the array VT. LDVT >= 1;

  • if JOBVT = MagmaAllVec, LDVT >= N;
  • if JOBVT = MagmaSomeVec, LDVT >= min(M,N).
[out] work (workspace) REAL array, dimension (MAX(1,LWORK)) On exit, if INFO = 0, WORK[0] returns the required LWORK. if INFO > 0, WORK(2:MIN(M,N)) contains the unconverged superdiagonal elements of an upper bidiagonal matrix B whose diagonal is in S (not necessarily sorted). B satisfies A = U * B * VT, so it has the same singular values as A, and singular vectors related by U and VT.
[in] lwork INTEGER The dimension of the array WORK. LWORK >= (M+N)*nb + 3*min(M,N). For optimum performance with some paths (m >> n and jobu=A,S,O; or n >> m and jobvt=A,S,O), LWORK >= (M+N)*nb + 3*min(M,N) + 2*min(M,N)**2 (see comments inside code).
If LWORK = -1, then a workspace query is assumed; the routine only calculates the required size of the WORK array, returns this value as the first entry of the WORK array, and no error message related to LWORK is issued by XERBLA.
[out] info INTEGER

  • = 0: successful exit.
  • < 0: if INFO = -i, the i-th argument had an illegal value.
  • > 0: if SBDSQR did not converge, INFO specifies how many superdiagonals of an intermediate bidiagonal form B did not converge to zero. See the description of RWORK above for details.

Generated on 3 May 2015 for MAGMA by  doxygen 1.6.1