MAGMA  1.5.0
Matrix Algebra for GPU and Multicore Architectures
 All Files Functions Groups
double-complex precision

Functions

magma_int_t magma_zgesdd (magma_vec_t jobz, magma_int_t m, magma_int_t n, magmaDoubleComplex *A, magma_int_t lda, double *s, magmaDoubleComplex *U, magma_int_t ldu, magmaDoubleComplex *VT, magma_int_t ldvt, magmaDoubleComplex *work, magma_int_t lwork, double *rwork, magma_int_t *iwork, magma_int_t *info)
 ZGESDD computes the singular value decomposition (SVD) of a complex M-by-N matrix A, optionally computing the left and right singular vectors, by using divide-and-conquer method. More...
 
magma_int_t magma_zgesvd (magma_vec_t jobu, magma_vec_t jobvt, magma_int_t m, magma_int_t n, magmaDoubleComplex *A, magma_int_t lda, double *s, magmaDoubleComplex *U, magma_int_t ldu, magmaDoubleComplex *VT, magma_int_t ldvt, magmaDoubleComplex *work, magma_int_t lwork, double *rwork, magma_int_t *info)
 ZGESVD computes the singular value decomposition (SVD) of a complex M-by-N matrix A, optionally computing the left and/or right singular vectors. More...
 

Detailed Description

Function Documentation

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

ZGESDD computes the singular value decomposition (SVD) of a complex 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 * 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 unitary matrix, and V is an N-by-N unitary 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**H, 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]jobzmagma_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**H 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**H 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**H are returned in the array VT; otherwise, all columns of U are returned in the array U and the first M rows of V**H are overwritten on the array A;
  • = MagmaNoVec: no columns of U or rows of V**H are computed.
[in]mINTEGER The number of rows of the input matrix A. M >= 0.
[in]nINTEGER The number of columns of the input matrix A. N >= 0.
[in,out]ACOMPLEX_16 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**H (the right singular vectors, stored rowwise).
  • if JOBZ != MagmaOverwriteVec, the contents of A are destroyed.
[in]ldaINTEGER The leading dimension of the array A. LDA >= max(1,M).
[out]sDOUBLE PRECISION array, dimension (min(M,N)) The singular values of A, sorted so that S(i) >= S(i+1).
[out]UCOMPLEX_16 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 unitary 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]lduINTEGER The leading dimension of the array U. LDU >= 1; if JOBZ = MagmaSomeVec or MagmaAllVec or JOBZ = MagmaOverwriteVec and M < N, LDU >= M.
[out]VTCOMPLEX_16 array, dimension (LDVT,N)
  • If JOBZ = MagmaAllVec or JOBZ = MagmaOverwriteVec and M >= N, VT contains the N-by-N unitary matrix V**H;
  • if JOBZ = MagmaSomeVec, VT contains the first min(M,N) rows of V**H (the right singular vectors, stored rowwise);
  • if JOBZ = MagmaOverwriteVec and M < N, or JOBZ = MagmaNoVec, VT is not referenced.
[in]ldvtINTEGER 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) COMPLEX_16 array, dimension (MAX(1,lwork)) On exit, if INFO = 0, WORK[1] returns the optimal lwork.
[in]lworkINTEGER 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_dgesvd_nb(N). The threshold for x >> y currently is x >= int( y*17/9 ). 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 >= 2*y + (2*y)*nb; otherwise, LWORK >= 2*y + (x+y)*nb.
  • If JOBZ = MagmaOverwriteVec, if x >> y, LWORK >= 2*y*y + 2*y + (2*y)*nb; otherwise, LWORK >= 2*y + max( (x+y)*nb, y*y + x ), prefer LWORK >= 2*y + max( (x+y)*nb, x*y + y*nb ).
  • If JOBZ = MagmaSomeVec, if x >> y, LWORK >= y*y + 2*y + (2*y)*nb; otherwise, LWORK >= 2*y + (x+y)*nb.
  • If JOBZ = MagmaAllVec, if x >> y, LWORK >= y*y + 2*y + max( (2*y)*nb, x ), prefer LWORK >= y*y + 2*y + max( (2*y)*nb, x*nb ); otherwise, LWORK >= 2*y + (x+y)*nb.
    If lwork = -1, a workspace query is assumed. The optimal size for the WORK array is calculated and stored in WORK[1], and no other work except argument checking is performed.
rwork(workspace) DOUBLE PRECISION array, dimension (MAX(1,LRWORK)) Let x = max(M,N) and y = min(M,N). These sizes should work for both MAGMA and LAPACK. If JOBZ = MagmaNoVec, LRWORK >= 5*y. If JOBZ != MagmaNoVec, if x >> y, LRWORK >= 5*y*y + 5*y; otherwise, LRWORK >= max( 5*y*y + 5*y, 2*x*y + 2*y*y + y ).
For JOBZ = MagmaNoVec, some implementations seem to have a bug requiring LRWORK >= 7*y in some cases.
iwork(workspace) INTEGER array, dimension (8*min(M,N))
[out]infoINTEGER
  • = 0: successful exit.
  • < 0: if INFO = -i, the i-th argument had an illegal value.
  • > 0: The updating process of DBDSDC did not converge.

Further Details

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

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

ZGESVD computes the singular value decomposition (SVD) of a complex 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 unitary matrix, and V is an N-by-N unitary 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**H, not V.

Parameters
[in]jobumagma_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]jobvtmagma_vec_t Specifies options for computing all or part of the matrix V**H:
  • = MagmaAllVec: all N rows of V**H are returned in the array VT;
  • = MagmaSomeVec: the first min(m,n) rows of V**H (the right singular vectors) are returned in the array VT;
  • = MagmaOverwriteVec: the first min(m,n) rows of V**H (the right singular vectors) are overwritten on the array A;
  • = MagmaNoVec: no rows of V**H (no right singular vectors) are computed.
    JOBVT and JOBU cannot both be MagmaOverwriteVec.
[in]mINTEGER The number of rows of the input matrix A. M >= 0.
[in]nINTEGER The number of columns of the input matrix A. N >= 0.
[in,out]ACOMPLEX_16 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**H (the right singular vectors, stored rowwise);
  • if JOBU != MagmaOverwriteVec and JOBVT != MagmaOverwriteVec, the contents of A are destroyed.
[in]ldaINTEGER The leading dimension of the array A. LDA >= max(1,M).
[out]sDOUBLE_PRECISION array, dimension (min(M,N)) The singular values of A, sorted so that S(i) >= S(i+1).
[out]UCOMPLEX_16 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 unitary 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]lduINTEGER The leading dimension of the array U. LDU >= 1; if JOBU = MagmaSomeVec or MagmaAllVec, LDU >= M.
[out]VTCOMPLEX_16 array, dimension (LDVT,N)
  • If JOBVT = MagmaAllVec, VT contains the N-by-N unitary matrix V**H;
  • if JOBVT = MagmaSomeVec, VT contains the first min(m,n) rows of V**H (the right singular vectors, stored rowwise);
  • if JOBVT = MagmaNoVec or MagmaOverwriteVec, VT is not referenced.
[in]ldvtINTEGER The leading dimension of the array VT. LDVT >= 1;
  • if JOBVT = MagmaAllVec, LDVT >= N;
  • if JOBVT = MagmaSomeVec, LDVT >= min(M,N).
[out]work(workspace) COMPLEX_16 array, dimension (MAX(1,LWORK)) On exit, if INFO = 0, WORK(1) returns the required LWORK.
[in]lworkINTEGER The dimension of the array WORK. LWORK >= (M+N)*nb + 2*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 + 2*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.
rwork(workspace) DOUBLE_PRECISION array, dimension (5*min(M,N)) On exit, if INFO > 0, RWORK(1:MIN(M,N)-1) 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.
[out]infoINTEGER
  • = 0: successful exit.
  • < 0: if INFO = -i, the i-th argument had an illegal value.
  • > 0: if ZBDSQR 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.