SRC/dgbsvxx.f(3)
πΈ SRC/dgbsvxx.f β Library Functions Manual, bestie edition πΈ
okay so this is the manual page for SRC/dgbsvxx.f, and it is lowkey iconic Fortran tea. We're talking band matrices, LU factorization, error bounds, the whole vibe. Let's get into it. π
β¨ SYNOPSIS β¨
π«Ά Functions/Subroutines
subroutine dgbsvxx (fact, trans, n, kl, ku, nrhs, ab, ldab, afb, ldafb,
ipiv, equed, r, c, b, ldb, x, ldx, rcond, rpvgrw, berr, n_err_bnds,
err_bnds_norm, err_bnds_comp, nparams, params, work, iwork, info)
DGBSVXX computes the solution to system of linear equations A * X = B for GB matrices. periodt. β¨
π¦ Function/Subroutine Documentation π¦
subroutine dgbsvxx (character fact, character trans, integer n, integer kl,
integer ku, integer nrhs, double precision, dimension( ldab, * ) ab,
integer ldab, double precision, dimension( ldafb, * ) afb, integer
ldafb, integer, dimension( * ) ipiv, character equed, double precision,
dimension( * ) r, double precision, dimension( * ) c, double precision,
dimension( ldb, * ) b, integer ldb, double precision, dimension( ldx , *
) x, integer ldx, double precision rcond, double precision rpvgrw,
double precision, dimension( * ) berr, integer n_err_bnds, double
precision, dimension( nrhs, * ) err_bnds_norm, double precision,
dimension( nrhs, * ) err_bnds_comp, integer nparams, double precision,
dimension( * ) params, double precision, dimension( * ) work, integer,
dimension( * ) iwork, integer info)
DGBSVXX computes the solution to system of linear equations A * X = B for GB matrices. π«Ά
π Purpose
ok so DGBSVXX uses the LU factorization to compute the solution to a double precision system of linear equations A * X = B, where A is an N-by-N matrix and X and B are N-by-NRHS matrices.
- If requested, both normwise and maximum componentwise error bounds are returned.
DGBSVXXwill return a solution with a tiny guaranteed error (O(eps)whereepsis the working machine precision) unless the matrix is very ill-conditioned, in which case a warning is returned. Relevant condition numbers also are calculated and returned. DGBSVXXaccepts user-provided factorizations and equilibration factors; see the definitions of theFACTandEQUEDoptions. Solving with refinement and using a factorization from a previousDGBSVXXcall will also produce a solution with eitherO(eps)errors or warnings, but we cannot make that claim for general user-provided factorizations and equilibration factors if they differ from whatDGBSVXXwould itself produce.
π₯ Description
The following steps are performed, bestie:
- If
FACT = 'E', double precision 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. slay. β¨
- If some
U(i,i)=0, so thatUis exactly singular, then the routine returns withINFO = i. Otherwise, the factored form ofAis used to estimate the condition number of the matrixA(see argumentRCOND). If the reciprocal of the condition number is less than machine precision, the routine still goes on to solve forXand compute error bounds as described below. - The system of equations is solved for
Xusing the factored form ofA. - By default (unless
PARAMS(LA_LINRX_ITREF_I)is set to zero), the routine will use iterative refinement to try to get a small error and error bounds. Refinement calculates the residual to at least twice the working precision. - If equilibration was used, the matrix
Xis premultiplied bydiag(C)(ifTRANS = 'N') ordiag(R)(ifTRANS = 'T'or'C') so that it solves the original system before equilibration.
okay so some optional parameters are bundled in thePARAMSarray. These settings determine how refinement is performed, but often the defaults are acceptable. If the defaults are acceptable, users can passNPARAMS = 0which prevents the source code from accessing thePARAMSargument. iykyk. π
π Parameters π
FACTβCHARACTER*1. Specifies whether or not the factored form of the matrixAis supplied on entry, and if not, whether the matrixAshould be equilibrated before it is factored.= 'F': On entry,AFandIPIVcontain the factored form ofA. IfEQUEDis not'N', the matrixAhas been equilibrated with scaling factors given byRandC.A,AF, andIPIVare not modified.= 'N': The matrixAwill be copied toAFand factored.= 'E': The matrixAwill be equilibrated if necessary, then copied toAFand factored.
TRANSβCHARACTER*1. Specifies the form of the system of equations:
= 'N': A * X = B (No transpose)
= 'T': A**T * X = B (Transpose)
= 'C': A**H * X = B (Conjugate Transpose = Transpose)
no cap, 'C' is just transpose here because the matrix is real. π
NβINTEGER. The number of linear equations, i.e., the order of the matrixA.N >= 0.KLβINTEGER. The number of subdiagonals within the band ofA.KL >= 0.KUβINTEGER. The number of superdiagonals within the band ofA.KU >= 0.NRHSβINTEGER. The number of right hand sides, i.e., the number of columns of the matricesBandX.NRHS >= 0.ABβDOUBLE PRECISION array, dimension (LDAB,N). On entry, the matrixAin band storage, in rows1toKL+KU+1. Thej-th column ofAis stored in thej-th column of the arrayABas follows:
AB(KU+1+i-j,j) = A(i,j) for max(1,j-KU)<=i<=min(N,j+kl)
If FACT = 'F' and EQUED is not 'N', then AB must have been equilibrated by the scaling factors in R and/or C. AB is not modified if FACT = 'F' or 'N', or if FACT = 'E' and EQUED = 'N' on exit.
On exit, if EQUED .ne. 'N', A is scaled as follows:
EQUED = 'R': A := diag(R) * A
EQUED = 'C': A := A * diag(C)
EQUED = 'B': A := diag(R) * A * diag(C).
LDABβINTEGER. The leading dimension of the arrayAB.LDAB >= KL+KU+1.AFBβDOUBLE PRECISION array, dimension (LDAFB,N). Here's the tea:- If
FACT = 'F', thenAFBis an input argument and on entry contains details of the LU factorization of the band matrixA, as computed byDGBTRF.Uis stored as an upper triangular band matrix withKL+KUsuperdiagonals in rows1toKL+KU+1, and the multipliers used during the factorization are stored in rowsKL+KU+2to2*KL+KU+1. IfEQUED .ne. 'N', thenAFBis the factored form of the equilibrated matrixA. - If
FACT = 'N', thenAFis an output argument and on exit returns the factorsLandUfrom the factorizationA = P*L*Uof the original matrixA. - If
FACT = 'E', thenAFis an output argument and on exit returns the factorsLandUfrom the factorizationA = P*L*Uof the equilibrated matrixA(see the description ofAfor the form of the equilibrated matrix).
- If
LDAFBβINTEGER. The leading dimension of the arrayAFB.LDAFB >= 2*KL+KU+1.IPIVβINTEGER array, dimension (N). Pivot central, honestly:- If
FACT = 'F', thenIPIVis an input argument and on entry contains the pivot indices from the factorizationA = P*L*Uas computed byDGETRF; rowiof the matrix was interchanged with rowIPIV(i). - If
FACT = 'N', thenIPIVis an output argument and on exit contains the pivot indices from the factorizationA = P*L*Uof the original matrixA. - If
FACT = 'E', thenIPIVis an output argument and on exit contains the pivot indices from the factorizationA = P*L*Uof the equilibrated matrixA.
- If
EQUEDβCHARACTER*1. Specifies the form of equilibration that was done.= 'N': No equilibration (always true ifFACT = 'N').= 'R': Row equilibration, i.e.,Ahas been premultiplied bydiag(R).= 'C': Column equilibration, i.e.,Ahas been postmultiplied bydiag(C).= 'B': Both row and column equilibration, i.e.,Ahas been replaced bydiag(R) * A * diag(C).
EQUED is an input argument if FACT = 'F'; otherwise, it is an output argument.
RβRβ DOUBLE PRECISION array, dimension (N). bestie this is the row scale factors for A π«Ά so like: ifEQUED = 'R'or'B', A gets multiplied on the left bydiag(R); ifEQUED = 'N'or'C', then R isn't even accessed (she's not invited to the function). R is an input argument ifFACT = 'F'; otherwise R is an output argument. And ifFACT = 'F'andEQUED = 'R'or'B', every single element of R must be positive β¨. If R is output, each element of R is a power of the radix. If R is input, each element of R should be a power of the radix β that's the vibe check for getting a reliable solution and reliable error estimates. Scaling by powers of the radix doesn't cause rounding errors unless the result underflows or overflows π. And rounding errors during scaling lead to refining with a matrix that is not equivalent to the input matrix, which produces error estimates that may not be reliable. no cap, that's the whole warning.Cβ DOUBLE PRECISION array, dimension (N). the column scale factors for A πΈ IfEQUED = 'C'or'B', A is multiplied on the right bydiag(C); ifEQUED = 'N'or'R', C is not accessed, periodt. C is an input argument ifFACT = 'F'; otherwise C is an output argument. IfFACT = 'F'andEQUED = 'C'or'B', each element of C must be positive π . If C is output, each element of C is a power of the radix. If C is input, each element of C should be a power of the radix to ensure a reliable solution and error estimates. Scaling by powers of the radix does not cause rounding errors unless the result underflows or overflows. Rounding errors during scaling lead to refining with a matrix that is not equivalent to the input matrix, producing error estimates that may not be reliable. (yes it's the same speech as R, she's consistent π)Bβ DOUBLE PRECISION array, dimension (LDB,NRHS). On entry, this is the N-by-NRHS right hand side matrix B π. On exit, it's giving:- if
EQUED = 'N', B is not modified; - if
TRANS = 'N'andEQUED = 'R'or'B', B is overwritten bydiag(R)*B; - if
TRANS = 'T'or'C'andEQUED = 'C'or'B', B is overwritten bydiag(C)*B.
- if
LDBβ INTEGER. The leading dimension of the array B. The rule isLDB >= max(1,N)β don't fight it.Xβ DOUBLE PRECISION array, dimension (LDX,NRHS). IfINFO = 0, this is the N-by-NRHS solution matrix X to the original system of equations π. Quick heads up though: note that A and B are modified on exit ifEQUED .ne. 'N', and the solution to the equilibrated system isinv(diag(C))*XifTRANS = 'N'andEQUED = 'C'or'B', orinv(diag(R))*XifTRANS = 'T'or'C'andEQUED = 'R'or'B'. like, read that twice bestie πLDXβ INTEGER. The leading dimension of the array X.LDX >= max(1,N). same energy, different letter πRCONDβ DOUBLE PRECISION. Reciprocal scaled condition number π₯. This is an estimate of the reciprocal Skeel condition number of the matrix A after equilibration (if done). If this is less than the machine precision (in particular, if it is zero), the matrix is singular to working precision π. But plot twist: the error may still be small even if this number is very small and the matrix appears ill-conditioned. she's complicated like that.RPVGRWβ DOUBLE PRECISION. Reciprocal pivot growth π±. On exit, this contains the reciprocal pivot growth factornorm(A)/norm(U). The norm is used. If this is much less than 1, then the stability of the LU factorization of the (equilibrated) matrix A could be poor π¬. This also means that the solution X, the estimated condition numbers, and the error bounds could be unreliable. And if factorization fails with0<INFO<=N, then this contains the reciprocal pivot growth factor for the leadingINFOcolumns of A. Fun fact: inDGESVX, this quantity is returned inWORK(1)π.BERRβ DOUBLE PRECISION array, dimension (NRHS). Componentwise relative backward error β¨. This is the componentwise relative backward error of each solution vectorX(j)β i.e., the smallest relative change in any element of A or B that makesX(j)an exact solution. tiny change, big consequences, iykyk.N_ERR_BNDSβ INTEGER. Number of error bounds to return for each right hand side and each type (normwise or componentwise) π¦. SeeERR_BNDS_NORMandERR_BNDS_COMPbelow, they're coming right up.ERR_BNDS_NORMβ DOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS). For each right-hand side, this array contains info about various error bounds and condition numbers corresponding to the normwise relative error, which is defined as follows π:
Normwise relative error in the *i*th solution vector:
max_j (abs(XTRUE(j,i) - X(j,i)))
------------------------------
max_j abs(X(j,i))
The array is indexed by the type of error information as described below. There currently are up to three pieces of information returned.
The first index in ERR_BNDS_NORM(i,:) corresponds to the *i*th right-hand side.
The second index in ERR_BNDS_NORM(:,err) contains the following three fields:
err = 1β boolean. Trust the answer if the reciprocal condition number is less than the thresholdsqrt(n) * dlamch('Epsilon').err = 2β error bound: the estimated forward error, almost certainly within a factor of10of the true error so long as the next entry is greater than the thresholdsqrt(n) * dlamch('Epsilon'). This error bound should only be trusted if the previous boolean is true π.err = 3β Reciprocal condition number: estimated normwise reciprocal condition number. Compared with the thresholdsqrt(n) * dlamch('Epsilon')to determine if the error estimate is . These reciprocal condition numbers are1 / (norm(Z^{-1},inf) * norm(Z,inf))for some appropriately scaled matrix Z. LetZ = S*A, where S scales each row by a power of the radix so all absolute row sums of Z are approximately1π.
See Lapack Working Note 165 for further details and extra cautions π.
ERR_BNDS_COMPβ DOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS). For each right-hand side, this array contains info about various error bounds and condition numbers corresponding to the componentwise relative error, defined as follows πΈ:
Componentwise relative error in the *i*th solution vector:
abs(XTRUE(j,i) - X(j,i))
max_j ----------------------
abs(X(j,i))
The array is indexed by the right-hand side i (on which the componentwise relative error depends), and the type of error information as described below. There currently are up to three pieces of information returned for each right-hand side. If componentwise accuracy is not requested (PARAMS(3) = 0.0), then ERR_BNDS_COMP is not accessed π«. If N_ERR_BNDS < 3, then at most the first (:,N_ERR_BNDS) entries are returned.
The first index in ERR_BNDS_COMP(i,:) corresponds to the *i*th right-hand side.
The second index in ERR_BNDS_COMP(:,err) contains the following three fields:
err = 1β boolean. Trust the answer if the reciprocal condition number is less than the thresholdsqrt(n) * dlamch('Epsilon').err = 2β error bound: the estimated forward error, almost certainly within a factor of10of the true error so long as the next entry is greater than the thresholdsqrt(n) * dlamch('Epsilon'). This error bound should only be trusted if the previous boolean is true.err = 3β Reciprocal condition number: estimated componentwise reciprocal condition number. Compared with the thresholdsqrt(n) * dlamch('Epsilon')to determine if the error estimate is . These reciprocal condition numbers are1 / (norm(Z^{-1},inf) * norm(Z,inf))for some appropriately scaled matrix Z. LetZ = S*(A*diag(x)), wherexis the solution for the current right-hand side and S scales each row ofA*diag(x)by a power of the radix so all absolute row sums of Z are approximately1β¨.
See Lapack Working Note 165 for further details and extra cautions π (yes, same note, she means it both times).
NPARAMSβ INTEGER. Specifies the number of parameters set inPARAMSπ§. If<= 0, thePARAMSarray is never referenced and default values are used. icon behaviour honestly.PARAMSβ
PARAMS is a DOUBLE PRECISION array, dimension (NPARAMS). It's giving "algorithm knobs" energy: if an entry is < 0.0, then that entry will be filled with the default value used for that parameter. Only positions up to NPARAMS are accessed; defaults are used for higher-numbered parameters. Bestie, the vibe is: pass a negative placeholder and the routine fills in the default for you π
PARAMS(LA_LINRX_ITREF_I = 1)β whether to perform iterative refinement or not.- Default:
1.0D+0 = 0.0: no refinement is performed, and no error bounds are computed.= 1.0: use the extra-precise refinement algorithm.- (other values are reserved for future use)
- Default:
PARAMS(LA_LINRX_ITHRESH_I = 2)β maximum number of residual computations allowed for refinement.- Default:
10 - Aggressive: set to
100to permit convergence using approximate factorizations or factorizations other thanLU.
- Default:
β οΈ If the factorization uses a technique other than Gaussian elimination, the guarantees inerr_bnds_normanderr_bnds_compmay no longer be trustworthy.
PARAMS(LA_LINRX_CWISE_I = 3)β flag determining if the code will attempt to find a solution with small componentwise relative error in the double-precision algorithm. Positive is true,0.0is false.- Default:
1.0(attempt componentwise convergence)
- Default:
π§° WORK
WORK is DOUBLE PRECISION array, dimension (4*N).
ποΈ IWORK
IWORK is INTEGER array, dimension (N).
π¨ INFO
INFO is INTEGER. The status tea is:
= 0β successful exit. The solution to every right-hand side is guaranteed.< 0β ifINFO = -i, thei-th argument had an illegal value.> 0and<= NβU(INFO,INFO)is exactly zero. The factorization has been completed, but the factorUis exactly singular, so the solution and error bounds could not be computed.RCOND = 0is returned.= N+Jβ the solution corresponding to theJth right-hand side is not guaranteed. The solutions corresponding to other right-hand sidesKwithK > Jmay not be guaranteed as well, but only the first such right-hand side is reported. If a small componentwise error is not requested (PARAMS(3) = 0.0) then theJth right-hand side is the first with a normwise error bound that is not guaranteed (the smallestJsuch thatERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0) theJth right-hand side is the first with either a normwise or componentwise error bound that is not guaranteed (the smallestJsuch that eitherERR_BNDS_NORM(J,1) = 0.0orERR_BNDS_COMP(J,1) = 0.0). See the definition ofERR_BNDS_NORM(:,1)andERR_BNDS_COMP(:,1). To get information about all of the right-hand sides checkERR_BNDS_NORMorERR_BNDS_COMP.
π Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Definition at line 555 of file dgbsvxx.f.
π Author
Generated automatically by Doxygen for LAPACK from the source code.
Okay that's the whole tea: LAPACK Version 3.12.0, source SRC/dgbsvxx.f(3) β the footer snippet didn't show a date, so I'm not inventing one, periodt. Catch you later, bestie πβ¨
π¦ where this page comes from
- arch rolling: lapack-doc 3.12.1-2 Β· custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms