PDGESVX(l)
β¨ PDGESVX(l) β¨ β LAPACK routine (version 1.5) π
β¨ NAME β¨
Bestie, PDGESVX uses the LU factorization to compute the solution to a real system of linear equations A(IA:IA+N-1,JA:JA+N-1) * X = B(IB:IB+N-1,JB:JB+NRHS-1), periodt. π
πΈ SYNOPSIS πΈ
SUBROUTINE PDGESVX( FACT, TRANS, N, NRHS, A, IA, JA, DESCA, AF, IAF,
JAF, DESCAF, IPIV, EQUED, R, C, B, IB, JB, DESCB, X,
IX, JX, DESCX, RCOND, FERR, BERR, WORK, LWORK,
IWORK, LIWORK, INFO )
CHARACTER EQUED, FACT, TRANS
INTEGER IA, IAF, IB, INFO, IX, JA, JAF, JB, JX, LIWORK,
LWORK, N, NRHS
DOUBLE PRECISION RCOND
INTEGER DESCA( * ), DESCAF( * ), DESCB( * ), DESCX( * ),
IPIV( * ), IWORK( * )
DOUBLE PRECISION A( * ), AF( * ), B( * ), BERR( * ), C( *
), FERR( * ), R( * ), WORK( * ), X( * )
π PURPOSE π
PDGESVX uses the LU factorization to compute the solution to a real system of linear equations.
Where A(IA:IA+N-1,JA:JA+N-1) is an N-by-N matrix and X and B(IB:IB+N-1,JB:JB+NRHS-1) are N-by-NRHS matrices. β¨
Error bounds on the solution and a condition estimate are also provided. No cap, it's giving accuracy. π«Ά
π§ Notes π§
Each 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. It's the receipts, bestie. π§Ύ
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".
Here's the mapping, with NOTATION, STORED IN, and EXPLANATION energy:
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 gridAis 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
π¦ DESCRIPTION π¦
In the following description, A denotes A(IA:IA+N-1,JA:JA+N-1), B denotes B(IB:IB+N-1,JB:JB+NRHS-1) and X denotes X(IX:IX+N-1,JX:JX+NRHS-1).
The following steps are performed:
- If
FACT = 'E', real scaling factors are computed to equilibrate the system:
TRANS = 'N': diag(R)*A*diag(C) *inv(diag(C))*X = diag(R)*B
TRANS = 'T': (diag(R)*A*diag(C))**T *inv(diag(R))*X = diag(C)*B
TRANS = 'C': (diag(R)*A*diag(C))**H *inv(diag(R))*X = diag(C)*B
Whether or not the system will be equilibrated depends on the scaling of the matrix A, but if equilibration is used, A is overwritten by diag(R)*A*diag(C) and B by diag(R)*B (if TRANS='N') or diag(C)*B (if TRANS = 'T' or 'C').
- If
FACT = 'N'or'E', the LU decomposition is used to factor the matrixA(after equilibration ifFACT = 'E') as
A = P * L * U,
where P is a permutation matrix, L is a unit lower triangular matrix, and U is upper triangular.
- The factored form of
Ais used to estimate the condition number of the matrixA. If the reciprocal of the condition number is less than machine precision, steps 4-6 are skipped. - The system of equations is solved for
Xusing the factored form ofA. - Iterative refinement is applied to improve the computed solution matrix and calculate error bounds and backward error estimates for it.
- If
FACT = 'E'and equilibration was used, the matrixXis premultiplied bydiag(C)(ifTRANS = 'N') ordiag(R)(ifTRANS = 'T'or'C') so that it solves the original system before equilibration.
π ARGUMENTS π
FACT(global input)CHARACTERβ Specifies whether or not the factored form of the matrixA(IA:IA+N-1,JA:JA+N-1)is supplied on entry, and if not, whether the matrixA(IA:IA+N-1,JA:JA+N-1)should be equilibrated before it is factored.= 'F': On entry,AF(IAF:IAF+N-1,JAF:JAF+N-1)andIPIVcontain the factored form ofA(IA:IA+N-1,JA:JA+N-1). IfEQUEDis not'N', the matrixA(IA:IA+N-1,JA:JA+N-1)has been equilibrated with scaling factors given byRandC.A(IA:IA+N-1,JA:JA+N-1),AF(IAF:IAF+N-1,JAF:JAF+N-1), andIPIVare not modified.= 'N': The matrixA(IA:IA+N-1,JA:JA+N-1)will be copied toAF(IAF:IAF+N-1,JAF:JAF+N-1)and factored.= 'E': The matrixA(IA:IA+N-1,JA:JA+N-1)will be equilibrated if necessary, then copied toAF(IAF:IAF+N-1,JAF:JAF+N-1)and factored.
TRANS(global input)CHARACTERβ Specifies the form of the system of equations:= 'N':A(IA:IA+N-1,JA:JA+N-1) * X(IX:IX+N-1,JX:JX+NRHS-1) = B(IB:IB+N-1,JB:JB+NRHS-1)(No transpose)= 'T':A(IA:IA+N-1,JA:JA+N-1)**T * X(IX:IX+N-1,JX:JX+NRHS-1) = B(IB:IB+N-1,JB:JB+NRHS-1)(Transpose)= 'C':A(IA:IA+N-1,JA:JA+N-1)**H * X(IX:IX+N-1,JX:JX+NRHS-1) = B(IB:IB+N-1,JB:JB+NRHS-1)(Transpose)
N(global input)INTEGERβ The number of rows and columns to be operated on, i.e. the order of the distributed submatrixA(IA:IA+N-1,JA:JA+N-1).N >= 0.NRHS(global input)INTEGERβ The number of right-hand sides, i.e., the number of columns of the distributed submatricesB(IB:IB+N-1,JB:JB+NRHS-1)andX(IX:IX+N-1,JX:JX+NRHS-1).NRHS >= 0.A(local input/local output)DOUBLE PRECISIONpointer into the local memory to an array of local dimension(LLD_A,LOCc(JA+N-1)). On entry, theN-by-NmatrixA(IA:IA+N-1,JA:JA+N-1). IfFACT = 'F'andEQUEDis not'N', thenA(IA:IA+N-1,JA:JA+N-1)must have been equilibrated by the scaling factors inRand/orC.A(IA:IA+N-1,JA:JA+N-1)is not modified ifFACT = 'F'or'N', or ifFACT = 'E'andEQUED = 'N'on exit.- On exit, if
EQUED .ne. 'N',A(IA:IA+N-1,JA:JA+N-1)is scaled as follows:EQUED = 'R':A(IA:IA+N-1,JA:JA+N-1) := diag(R) * A(IA:IA+N-1,JA:JA+N-1)EQUED = 'C':A(IA:IA+N-1,JA:JA+N-1) := A(IA:IA+N-1,JA:JA+N-1) * diag(C)EQUED = 'B':A(IA:IA+N-1,JA:JA+N-1) := diag(R) * A(IA:IA+N-1,JA:JA+N-1) * diag(C)
- On exit, if
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 and local input)INTEGER array of dimension DLEN_β The array descriptor for the distributed matrixA.AF(local input or local output)DOUBLE PRECISIONpointer into the local memory to an array of local dimension(LLD_AF,LOCc(JA+N-1)).- If
FACT = 'F', thenAF(IAF:IAF+N-1,JAF:JAF+N-1)is an input argument and on entry contains the factorsLandUfrom the factorizationA(IA:IA+N-1,JA:JA+N-1) = P*L*Uas computed byPDGETRF. IfEQUED .ne. 'N', thenAFis the factored form of the equilibrated matrixA(IA:IA+N-1,JA:JA+N-1). - If
FACT = 'N', thenAF(IAF:IAF+N-1,JAF:JAF+N-1)is an output argument and on exit returns the factorsLandUfrom the factorizationA(IA:IA+N-1,JA:JA+N-1) = P*L*Uof the original matrixA(IA:IA+N-1,JA:JA+N-1). - If
FACT = 'E', thenAF(IAF:IAF+N-1,JAF:JAF+N-1)is an output argument and on exit returns the factorsLandUfrom the factorizationA(IA:IA+N-1,JA:JA+N-1) = P*L*Uof the equilibrated matrixA(IA:IA+N-1,JA:JA+N-1)(see the description ofA(IA:IA+N-1,JA:JA+N-1)for the form of the equilibrated matrix).
- If
IAF(global input)INTEGERβ The row index in the global arrayAFindicating the first row ofsub( AF ).JAF(global input)INTEGERβ The column index in the global arrayAFindicating the first column ofsub( AF ).DESCAF(global and local input)INTEGER array of dimension DLEN_β The array descriptor for the distributed matrixAF.IPIV(local input or local output)INTEGER array, dimension LOCr(M_A)+MB_A. IfFACT = 'F', thenIPIVis an input argument and on entry contains the pivot indices from the factorizationA(IA:IA+N-1,JA:JA+N-1) = P*L*Uas computed byPDGETRF;IPIV(i)-> The global row local rowiwas swapped with. This array must be aligned withA( IA:IA+N-1, * ).- If
FACT = 'N', thenIPIVis an output argument and on exit contains the pivot indices from the factorizationA(IA:IA+N-1,JA:JA+N-1) = P*L*Uof the original matrixA(IA:IA+N-1,JA:JA+N-1).
- If
If FACT = 'E', then IPIV is an output argument and on exit contains the pivot indices from the factorization A(IA:IA+N-1,JA:JA+N-1) = P*L*U of the equilibrated matrix A(IA:IA+N-1,JA:JA+N-1). π
β¨
EQUED(global input or global output)CHARACTERβ okay bestie, this one tells you which equilibration vibe was done.'N': no equilibration (always true ifFACT = 'N').'R': row equilibration, meaningA(IA:IA+N-1,JA:JA+N-1)got premultiplied bydiag(R).'C': column equilibration, meaningA(IA:IA+N-1,JA:JA+N-1)got postmultiplied bydiag(C).'B': both row and column equilibration, meaningA(IA:IA+N-1,JA:JA+N-1)got replaced bydiag(R) * A(IA:IA+N-1,JA:JA+N-1) * diag(C).EQUEDis an input variable ifFACT = 'F'; otherwise, it's an output variable.R(local input or local output)DOUBLE PRECISIONarray, dimensionLOCr(M_A)β these are the row scale factors forA(IA:IA+N-1,JA:JA+N-1). IfEQUED = 'R'or'B',A(IA:IA+N-1,JA:JA+N-1)is multiplied on the left bydiag(R); ifEQUED='N'or'C',Ris not accessed.Ris an input variable ifFACT = 'F'; otherwise,Ris an output variable. IfFACT = 'F'andEQUED = 'R'or'B', each element ofRmust be positive.Ris replicated in every process column, and is aligned with the distributed matrixA. πC(local input or local output)DOUBLE PRECISIONarray, dimensionLOCc(N_A)β the column scale factors forA(IA:IA+N-1,JA:JA+N-1). IfEQUED = 'C'or'B',A(IA:IA+N-1,JA:JA+N-1)is multiplied on the right bydiag(C); ifEQUED = 'N'or'R',Cis not accessed.Cis an input variable ifFACT = 'F'; otherwise,Cis an output variable. IfFACT = 'F'andEQUED = 'C'orCis replicated in every process row, and is aligned with the distributed matrixA.B(local input/local output)DOUBLE PRECISIONpointer into the local memory to an array of local dimension(LLD_B,LOCc(JB+NRHS-1) ). On entry, theN-by-NRHSright-hand side matrixB(IB:IB+N-1,JB:JB+NRHS-1). On exit, ifEQUED = 'N',B(IB:IB+N-1,JB:JB+NRHS-1)is not modified; ifTRANS = 'N'andEQUED = 'R'or'B',Bis overwritten bydiag(R)*B(IB:IB+N-1,JB:JB+NRHS-1); ifTRANS = 'T'or'C'andEQUED = 'C'or'B',B(IB:IB+N-1,JB:JB+NRHS-1)is overwritten bydiag(C)*B(IB:IB+N-1,JB:JB+NRHS-1).IB(global input)INTEGERβ the row index in the global arrayBindicating the first row ofsub( B ).JB(global input)INTEGERβ the column index in the global arrayBindicating the first column ofsub( B ).DESCB(global and local input)INTEGERarray of dimensionDLEN_β the array descriptor for the distributed matrixB.X(local input/local output)DOUBLE PRECISIONpointer into the local memory to an array of local dimension(LLD_X, LOCc(JX+NRHS-1)). IfINFO = 0, theN-by-NRHSsolution matrixX(IX:IX+N-1,JX:JX+NRHS-1)to the original system of equations. Note thatA(IA:IA+N-1,JA:JA+N-1)andB(IB:IB+N-1,JB:JB+NRHS-1)are modified on exit ifEQUED .ne. 'N', and the solution to the equilibrated system isinv(diag(C))*X(IX:IX+N-1,JX:JX+NRHS-1)ifTRANS = 'N'andEQUED = 'C'or'B', orinv(diag(R))*X(IX:IX+N-1,JX:JX+NRHS-1)ifTRANS = 'T'or'C'andEQUED = 'R'or'B'.IX(global input)INTEGERβ the row index in the global arrayXindicating the first row ofsub( X ).JX(global input)INTEGERβ the column index in the global arrayXindicating the first column ofsub( X ).DESCX(global and local input)INTEGERarray of dimensionDLEN_β the array descriptor for the distributed matrixX.RCOND(global output)DOUBLE PRECISIONβ the estimate of the reciprocal condition number of the matrixA(IA:IA+N-1,JA:JA+N-1)after equilibration (if done). IfRCONDis less than the machine precision (in particular, ifRCOND = 0), the matrix is singular to working precision. This condition is indicated by a return code ofINFO > 0.FERR(local output)DOUBLE PRECISIONarray, dimensionLOCc(N_B)β the estimated forward error bounds for each solution vectorX(j)(thej-th column of the solution matrixX(IX:IX+N-1,JX:JX+NRHS-1)). IfXTRUEis the true solution,FERR(j)bounds the magnitude of the largest entry in(X(j) - XTRUE)divided by the magnitude of the largest entry inX(j). The estimate is as reliable as the estimate forRCOND, and is almost always a slight overestimate of the true error.FERRis replicated in every process row, and is aligned with the matricesBandX.BERR(local output)DOUBLE PRECISIONarray, dimensionLOCc(N_B)β the componentwise relative backward error of each solution vectorX(j)(i.e., the smallest relative change in any entry ofA(IA:IA+N-1,JA:JA+N-1)orB(IB:IB+N-1,JB:JB+NRHS-1)that makesX(j)an exact solution).BERRis replicated in every process row, and is aligned with the matricesBandX.WORK(local workspace/local output)DOUBLE PRECISIONarray, dimension(LWORK). On exit,WORK(1)returns the minimal and optimalLWORK.LWORK(local or global input)INTEGERβ the dimension of the arrayWORK.LWORKis local input and must be at leastLWORK = MAX( PDGECON( LWORK ), PDGERFS( LWORK ) ) + LOCr( N_A ). IfLWORK = -1, thenLWORKis global input and a workspace query is assumed; the routine only calculates the minimum and optimal size for all work arrays. Each of these values is returned in the first entry of the corresponding work array, and no error message is issued byPXERBLA.IWORK(local workspace/local output)INTEGERarray, dimension(LIWORK). On exit,IWORK(1)returns the minimal and optimalLIWORK.LIWORK(local or global input)INTEGERβ the dimension of the arrayIWORK.LIWORKis local input and must be at leastLIWORK = LOCr(N_A). IfLIWORK = -1, thenLIWORKis global input and a workspace query is assumed; the routine only calculates the minimum and optimal size for all work arrays. Each of these values is returned in the first entry of the corresponding work array, and no error message is issued byPXERBLA.INFO(global output)INTEGERβ= 0: successful exit.< 0: ifINFO = -i, thei-th argument had an illegal value.> 0: ifINFO = i, andiis<= N:U(IA+I-1,IA+I-1)is exactly zero. The factorization has been completed, but the factorUis exactly singular, so the solution and error bounds could not be computed.= N+1:RCONDis less than machine precision. The factorization has been completed, but the matrix is singular to working precision, and the solution and error bounds have not been computed.
That's the whole vibe check for PDGESVX(l) β brought to you by LAPACK version 1.5, dated 12 May 1997. Stay slay, bestie! πβ¨
π¦ 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