PSGESVD(l)
π NAME π
PSGESVD β ok so this is the LAPACK routine (manual page PSGESVD(l), version 1.5, she's vintage but she works) that computes the singular value decomposition (SVD) of an M-by-N matrix A, and optionally computes the left and/or right singular vectors. π
β¨
π SYNOPSIS π
SUBROUTINE PSGESVD( JOBU, JOBVT, M, N, A, IA, JA, DESCA, S, U, IU, JU,
DESCU, VT, IVT, JVT, DESCVT, WORK, LWORK, INFO )
CHARACTER JOBU, JOBVT
INTEGER IA, INFO, IU, IVT, JA, JU, JVT, LWORK, M, N
INTEGER DESCA( * ), DESCU( * ), DESCVT( * )
REAL A( * ), S( * ), U( * ), VT( * ), WORK( * )
πΈ PURPOSE πΈ
Bestie. PSGESVD computes the singular value decomposition (SVD) of an M-by-N matrix A, optionally computing the left and/or right singular vectors. The SVD is written as
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 and the columns of U and V are the corresponding right and left singular vectors, respectively. The singular values are returned in array S in decreasing order and only the first min(M,N) columns of U and rows of VT = V**T are computed. π
π Notes π
Every global data object is described by an associated description vector. This vector stores the information required to establish the mapping between an object element and its corresponding process and memory location.
Let A be a generic term for any 2D block cyclicly distributed array. Such a global array has an associated description vector DESCA. In the following comments, the character _ should be read as "of the global array". π«Ά
DTYPE_A(global)β stored inDESCA( DTYPE_ )β The descriptor type. In this case,DTYPE_A = 1.CTXT_A (global)β stored inDESCA( CTXT_ )β The BLACS context handle, indicating the BLACS process grid A is distributed over. The context itself is global, but the handle (the integer value) may vary.M_A (global)β stored inDESCA( M_ )β The number of rows in the global arrayA.N_A (global)β stored inDESCA( N_ )β The number of columns in the global arrayA.MB_A (global)β stored inDESCA( MB_ )β The blocking factor used to distribute the rows of the array.NB_A (global)β stored inDESCA( NB_ )β The blocking factor used to distribute the columns of the array.RSRC_A (global)β stored inDESCA( RSRC_ )β The process row over which the first row of the arrayAis distributed.CSRC_A (global)β stored inDESCA( CSRC_ )β The process column over which the first column of the arrayAis distributed.LLD_A (local)β stored inDESCA( LLD_ )β The leading dimension of the local array.LLD_A >= MAX(1,LOCr(M_A)).
Let K be the number of rows or columns of a distributed matrix, and assume that its process grid has dimension p x q. LOCr( K ) denotes the number of elements of K that a process would receive if K were distributed over the p processes of its process column. Similarly, LOCc( K ) denotes the number of elements of K that a process would receive if K were distributed over the q processes of its process row. The values of LOCr() and LOCc() may be determined via a call to the ScaLAPACK tool function, NUMROC:
LOCr( M ) = NUMROC( M, MB_A, MYROW, RSRC_A, NPROW ),
LOCc( N ) = NUMROC( N, NB_A, MYCOL, CSRC_A, NPCOL ).
An upper bound for these quantities may be computed by:
LOCr( M ) <= ceil( ceil(M/MB_A)/NPROW )*MB_A
LOCc( N ) <= ceil( ceil(N/NB_A)/NPCOL )*NB_A
π ARGUMENTS π
First, the lil glossary, iykyk:
MP= number of local rows inAandUNQ= number of local columns inAandVTSIZE=min( M, N )SIZEQ= number of local columns inUSIZEP= number of local rows inVTJOBU(global input)CHARACTER*1β Specifies options for computing all or part of the matrixU:= 'V': the firstSIZEcolumns ofU(the left singular vectors) are returned in the arrayU;= 'N': no columns ofU(no left singular vectors) are computed.
JOBVT(global input)CHARACTER*1β Specifies options for computing all or part of the matrixV**T:= 'V': the firstSIZErows ofV**T(the right singular vectors) are returned in the arrayVT;= 'N': no rows ofV**T(no right singular vectors) are computed.
M(global input)INTEGERβ The number of rows of the input matrixA.M >= 0.N(global input)INTEGERβ The number of columns of the input matrixA.N >= 0.A(local input/workspace) block cyclicREALarray, global dimension(M, N), local dimension(MP, NQ). On exit, the contents ofAare destroyed. π (fr fr, say bye to your data)IA(global input)INTEGERβ The row index in the global arrayAindicating the first row ofsub( A ).JA(global input)INTEGERβ The column index in the global arrayAindicating the first column ofsub( A ).DESCA(global input)INTEGERarray of dimensionDLEN_β The array descriptor for the distributed matrixA.S(global output)REALarray, dimensionSIZEβ The singular values ofA, sorted so thatS(i) >= S(i+1). πU(local output)REALarray, local dimension(MP, SIZEQ), global dimension(M, SIZE). IfJOBU = 'V',Ucontains the firstmin(m,n)columns ofU. IfJOBU = 'N',Uis not referenced.IU(global input)INTEGERβ The row index in the global arrayUindicating the first row ofsub( U ).JU(global input)INTEGERβ The column index in the global arrayUindicating the first column ofsub( U ).DESCU(global input)INTEGERarray of dimensionDLEN_β The array descriptor for the distributed matrixU.VT(local output)REALarray, local dimension(SIZEP, NQ), global dimension(SIZE, N). IfJOBVT = 'V',VTcontains the firstSIZErows ofV**T. IfJOBVT = 'N',VTis not referenced.IVT(global input)INTEGERβ The row index in the global arrayVTindicating the first row ofsub( VT ).JVT(global input)INTEGERβ The column index in the global arrayVTindicating the first column ofsub( VT ).DESCVT(global input)INTEGERarray of dimensionDLEN_β The array descriptor for the distributed matrixVT.WORK(local workspace/output)REALarray, dimension(LWORK). On exit, ifINFO = 0,WORK(1)returns the optimalLWORK;LWORK(local input)INTEGERβ The dimension of the arrayWORK.
LWORK > 2 + 6*SIZEB + MAX(WATOBD, WBDTOSVD),
where SIZEB = MAX(M,N), and WATOBD and WBDTOSVD refer, respectively, to the workspace required to bidiagonalize the matrix A and to go from the bidiagonal matrix to the singular value decomposition U*S*VT. π§
For WATOBD, the following holds:
WATOBD = MAX(MAX(WPSLANGE,WPSGEBRD),
MAX(WPSLARED2D,WPSLARED1D)),
where WPSLANGE, WPSLARED1D, WPSLARED2D, WPSGEBRD are the workspaces required respectively for the subprograms PSLANGE, PSLARED1D, PSLARED2D, PSGEBRD. Using the standard notation
MP = NUMROC( M, MB, MYROW, DESCA( CTXT_ ), NPROW), NQ = NUMROC(
N, NB, MYCOL, DESCA( LLD_ ), NPCOL),
the workspaces required for the above subprograms are
WPSLANGE = MP, WPSLARED1D = NQ0, WPSLARED2D = MP0, WPSGEBRD =
NB*(MP + NQ + 1) + NQ,
where NQ0 and MP0 refer, respectively, to the values obtained at MYCOL = 0 and MYROW = 0. In general, the upper limit for the workspace is given by a workspace required on processor (0,0):
WATOBD <= NB*(MP0 + NQ0 + 1) + NQ0.
In case of a homogeneous process grid this upper limit can be used as an estimate of the minimum workspace for every processor.
For WBDTOSVD, the following holds:
WBDTOSVD = SIZE*(WANTU*NRU + WANTVT*NCVT) + MAX(WDBDSQR,
MAX(WANTU*WPSORMBRQLN, WANTVT*WPSORMBRPRT)),
where
1, if left(right) singular vectors are wanted
WANTU(WANTVT) =
0, otherwise
and WDBDSQR, WPSORMBRQLN and WPSORMBRPRT refer respectively to the workspace required for the subprograms DBDSQR, PSORMBR(QLN), and PSORMBR(PRT), where QLN and PRT are the values of the arguments VECT, SIDE, and TRANS in the call to PSORMBR. NRU is equal to the local number of rows of the matrix U when distributed 1-dimensional "column" of processes. Analogously, NCVT is equal to the local number of columns of the matrix VT when distributed across 1-dimensional "row" of processes. Calling the LAPACK procedure DBDSQR requires
WDBDSQR = MAX(1, 2*SIZE + (2*SIZE - 4)*MAX(WANTU, WANTVT))
on every processor. Finally,
WPSORMBRQLN = MAX( (NB*(NB-1))/2, (SIZEQ+MP)*NB)+NB*NB, WPSORMBRPRT =
MAX( (MB*(MB-1))/2, (SIZEP+NQ)*MB )+MB*MB,
IfLIWORK = -1, thenLIWORKis global input and a workspace query is assumed; the routine only calculates the minimum size for the work array. The required workspace is returned as the first element ofWORKand no error message is issued byPXERBLA. π
INFO(output)INTEGERβ= 0: successful exit. π< 0: ifINFO = -i, the i-th argument had an illegal value.> 0: ifSBDSQRdid not converge. IfINFO = MIN(M,N) + 1, thenPSSYEVhas detected heterogeneity by finding that eigenvalues were not identical across the process grid. In this case, the accuracy of the results fromPSSYEVcannot be guaranteed. π
And that's the whole page, bestie β every flag, every formula, every descriptor slot, nothing skipped, periodt. π
Sign-off time: this was LAPACK version 1.5, dated 12 May 1997, and the page itself goes by PSGESVD(l). Iconic behavior from 1997 tbh. πβ¨π
π¦ where this page comes from
- ubuntu jammy: scalapack-doc 1.5-11
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms