realGBcomputational(3)
π realGBcomputational(3) π β the LAPACK real-GB-computational girlies
okay bestie, so this is a LAPACK page, section 3, and the manual name is literally realGBcomputational. Yes. That's the whole name. We're doing band matrices today and we're doing them flawlessly. π
πΈ NAME πΈ
realGBcomputational β real. that's it. that's the description. she's real. π«Ά
β¨ SYNOPSIS β¨
π Functions π
sgbbrdβ SGBBRD
subroutine sgbbrd (VECT, M, N, NCC, KL, KU, AB, LDAB, D, E, Q, LDQ, PT,
LDPT, C, LDC, WORK, INFO)
sgbconβ SGBCON
subroutine sgbcon (NORM, N, KL, KU, AB, LDAB, IPIV, ANORM, RCOND, WORK,
IWORK, INFO)
sgbequβ SGBEQU
subroutine sgbequ (M, N, KL, KU, AB, LDAB, R, C, ROWCND, COLCND, AMAX,
INFO)
sgbequbβ SGBEQUB
subroutine sgbequb (M, N, KL, KU, AB, LDAB, R, C, ROWCND, COLCND, AMAX,
INFO)
sgbrfsβ SGBRFS
subroutine sgbrfs (TRANS, N, KL, KU, NRHS, AB, LDAB, AFB, LDAFB, IPIV,
B, LDB, X, LDX, FERR, BERR, WORK, IWORK, INFO)
sgbrfsxβ SGBRFSX
subroutine sgbrfsx (TRANS, EQUED, N, KL, KU, NRHS, AB, LDAB, AFB, LDAFB,
IPIV, R, C, B, LDB, X, LDX, RCOND, BERR, N_ERR_BNDS, ERR_BNDS_NORM,
ERR_BNDS_COMP, NPARAMS, PARAMS, WORK, IWORK, INFO)
sgbtf2β SGBTF2 computes the LU factorization of a general band matrix using the unblocked version of the algorithm.
subroutine sgbtf2 (M, N, KL, KU, AB, LDAB, IPIV, INFO)
sgbtrfβ SGBTRF
subroutine sgbtrf (M, N, KL, KU, AB, LDAB, IPIV, INFO)
sgbtrsβ SGBTRS
subroutine sgbtrs (TRANS, N, KL, KU, NRHS, AB, LDAB, IPIV, B, LDB, INFO)
sggbakβ SGGBAK
subroutine sggbak (JOB, SIDE, N, ILO, IHI, LSCALE, RSCALE, M, V, LDV,
INFO)
sggbalβ SGGBAL
subroutine sggbal (JOB, N, A, LDA, B, LDB, ILO, IHI, LSCALE, RSCALE,
WORK, INFO)
sla_gbamvβ SLA_GBAMV performs a matrix-vector operation to calculate error bounds.
subroutine sla_gbamv (TRANS, M, N, KL, KU, ALPHA, AB, LDAB, X, INCX,
BETA, Y, INCY)
sla_gbrcondβ SLA_GBRCOND estimates the Skeel condition number for a general banded matrix.
real function sla_gbrcond (TRANS, N, KL, KU, AB, LDAB, AFB, LDAFB, IPIV,
CMODE, C, INFO, WORK, IWORK)
sla_gbrfsx_extendedβ SLA_GBRFSX_EXTENDED improves the computed solution to a system of linear equations for general banded matrices by performing extra-precise iterative refinement and provides error bounds and backward error estimates for the solution.
subroutine sla_gbrfsx_extended (PREC_TYPE, TRANS_TYPE, N, KL, KU, NRHS,
AB, LDAB, AFB, LDAFB, IPIV, COLEQU, C, B, LDB, Y, LDY, BERR_OUT,
N_NORMS, ERR_BNDS_NORM, ERR_BNDS_COMP, RES, AYB, DY, Y_TAIL, RCOND,
ITHRESH, RTHRESH, DZ_UB, IGNORE_CWISE, INFO)
sla_gbrpvgrwβ SLA_GBRPVGRW computes the reciprocal pivot growth factor norm(A)/norm(U) for a general banded matrix.
real function sla_gbrpvgrw (N, KL, KU, NCOLS, AB, LDAB, AFB, LDAFB)
sorgbrβ SORGBR
subroutine sorgbr (VECT, M, N, K, A, LDA, TAU, WORK, LWORK, INFO)
π Detailed Description π
This is the group of real computational functions for GB matrices. that's the vibe. banded girlies, we ride at dawn π¦
π Function Documentation π
β subroutine sgbbrd β
subroutine sgbbrd (character VECT, integer M, integer N, integer NCC,
integer KL, integer KU, real, dimension( ldab, * ) AB, integer LDAB,
real, dimension( * ) D, real, dimension( * ) E, real, dimension( ldq, *
) Q, integer LDQ, real, dimension( ldpt, * ) PT, integer LDPT, real,
dimension( ldc, * ) C, integer LDC, real, dimension( * ) WORK, integer
INFO)
SGBBRD
π― Purpose:
SGBBRD reduces a real general m-by-n band matrix A to upper bidiagonal form B by an orthogonal transformation: Q**T * A * P = B.
The routine computes B, and optionally forms Q or PT, or computes QT*C for a given matrix C.
not me getting emotional over a bidiagonal reduction π she really said "orthogonal transformation" and served.
π§ Parameters
VECT
VECT is CHARACTER*1 Specifies whether or not the matrices Q and P**T are to be formed.
= 'N': do not form Q or P**T;= 'Q': form Q only;= 'P': form P**T only;= 'B': form both.
M
M is INTEGER The number of rows of the matrix A. M >= 0.
N
N is INTEGER The number of columns of the matrix A. N >= 0.
NCC
NCC is INTEGER The number of columns of the matrix C. NCC >= 0.
KL
KL is INTEGER The number of subdiagonals of the matrix A. KL >= 0.
KU
KU is INTEGER The number of superdiagonals of the matrix A. KU >= 0.
AB
AB is REAL array, dimension (LDAB,N) On entry, the m-by-n band matrix A, stored in rows 1 to KL+KU+1. The j-th column of A is stored in the j-th column of the array AB as follows: AB(ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(m,j+kl). On exit, A is overwritten by values generated during the reduction.
LDAB
LDAB is INTEGER The leading dimension of the array A. LDAB >= KL+KU+1.
D
D is REAL array, dimension (min(M,N)) The diagonal elements of the bidiagonal matrix B.
E
E is REAL array, dimension (min(M,N)-1) The superdiagonal elements of the bidiagonal matrix B.
Q
Q is REAL array, dimension (LDQ,M) If VECT = 'Q' or 'B', the m-by-m orthogonal matrix Q. If VECT = 'N' or 'P', the array Q is not referenced.
LDQ
LDQ is INTEGER The leading dimension of the array Q. LDQ >= max(1,M) if VECT = 'Q' or 'B'; LDQ >= 1 otherwise.
PT
PT is REAL array, dimension (LDPT,N) If VECT = 'P' or 'B', the n-by-n orthogonal matrix P'. If VECT = 'N' or 'Q', the array PT is not referenced.
LDPT
LDPT is INTEGER The leading dimension of the array PT. LDPT >= max(1,N) if VECT = 'P' or 'B'; LDPT >= 1 otherwise.
C
C is REAL array, dimension (LDC,NCC) On entry, an m-by-ncc matrix C. On exit, C is overwritten by Q**T*C. C is not referenced if NCC = 0.
LDC
LDC is INTEGER The leading dimension of the array C. LDC >= max(1,M) if NCC > 0; LDC >= 1 if NCC = 0.
WORK
WORK is REAL array, dimension (2*max(M,N))
INFO
INFO is INTEGER
= 0: successful exit.< 0: ifINFO = -i, the i-th argument had an illegal value.
π«Ά Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
β subroutine sgbcon β
subroutine sgbcon (character NORM, integer N, integer KL, integer KU, real,
dimension( ldab, * ) AB, integer LDAB, integer, dimension( * ) IPIV,
real ANORM, real RCOND, real, dimension( * ) WORK, integer, dimension( *
) IWORK, integer INFO)
SGBCON
π― Purpose:
SGBCON estimates the reciprocal of the condition number of a real general band matrix A, in either the 1-norm or the infinity-norm, using the LU factorization computed by SGBTRF.
An estimate is obtained for norm(inv(A)), and the reciprocal of the condition number is computed as RCOND = 1 / ( norm(A) * norm(inv(A)) ).
π§ Parameters
NORM
NORM is CHARACTER*1 Specifies whether the 1-norm condition number or the infinity-norm condition number is required:
= '1'or'O': 1-norm;= 'I': Infinity-norm.
N
N is INTEGER The order of the matrix A. N >= 0.
KL
KL is INTEGER The number of subdiagonals within the band of A. KL >= 0.
KU
KU is INTEGER The number of superdiagonals within the band of A. KU >= 0.
AB
AB is REAL array, dimension (LDAB,N) Details of the LU factorization of the band matrix A, as computed by SGBTRF. U is stored as an upper triangular band matrix with KL+KU superdiagonals in rows 1 to KL+KU+1, and the multipliers used during the factorization are stored in rows KL+KU+2 to 2*KL+KU+1.
LDAB
LDAB is INTEGER The leading dimension of the array AB. LDAB >= 2*KL+KU+1.
IPIV
IPIV is INTEGER array, dimension (N) The pivot indices; for 1 <= i <= N, row i of the matrix was interchanged with row IPIV(i).
ANORM
ANORM is REAL If NORM = '1' or 'O', the 1-norm of the original matrix A. If NORM = 'I', the infinity-norm of the original matrix A.
RCOND
RCOND is REAL The reciprocal of the condition number of the matrix A, computed as RCOND = 1/(norm(A) * norm(inv(A))).
WORK
WORK is REAL array, dimension (3*N)
IWORK
IWORK is INTEGER array, dimension (N)
INFO
INFO is INTEGER
= 0: successful exit< 0: ifINFO = -i, the i-th argument had an illegal value
π«Ά Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
β subroutine sgbequ β
subroutine sgbequ (integer M, integer N, integer KL, integer KU, real,
dimension( ldab, * ) AB, integer LDAB, real, dimension( * ) R, real,
dimension( * ) C, real ROWCND, real COLCND, real AMAX, integer INFO)
SGBEQU
π― Purpose:
SGBEQU computes row and column scalings intended to equilibrate an M-by-N band matrix A and reduce its condition number. R returns the row scale factors and C the column scale factors, chosen to try to make the largest element in each row and column of the matrix B with elements B(i,j)=R(i)*A(i,j)*C(j) have absolute value 1.
R(i) and C(j) are restricted to be between SMLNUM = smallest safe number and BIGNUM = largest safe number. Use of these scaling factors is not guaranteed to reduce the condition number of A but works well in practice.
"not guaranteed" but "works well in practice" β she's honest AND she delivers, that's the whole energy π₯
π§ Parameters
M
M is INTEGER The number of rows of the matrix A. M >= 0.
N
N is INTEGER The number of columns of the matrix A. N >= 0.
KL
KL is INTEGER The number of subdiagonals within the band of A. KL >= 0.
KU
KU is INTEGER The number of superdiagonals within the band of A. KU >= 0.
ABABβ REAL array, dimension(LDAB,N). The band matrix A, stored in rows 1 toKL+KU+1. The j-th column of A lives in the j-th column of the array AB, like so:
AB(ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(m,j+kl).
LDABβ INTEGER. The leading dimension of the array AB.LDAB >= KL+KU+1.Rβ REAL array, dimension(M). IfINFO = 0, orINFO > M, R contains the row scale factors for A. bestie that's the row glow-up right there πCβ REAL array, dimension(N). IfINFO = 0, C contains the column scale factors for A. column glow-up, equally iconic β¨ROWCNDβ REAL. IfINFO = 0orINFO > M, ROWCND contains the ratio of the smallestR(i)to the largestR(i). IfROWCND >= 0.1and AMAX is neither too large nor too small, it is not worth scaling by R. Like, don't bother, it's giving "already fine" π«ΆCOLCNDβ REAL. IfINFO = 0, COLCND contains the ratio of the smallestC(i)to the largestC(i). IfCOLCND >= 0.1, it is not worth scaling by C. Same energy, different axis.AMAXβ REAL. Absolute value of largest matrix element. If AMAX is very close to overflow or very close to underflow, the matrix should be scaled. No cap, that's the vibe check failing.INFOβ INTEGER. The receipts:= 0: successful exit β¨< 0: ifINFO = -i, the i-th argument had an illegal value π> 0: ifINFO = i, and i is<= M: the i-th row of A is exactly zero π> M: the(i-M)-th column of A is exactly zero π
π Author π
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
πΈ subroutine sgbequb πΈ
subroutine sgbequb (integer M, integer N, integer KL, integer KU, real,
dimension( ldab, * ) AB, integer LDAB, real, dimension( * ) R, real,
dimension( * ) C, real ROWCND, real COLCND, real AMAX, integer INFO)
SGBEQUB
π Purpose
SGBEQUB computes row and column scalings intended to equilibrate an M-by-N matrix A and reduce its condition number. R returns the row scale factors and C the column scale factors, chosen to try to make the largest element in each row and column of the matrix B with elements B(i,j)=R(i)*A(i,j)*C(j) have an absolute value of at most the radix.
R(i) and C(j) are restricted to be a power of the radix between SMLNUM = smallest safe number and BIGNUM = largest safe number. Use of these scaling factors is not guaranteed to reduce the condition number of A but works well in practice. (she's honest about her limits, we love that) π¦
This routine differs from SGEEQU by restricting the scaling factors to a power of the radix. Barring over- and underflow, scaling by these factors introduces no additional rounding errors. However, the scaled entries' magnitudes are no longer approximately 1 but lie between sqrt(radix) and 1/sqrt(radix). it's giving "different, not worse" π
β¨ Parameters β¨
Mβ INTEGER. The number of rows of the matrix A.M >= 0.Nβ INTEGER. The number of columns of the matrix A.N >= 0.KLβ INTEGER. The number of subdiagonals within the band of A.KL >= 0.KUβ INTEGER. The number of superdiagonals within the band of A.KU >= 0.ABβ REAL array, dimension(LDAB,N). On entry, the matrix A in band storage, in rows 1 toKL+KU+1. The j-th column of A is stored in the j-th column of the array AB as follows:
AB(KU+1+i-j,j) = A(i,j) for max(1,j-KU)<=i<=min(N,j+kl)
LDABβ INTEGER. The leading dimension of the array A.LDAB >= max(1,M).Rβ REAL array, dimension(M). IfINFO = 0orINFO > M, R contains the row scale factors for A. πCβ REAL array, dimension(N). IfINFO = 0, C contains the column scale factors for A. πROWCNDβ REAL. IfINFO = 0orINFO > M, ROWCND contains the ratio of the smallestR(i)to the largestR(i). IfROWCND >= 0.1and AMAX is neither too large nor too small, it is not worth scaling by R.COLCNDβ REAL. IfINFO = 0, COLCND contains the ratio of the smallestC(i)to the largestC(i). IfCOLCND >= 0.1, it is not worth scaling by C.AMAXβ REAL. Absolute value of largest matrix element. If AMAX is very close to overflow or very close to underflow, the matrix should be scaled. watch out bestie β οΈINFOβ INTEGER.= 0: successful exit β¨< 0: ifINFO = -i, the i-th argument had an illegal value π> 0: ifINFO = i, and i is<= M: the i-th row of A is exactly zero> M: the(i-M)-th column of A is exactly zero
π Author π
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
π subroutine sgbrfs π
subroutine sgbrfs (character TRANS, integer N, integer KL, integer KU,
integer NRHS, real, dimension( ldab, * ) AB, integer LDAB, real,
dimension( ldafb, * ) AFB, integer LDAFB, integer, dimension( * ) IPIV,
real, dimension( ldb, * ) B, integer LDB, real, dimension( ldx, * ) X,
integer LDX, real, dimension( * ) FERR, real, dimension( * ) BERR, real,
dimension( * ) WORK, integer, dimension( * ) IWORK, integer INFO)
SGBRFS
π Purpose
SGBRFS improves the computed solution to a system of linear equations when the coefficient matrix is banded, and provides error bounds and backward error estimates for the solution. she's the friend who double-checks your homework and then tells you exactly how confident she is about it π«Ά
β¨ Parameters β¨
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)
Nβ INTEGER. The order of the matrix A.N >= 0.KLβ INTEGER. The number of subdiagonals within the band of A.KL >= 0.KUβ INTEGER. The number of superdiagonals within the band of A.KU >= 0.NRHSβ INTEGER. The number of right hand sides, i.e., the number of columns of the matrices B and X.NRHS >= 0.ABβ REAL array, dimension(LDAB,N). The original band matrix A, stored in rows 1 toKL+KU+1. The j-th column of A is stored in the j-th column of the array AB as follows:
AB(ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(n,j+kl).
LDABβ INTEGER. The leading dimension of the array AB.LDAB >= KL+KU+1.AFBβ REAL array, dimension(LDAFB,N). Details of the LU factorization of the band matrix A, as computed bySGBTRF. U is stored as an upper triangular band matrix withKL+KUsuperdiagonals in rows 1 toKL+KU+1, and the multipliers used during the factorization are stored in rowsKL+KU+2to2*KL+KU+1. so much going on in one array, she's booked and busy πLDAFBβ INTEGER. The leading dimension of the array AFB.LDAFB >= 2*KL*KU+1.IPIVβ INTEGER array, dimension(N). The pivot indices fromSGBTRF; for1<=i<=N, row i of the matrix was interchanged with rowIPIV(i).Bβ REAL array, dimension(LDB,NRHS). The right hand side matrix B. πLDBβ INTEGER. The leading dimension of the array B.LDB >= max(1,N).Xβ REAL array, dimension(LDX,NRHS). On entry, the solution matrix X, as computed bySGBTRS. On exit, the improved solution matrix X. β¨LDXβ INTEGER. The leading dimension of the array X.LDX >= max(1,N).FERRβ REAL array, dimension(NRHS). The estimated forward error bound for each solution vectorX(j)(the j-th column of the solution matrix X). IfXTRUEis the true solution corresponding toX(j),FERR(j)is an estimated upper bound for the magnitude of the largest element in(X(j) - XTRUE)divided by the magnitude of the largest element inX(j). The estimate is as reliable as the estimate forRCOND, and is almost always a slight overestimate of the true error. she's dramatic but in a safe direction, we respect itBERRβ REAL array, dimension(NRHS). 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).WORKβ REAL array, dimension(3*N).IWORKβ INTEGER array, dimension(N).INFOβ INTEGER.= 0: successful exit β¨< 0: ifINFO = -i, the i-th argument had an illegal value π
π§ Internal Parameters π§
ITMAX is the maximum number of steps of iterative refinement. she keeps trying, she's persistent, main character energy π
π Author π
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
π« subroutine sgbrfsx π«
subroutine sgbrfsx (character TRANS, character EQUED, integer N, integer KL,
integer KU, integer NRHS, real, dimension( ldab, * ) AB, integer LDAB,
real, dimension( ldafb, * ) AFB, integer LDAFB, integer, dimension( * )
IPIV, real, dimension( * ) R, real, dimension( * ) C, real, dimension(
ldb, * ) B, integer LDB, real, dimension( ldx , * ) X, integer LDX, real
RCOND, real, dimension( * ) BERR, integer N_ERR_BNDS, real, dimension(
nrhs, * ) ERR_BNDS_NORM, real, dimension( nrhs, * ) ERR_BNDS_COMP,
integer NPARAMS, real, dimension( * ) PARAMS, real, dimension( * ) WORK,
integer, dimension( * ) IWORK, integer INFO)
SGBRFSX
π Purpose
Okay so SGBRFSX is the glow-up routine π
β it takes your computed solution to a system of linear equations and makes it better, and it also hands you error bounds and backward error estimates for the solution. And bestie, it doesn't just do normwise error bound β if it can, it also gives you the maximum componentwise error bound. If you wanna know the deets of those bounds, the comments for ERR_BNDS_NORM and ERR_BNDS_COMP have you covered. π«Ά
Also important: your original system of linear equations might have been equilibrated before you called this routine β that's what EQUED, R and C are here to tell it. If that happened, the solution and error bounds you get back are for the original unequilibrated system. No cap.
And there's this whole bundle of optional parameters living in the PARAMS array. Those settings decide how the refinement is performed, but honestly? The defaults usually eat. β¨ If the defaults are fine for you, you can pass NPARAMS = 0 and the source code won't even touch the PARAMS argument. Periodt.
β¨ Parameters β¨
TRANSβTRANS is 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)
EQUEDβEQUED is CHARACTER*1
Specifies the form of equilibration that was done to A before calling this routine. This matters, fr fr β it's needed to compute the solution and error bounds correctly.
= 'N': No equilibration= 'R': Row equilibration, i.e., A has been premultiplied by diag(R).= 'C': Column equilibration, i.e., A has been postmultiplied by diag(C).= 'B': Both row and column equilibration, i.e., A has been replaced by diag(R) * A * diag(C).The right hand sideBhas been changed accordingly.
NβN is INTEGER
The order of the matrix A. N >= 0.
KLβKL is INTEGER
The number of subdiagonals within the band of A. KL >= 0.
KUβKU is INTEGER
The number of superdiagonals within the band of A. KU >= 0.
NRHSβNRHS is INTEGER
The number of right hand sides, i.e., the number of columns of the matrices B and X. NRHS >= 0.
ABβAB is REAL array, dimension (LDAB,N)
The original band matrix A, stored in rows 1 to KL+KU+1. The j-th column of A is stored in the j-th column of the array AB as follows:
AB(ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(n,j+kl).
LDABβLDAB is INTEGER
The leading dimension of the array AB. LDAB >= KL+KU+1.
AFBβAFB is REAL array, dimension (LDAFB,N)
Details of the LU factorization of the band matrix A, as computed by SGBTRF. U is stored as an upper triangular band matrix with KL+KU superdiagonals in rows 1 to KL+KU+1, and the multipliers used during the factorization are stored in rows KL+KU+2 to 2*KL+KU+1.
LDAFBβLDAFB is INTEGER
The leading dimension of the array AFB. LDAFB >= 2*KL*KU+1.
IPIVβIPIV is INTEGER array, dimension (N)
The pivot indices from SGETRF; for 1<=i<=N, row i of the matrix was interchanged with row IPIV(i).
RβR is REAL array, dimension (N)
The row scale factors for A. If EQUED = 'R' or 'B', A is multiplied on the left by diag(R); if EQUED = 'N' or 'C', R is not accessed. R is an input argument if FACT = 'F'; otherwise, R is an output argument. If FACT = 'F' and EQUED = 'R' or 'B', each 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 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.
Bestie, listen. Rounding errors during scaling lead to refining with a matrix that is not equivalent to the input matrix, and that produces error estimates that may not be reliable. π Don't play with it.
CβC is REAL array, dimension (N)
The column scale factors for A. If EQUED = 'C' or 'B', A is multiplied on the right by diag(C); if EQUED = 'N' or 'R', C is not accessed. C is an input argument if FACT = 'F'; otherwise, C is an output argument. If FACT = 'F' and EQUED = '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.
Same warning as R, no cap: 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. π
BβB is REAL array, dimension (LDB,NRHS)
The right hand side matrix B.
LDBβLDB is INTEGER
The leading dimension of the array B. LDB >= max(1,N).
XβX is REAL array, dimension (LDX,NRHS)
On entry, the solution matrix X, as computed by SGETRS. On exit, the improved solution matrix X. Glow-up complete. β¨
LDXβLDX is INTEGER
The leading dimension of the array X. LDX >= max(1,N).
RCONDβRCOND is REAL
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. Note that the error may still be small even if this number is very small and the matrix appears ill-conditioned.
BERRβBERR is REAL array, dimension (NRHS)
Componentwise relative backward error. This is the componentwise relative backward error of each solution vector X(j) (i.e., the smallest relative change in any element of A or B that makes X(j) an exact solution).
N_ERR_BNDSβN_ERR_BNDS is INTEGER
Number of error bounds to return for each right hand side and each type (normwise or componentwise). See ERR_BNDS_NORM and ERR_BNDS_COMP below.
ERR_BNDS_NORMβERR_BNDS_NORM is REAL array, dimension (NRHS, N_ERR_BNDS)
For each right-hand side, this array contains information about various error bounds and condition numbers corresponding to the normwise relative error, which is defined as follows:
Normwise relative error in the ith 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 ith right-hand side.
The second index in ERR_BNDS_NORM(:,err) contains the following three fields:
err = 1'Trust/don't trust' boolean. Trust the answer if the reciprocal condition number is less than the thresholdsqrt(n) * slamch('Epsilon').err = 2'Guaranteed' 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) * slamch('Epsilon'). This error bound should only be trusted if the previous boolean is true.err = 3Reciprocal condition number: Estimated normwise reciprocal condition number. Compared with the thresholdsqrt(n) * slamch('Epsilon')to determine if the error estimate is 'guaranteed'. These reciprocal condition numbers are1 / (norm(Z^{-1},inf) * norm(Z,inf))for some appropriately scaled matrixZ. LetZ = S*A, whereSscales each row by a power of the radix so all absolute row sums ofZare approximately1.
See Lapack Working Note 165 for further details and extra cautions.
ERR_BNDS_COMPβERR_BNDS_COMP is REAL array, dimension (NRHS, N_ERR_BNDS)
For each right-hand side, this array contains information about various error bounds and condition numbers corresponding to the componentwise relative error, which is defined as follows:
Componentwise relative error in the ith 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 ith right-hand side.
The second index in ERR_BNDS_COMP(:,err) contains the following three fields:
err = 1'Trust/don't trust' boolean. Trust the answer if the reciprocal condition number is less than the thresholdsqrt(n) * slamch('Epsilon').err = 2'Guaranteed' 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) * slamch('Epsilon'). This error bound should only be trusted if the previous boolean is true.
err = 3 β Reciprocal condition number, bestie π
it's the estimated componentwise reciprocal condition number. The routine compares it against the threshold sqrt(n) * slamch('Epsilon') to decide whether the error estimate is 'guaranteed' or not. These reciprocal condition numbers are literally 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some appropriately scaled matrix Z.
And Z? Let Z = S*(A*diag(x)), where x is the solution for the current right-hand side and S scales each row of A*diag(x) by a power of the radix so that all the absolute row sums of Z are approximately 1. Math is mathing π§
Go read Lapack Working Note 165 for further details and extra cautions β fr fr, there's lore there.
NPARAMS
NPARAMS is INTEGER
Specifies the number of parameters set in PARAMS. If <= 0, the PARAMS array is never even looked at and default values are used instead. Respect the boundary π
PARAMS
PARAMS is REAL array, dimension NPARAMS
Specifies algorithm parameters. If an entry is < 0.0, then that entry gets filled in with the default value used for that parameter. Only positions up to NPARAMS are accessed; defaults are used for higher-numbered parameters. So yeah, you can be lazy on purpose π
PARAMS(LA_LINRX_ITREF_I = 1): Whether to perform iterative refinement or not.- Default:
1.0 = 0.0: No refinement is performed, and no error bounds are computed.= 1.0: Use the double-precision refinement algorithm, possibly with doubled-single computations if the compilation environment does not supportDOUBLE PRECISION.- (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 than LU. If the factorization uses a technique other than Gaussian elimination, the guarantees inerr_bnds_normanderr_bnds_compmay no longer be trustworthy. So like... at your own risk, bestie π
- Default:
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 REAL array, dimension (4*N)
IWORK
IWORK is INTEGER array, dimension (N)
INFO
INFO is INTEGER
= 0: Successful exit. The solution to every right-hand side is guaranteed β¨< 0: IfINFO = -i, the i-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. It's giving π= N+J: The solution corresponding to the Jth 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 the Jth 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) the Jth 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.
subroutine sgbtf2
subroutine sgbtf2 (integer M, integer N, integer KL, integer KU, real,
dimension( ldab, * ) AB, integer LDAB, integer, dimension( * ) IPIV,
integer INFO)
SGBTF2 computes the LU factorization of a general band matrix using the unblocked version of the algorithm.
Purpose:
SGBTF2 computes an LU factorization of a real m-by-n band matrix A using partial pivoting with row interchanges.
This is the unblocked version of the algorithm, calling Level 2 BLAS. Slay, but small π
Parameters
MMisINTEGER- The number of rows of the matrix
A.M >= 0.
NNisINTEGER- The number of columns of the matrix
A.N >= 0.
KLKLisINTEGER- The number of subdiagonals within the band of
A.KL >= 0.
KUKUisINTEGER- The number of superdiagonals within the band of
A.KU >= 0.
ABABisREAL array, dimension (LDAB,N)- On entry, the matrix
Ain band storage, in rowsKL+1to2*KL+KU+1; rows1toKLof the array need not be set. The j-th column ofAis stored in the j-th column of the arrayABas follows:AB(kl+ku+1+i-j,j) = A(i,j)formax(1,j-ku)<=i<=min(m,j+kl) - On exit, details of the factorization:
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. See below for further details π
LDABLDABisINTEGER- The leading dimension of the array
AB.LDAB >= 2*KL+KU+1.
IPIVIPIVisINTEGER array, dimension (min(M,N))- The pivot indices; for
1 <= i <= min(M,N), rowiof the matrix was interchanged with rowIPIV(i).
INFOINFOisINTEGER= 0: successful exit β¨< 0: ifINFO = -i, the i-th argument had an illegal value π> 0: ifINFO = +i,U(i,i)is exactly zero. The factorization has been completed, but the factorUis exactly singular, and division by zero will occur if it is used to solve a system of equations. Ma'am. π
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Further Details:
The band storage scheme is illustrated by the following example, when M = N = 6, KL = 2, KU = 1:
On entry: On exit:
* * * + + + * * * u14 u25 u36
* * + + + + * * u13 u24 u35 u46
* a12 a23 a34 a45 a56 * u12 u23 u34 u45 u56
a11 a22 a33 a44 a55 a66 u11 u22 u33 u44 u55 u66
a21 a32 a43 a54 a65 * m21 m32 m43 m54 m65 *
a31 a42 a53 a64 * * m31 m42 m53 m64 * *
Array elements marked * are not used by the routine β they're just vibing, ignore them. Elements marked + don't need to be set on entry, but the routine needs them to store elements of U, because of fill-in resulting from the row interchanges. Sneaky little storage trick, iykyk π
subroutine sgbtrf
subroutine sgbtrf (integer M, integer N, integer KL, integer KU, real,
dimension( ldab, * ) AB, integer LDAB, integer, dimension( * ) IPIV,
integer INFO)
SGBTRF
Purpose:
SGBTRF computes an LU factorization of a real m-by-n band matrix A using partial pivoting with row interchanges.
This is the blocked version of the algorithm, calling Level 3 BLAS. Go big or go home, bestie π₯
Parameters
MMisINTEGER- The number of rows of the matrix
A.M >= 0.
NNisINTEGER- The number of columns of the matrix
A.N >= 0.
KLKLisINTEGER- The number of subdiagonals within the band of
A.KL >= 0.
KUKUisINTEGER- The number of superdiagonals within the band of
A.KU >= 0.
ABABisREAL array, dimension (LDAB,N)- On entry, the matrix
Ain band storage, in rowsKL+1to2*KL+KU+1; rows1toKLof the array need not be set. The j-th column ofAis stored in the j-th column of the arrayABas follows:AB(kl+ku+1+i-j,j) = A(i,j)formax(1,j-ku)<=i<=min(m,j+kl) - On exit, details of the factorization:
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. See below for further details π
LDABLDABisINTEGER- The leading dimension of the array
AB.LDAB >= 2*KL+KU+1.
IPIVIPIVisINTEGER array, dimension (min(M,N))- The pivot indices; for
1 <= i <= min(M,N), rowiof the matrix was interchanged with rowIPIV(i).
INFOINFOisINTEGER= 0: successful exit β¨< 0: ifINFO = -i, the i-th argument had an illegal value π> 0: ifINFO = +i,U(i,i)is exactly zero. The factorization has been completed, but the factorUis exactly singular, and division by zero will occur if it is used to solve a system of equations. Not the vibe π
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Further Details:
The band storage scheme is illustrated by the following example, when M = N = 6, KL = 2, KU = 1:
On entry: On exit:
* * * + + + * * * u14 u25 u36
* * + + + + * * u13 u24 u35 u46
* a12 a23 a34 a45 a56 * u12 u23 u34 u45 u56
a11 a22 a33 a44 a55 a66 u11 u22 u33 u44 u55 u66
a21 a32 a43 a54 a65 * m21 m32 m43 m54 m65 *
a31 a42 a53 a64 * * m31 m42 m53 m64 * *
Array elements marked * are not used by the routine; elements marked + need not be set on entry, but are required by the routine to store elements of U because of fill-in resulting from the row interchanges.
subroutine sgbtrs π
SGBTRS
subroutine sgbtrs (character TRANS, integer N, integer KL, integer KU,
integer NRHS, real, dimension( ldab, * ) AB, integer LDAB, integer,
dimension( * ) IPIV, real, dimension( ldb, * ) B, integer LDB, integer
INFO)
Purpose: SGBTRS solves a system of linear equations
A * X = B or A**T * X = B
with a general band matrix A using the LU factorization computed by SGBTRF. Bestie, that's the whole plot. π«Ά
Parameters
TRANSβTRANS is CHARACTER*1. Tells us the form of the system we're solving:= 'N': A * X = B (No transpose)= 'T': A**T* X = B (Transpose)= 'C': A**T* X = B (Conjugate transpose = Transpose)
NβN is INTEGER. The order of the matrix A.N >= 0.KLβKL is INTEGER. The number of subdiagonals within the band of A.KL >= 0.KUβKU is INTEGER. The number of superdiagonals within the band of A.KU >= 0.NRHSβNRHS is INTEGER. The number of right hand sides, i.e., the number of columns of the matrix B.NRHS >= 0. (So many right hand sides, so little time. π)ABβAB is REAL array, dimension (LDAB,N). Details of the LU factorization of the band matrix A, as computed bySGBTRF. U is 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.LDABβLDAB is INTEGER. The leading dimension of the array AB.LDAB >= 2*KL+KU+1.IPIVβIPIV is INTEGER array, dimension (N). The pivot indices; for1 <= i <= N, row i of the matrix was interchanged with rowIPIV(i).BβB is REAL array, dimension (LDB,NRHS). On entry, the right hand side matrix B. On exit, the solution matrix X. β¨ Glow-up complete.LDBβLDB is INTEGER. The leading dimension of the array B.LDB >= max(1,N).INFOβINFO is INTEGER= 0: successful exit< 0: ifINFO = -i, the i-th argument had an illegal value
Author πΈ
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
subroutine sggbak π¦ SGGBAK
subroutine sggbak (character JOB, character SIDE, integer N, integer ILO,
integer IHI, real, dimension( * ) LSCALE, real, dimension( * ) RSCALE,
integer M, real, dimension( ldv, * ) V, integer LDV, integer INFO)
Purpose: SGGBAK forms the right or left eigenvectors of a real generalized eigenvalue problem A*x = lambda*B*x, by backward transformation on the computed eigenvectors of the balanced pair of matrices output by SGGBAL. It's giving "undo the glow-up so the eigenvectors match the original problem." π
Parameters
JOBβJOB is CHARACTER*1. Specifies the type of backward transformation required:= 'N': do nothing, return immediately;= 'P': do backward transformation for permutation only;= 'S': do backward transformation for scaling only;= 'B': do backward transformations for both permutation and scaling.
JOB must be the same as the argument JOB supplied to SGGBAL. No switching up on us mid-routine. π
ββοΈ
SIDEβSIDE is CHARACTER*1= 'R': V contains right eigenvectors;= 'L': V contains left eigenvectors.
NβN is INTEGER. The number of rows of the matrix V.N >= 0.ILOβILO is INTEGERIHIβIHI is INTEGER. The integers ILO and IHI determined bySGGBAL.1 <= ILO <= IHI <= N, ifN > 0;ILO=1andIHI=0, ifN=0.LSCALEβLSCALE is REAL array, dimension (N). Details of the permutations and/or scaling factors applied to the left side of A and B, as returned bySGGBAL.RSCALEβRSCALE is REAL array, dimension (N). Details of the permutations and/or scaling factors applied to the right side of A and B, as returned bySGGBAL.MβM is INTEGER. The number of columns of the matrix V.M >= 0.VβV is REAL array, dimension (LDV,M). On entry, the matrix of right or left eigenvectors to be transformed, as returned bySTGEVC. On exit, V is overwritten by the transformed eigenvectors. π₯LDVβLDV is INTEGER. The leading dimension of the matrix V.LDV >= max(1,N).INFOβINFO is INTEGER= 0: successful exit.< 0: ifINFO = -i, the i-th argument had an illegal value.
Author π
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Further Details: β¨
See R.C. Ward, Balancing the generalized eigenvalue problem,
SIAM J. Sci. Stat. Comp. 2 (1981), 141-152.
subroutine sggbal π SGGBAL
subroutine sggbal (character JOB, integer N, real, dimension( lda, * ) A,
integer LDA, real, dimension( ldb, * ) B, integer LDB, integer ILO,
integer IHI, real, dimension( * ) LSCALE, real, dimension( * ) RSCALE,
real, dimension( * ) WORK, integer INFO)
Purpose: SGGBAL balances a pair of general real matrices (A,B). This involves, first, permuting A and B by similarity transformations to isolate eigenvalues in the first 1 to ILO$-$1 and last IHI+1 to N elements on the diagonal; and second, applying a diagonal similarity transformation to rows and columns ILO to IHI to make the rows and columns as close in norm as possible. Both steps are optional.
Balancing may reduce the 1-norm of the matrices, and improve the accuracy of the computed eigenvalues and/or eigenvectors in the generalized eigenvalue problem A*x = lambda*B*x. Basically: it's the self-care routine your matrices deserve before the real work starts. π§ββοΈπ
Parameters
JOBβJOB is CHARACTER*1. Specifies the operations to be performed on A and B:= 'N': none: simply set ILO = 1, IHI = N, LSCALE(I) = 1.0 and RSCALE(I) = 1.0 for i = 1,...,N.= 'P': permute only;= 'S': scale only;= 'B': both permute and scale.
NβN is INTEGER. The order of the matrices A and B.N >= 0.AβA is REAL array, dimension (LDA,N). On entry, the input matrix A. On exit, A is overwritten by the balanced matrix. IfJOB = 'N', A is not referenced. (Ghosted, respectfully. π)LDAβLDA is INTEGER. The leading dimension of the array A.LDA >= max(1,N).BβB is REAL array, dimension (LDB,N). On entry, the input matrix B. On exit, B is overwritten by the balanced matrix. IfJOB = 'N', B is not referenced.LDBβLDB is INTEGER. The leading dimension of the array B.LDB >= max(1,N).ILOβILO is INTEGERIHIβIHI is INTEGER. ILO and IHI are set to integers such that on exitA(i,j) = 0andB(i,j) = 0ifi > jandj = 1,...,ILO-1ori = IHI+1,...,N. IfJOB = 'N'or'S',ILO = 1andIHI = N.LSCALEβLSCALE is REAL array, dimension (N). Details of the permutations and scaling factors applied to the left side of A and B. IfP(j)is the index of the row interchanged with rowj, andD(j)is the scaling factor applied to rowj, then
LSCALE(j) = P(j) for J = 1,...,ILO-1
= D(j) for J = ILO,...,IHI
= P(j) for J = IHI+1,...,N.
The order in which the interchanges are made is N to IHI+1, then 1 to ILO-1.
RSCALEβRSCALE is REAL array, dimension (N). Details of the permutations and scaling factors applied to the right side of A and B. IfP(j)is the index of the column interchanged with columnj, andD(j)is the scaling factor applied to columnj, then
LSCALE(j) = P(j) for J = 1,...,ILO-1
= D(j) for J = ILO,...,IHI
= P(j) for J = IHI+1,...,N.
The order in which the interchanges are made is N to IHI+1, then 1 to ILO-1.
WORKβWORK is REAL array, dimension (lwork).lworkmust be at leastmax(1,6*N)whenJOB = 'S'or'B', and at least1whenJOB = 'N'or'P'.INFOβINFO is INTEGER= 0: successful exit< 0: ifINFO = -i, the i-th argument had an illegal value.
Author π
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Further Details: β
See R.C. WARD, Balancing the generalized eigenvalue problem,
SIAM J. Sci. Stat. Comp. 2 (1981), 141-152.
subroutine sla_gbamv π SLA_GBAMV performs a matrix-vector operation to calculate error bounds.
subroutine sla_gbamv (integer TRANS, integer M, integer N, integer KL,
integer KU, real ALPHA, real, dimension( ldab, * ) AB, integer LDAB,
real, dimension( * ) X, integer INCX, real BETA, real, dimension( * ) Y,
integer INCY)
Purpose: SLA_GBAMV performs one of the matrix-vector operations
y := alpha*abs(A)*abs(x) + beta*abs(y),
or y := alpha*abs(A)**T*abs(x) + beta*abs(y),
where alpha and beta are scalars, x and y are vectors and A is an m by n matrix.
okay so this function's whole vibe is that it's primarily used in calculating error bounds. β¨
And because underflow is a certified hater, to protect against it during evaluation, the components in the resulting vector get perturbed away from zero by (N+1) times the underflow threshold. π«Ά
Also, to prevent unnecessarily large errors for block-structure embedded in general matrices, the 'symbolically' zero components do not get perturbed. An entry counts as 'symbolic' if all the multiplications involved in computing that entry have at least one zero multiplicand. that's the rule, periodt π
TRANS
TRANS is INTEGER. On entry, TRANS says which operation we're doing, like this:
BLAS_NO_TRANS y := alpha*abs(A)*abs(x) + beta*abs(y)
BLAS_TRANS y := alpha*abs(A**T)*abs(x) + beta*abs(y)
BLAS_CONJ_TRANS y := alpha*abs(A**T)*abs(x) + beta*abs(y)
Unchanged on exit.
M
M is INTEGER. On entry, M is the number of rows of the matrix A. M must be at least zero. Unchanged on exit.
N
N is INTEGER. On entry, N is the number of columns of the matrix A. N must be at least zero. Unchanged on exit.
KL
KL is INTEGER. The number of subdiagonals within the band of A. KL >= 0.
KU
KU is INTEGER. The number of superdiagonals within the band of A. KU >= 0.
ALPHA
ALPHA is REAL. On entry, ALPHA is the scalar alpha. Unchanged on exit.
AB
AB is REAL array, dimension ( LDAB, n ). Before entry, the leading m by n part of the array AB must contain the matrix of coefficients. Unchanged on exit.
LDAB
LDAB is INTEGER. On entry, LDA specifies the first dimension of AB as declared in the calling (sub) program. LDAB must be at least max( 1, m ). Unchanged on exit.
X
X is REAL array, dimension ( 1 + ( n - 1 )*abs( INCX ) ) when TRANS = 'N' or 'n' and at least ( 1 + ( m - 1 )*abs( INCX ) ) otherwise. Before entry, the incremented array X must contain the vector x. Unchanged on exit.
INCX
INCX is INTEGER. On entry, INCX specifies the increment for the elements of X. INCX must not be zero. Unchanged on exit.
BETA
BETA is REAL. On entry, BETA specifies the scalar beta. When BETA is supplied as zero then Y need not be set on input. Unchanged on exit.
Y
Y is REAL array, dimension ( 1 + ( m - 1 )*abs( INCY ) ) when TRANS = 'N' or 'n' and at least ( 1 + ( n - 1 )*abs( INCY ) ) otherwise. Before entry with BETA non-zero, the incremented array Y must contain the vector y. On exit, Y is overwritten by the updated vector y.
INCY
INCY is INTEGER. On entry, INCY specifies the increment for the elements of Y. INCY must not be zero. Unchanged on exit.
Level 2 Blas routine. π¦
π Author π
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
π sla_gbrcond π
real function sla_gbrcond (character TRANS, integer N, integer KL, integer KU, real, dimension( ldab, * ) AB, integer LDAB, real, dimension( ldafb, * ) AFB, integer LDAFB, integer, dimension( * ) IPIV, integer CMODE, real, dimension( * ) C, integer INFO, real, dimension( * ) WORK, integer, dimension( * ) IWORK)
SLA_GBRCOND estimates the Skeel condition number for a general banded matrix. iconic behavior fr π
Purpose:
SLA_GBRCOND Estimates the Skeel condition number of op(A) * op2(C)
where op2 is determined by CMODE as follows
CMODE = 1 op2(C) = C
CMODE = 0 op2(C) = I
CMODE = -1 op2(C) = inv(C)
The Skeel condition number cond(A) = norminf( |inv(A)||A| )
is computed by computing scaling factors R such that
diag(R)*A*op2(C) is row equilibrated and computing the standard
infinity-norm condition number.
So basically op2 is whatever CMODE tells it to be, and then it finds scaling factors R that make diag(R)*A*op2(C) row equilibrated, and from there it computes the standard infinity-norm condition number. the way that it just does that πβ¨
Parameters
TRANS
TRANS is 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)
N
N is INTEGER. The number of linear equations, i.e., the order of the matrix A. N >= 0.
KL
KL is INTEGER. The number of subdiagonals within the band of A. KL >= 0.
KU
KU is INTEGER. The number of superdiagonals within the band of A. KU >= 0.
AB
AB is REAL array, dimension (LDAB,N). On entry, the matrix A in band storage, in rows 1 to KL+KU+1. The j-th column of A is stored in the j-th column of the array AB as follows:
AB(KU+1+i-j,j) = A(i,j) for max(1,j-KU)<=i<=min(N,j+kl)
LDAB
LDAB is INTEGER. The leading dimension of the array AB. LDAB >= KL+KU+1.
AFB
AFB is REAL array, dimension (LDAFB,N). Details of the LU factorization of the band matrix A, as computed by SGBTRF. U is stored as an upper triangular band matrix with KL+KU superdiagonals in rows 1 to KL+KU+1, and the multipliers used during the factorization are stored in rows KL+KU+2 to 2*KL+KU+1.
LDAFB
LDAFB is INTEGER. The leading dimension of the array AFB. LDAFB >= 2*KL+KU+1.
IPIV
IPIV is INTEGER array, dimension (N). The pivot indices from the factorization A = P*L*U as computed by SGBTRF; row i of the matrix was interchanged with row IPIV(i).
CMODE
CMODE is INTEGER. Determines op2(C) in the formula op(A) * op2(C) as follows:
CMODE = 1 op2(C) = CCMODE = 0 op2(C) = ICMODE = -1 op2(C) = inv(C)
C
C is REAL array, dimension (N). The vector C in the formula op(A) * op2(C).
INFO
INFO is INTEGER.
= 0: Successful exit.i > 0: The ith argument is invalid.
WORK
WORK is REAL array, dimension (5*N). Workspace.
IWORK
IWORK is INTEGER array, dimension (N). Workspace.
π Author π
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
π sla_gbrfsx_extended π
subroutine sla_gbrfsx_extended (integer PREC_TYPE, integer TRANS_TYPE, integer N, integer KL, integer KU, integer NRHS, real, dimension( ldab, * ) AB, integer LDAB, real, dimension( ldafb, * ) AFB, integer LDAFB, integer, dimension( * ) IPIV, logical COLEQU, real, dimension( * ) C, real, dimension( ldb, * ) B, integer LDB, real, dimension( ldy, * ) Y, integer LDY, real, dimension(*) BERR_OUT, integer N_NORMS, real, dimension( nrhs, * ) ERR_BNDS_NORM, real, dimension( nrhs, * ) ERR_BNDS_COMP, real, dimension(*) RES, real, dimension(*) AYB, real, dimension(*) DY, real, dimension(*) Y_TAIL, real RCOND, integer ITHRESH, real RTHRESH, real DZ_UB, logical IGNORE_CWISE, integer INFO)
SLA_GBRFSX_EXTENDED improves the computed solution to a system of linear equations for general banded matrices by performing extra-precise iterative refinement, and it also provides error bounds and backward error estimates for the solution. she's doing the most, and we love that π
Purpose:
SLA_GBRFSX_EXTENDED improves the computed solution to a system of
linear equations by performing extra-precise iterative refinement
and provides error bounds and backward error estimates for the solution.
This subroutine is called by SGBRFSX to perform iterative refinement.
In addition to normwise error bound, the code provides maximum
componentwise error bound if possible. See comments for ERR_BNDS_NORM
and ERR_BNDS_COMP for details of the error bounds. Note that this
subroutine is only responsible for setting the second fields of
ERR_BNDS_NORM and ERR_BNDS_COMP.
heads up bestie: this one is called bySGBRFSXto do the iterative refinement, and it is only responsible for setting the second fields ofERR_BNDS_NORMandERR_BNDS_COMP. don't ask her to do more than that π
Parameters
PREC_TYPE
PREC_TYPE is INTEGER. Specifies the intermediate precision to be used in refinement. The value is defined by ILAPREC(P) where P is a CHARACTER and
P = 'S': Single= 'D': Double= 'I': Indigenous= 'X' or 'E': Extra
TRANS_TYPE
TRANS_TYPE is INTEGER. Specifies the transposition operation on A. The value is defined by ILATRANS(T) where T is a CHARACTER and
T = 'N': No transpose= 'T': Transpose= 'C': Conjugate transpose
N
N is INTEGER. The number of linear equations, i.e., the order of the matrix A. N >= 0.
KL
KL is INTEGER. The number of subdiagonals within the band of A. KL >= 0.
KU
KU is INTEGER. The number of superdiagonals within the band of A. KU >= 0
NRHS
NRHS is INTEGER. The number of right-hand-sides, i.e., the number of columns of the matrix B.
AB
AB is REAL array, dimension (LDAB,N). On entry, the N-by-N matrix AB.
LDAB
LDAB is INTEGER. The leading dimension of the array AB. LDAB >= max(1,N).
AFB
AFB is REAL array, dimension (LDAFB,N). The factors L and U from the factorization A = P*L*U as computed by SGBTRF.
LDAFB
LDAFB is INTEGER. The leading dimension of the array AF. LDAFB >= max(1,N).
IPIV
IPIV is INTEGER array, dimension (N). The pivot indices from the factorization A = P*L*U as computed by SGBTRF; row i of the matrix was interchanged with row IPIV(i).
COLEQU
β¦and COLEQU is exactly where this part runs out of page, bestie β she continues in the next chunk ππ
COLEQUβ LOGICAL, bestie. If it's.TRUE.then column equilibration was already done toAbefore this routine got called. And like, you need it for the solution and error bounds to come out right. π«ΆCβ REAL array, dimension (N). These are the column scale factors forA. IfCOLEQU = .FALSE., thenCdoesn't even get looked at, periodt. IfCis input, every element ofCshould be a power of the radix, because that's how you keep the solution and error estimates reliable. Scaling by powers of the radix doesn't cause rounding errors β unless the result underflows or overflows. And rounding errors during scaling? Yeah, those lead to refining with a matrix that isn't equivalent to the input matrix, which produces error estimates that may not be reliable. So likeβ¦ be careful. πBβ REAL array, dimension (LDB,NRHS). The right-hand-side matrixB. That's it, that's the vibe. β¨LDBβ INTEGER. The leading dimension of the arrayB. Requirement:LDB >= max(1,N).Yβ REAL array, dimension (LDY,NRHS). On entry, it's the solution matrixX, as computed bySGBTRS. On exit, it's the improved solution matrixY. Glow-up era. πLDYβ INTEGER. The leading dimension of the arrayY. Requirement:LDY >= max(1,N).BERR_OUTβ REAL array, dimension (NRHS). On exit,BERR_OUT(j)holds the componentwise relative backward error for right-hand-sidej, straight from this formula:
max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
where abs(Z) is the componentwise absolute value of the matrix or vector Z. This one is computed by SLA_LIN_BERR. π§
N_NORMSβ INTEGER. It decides which error bounds you get back (peepERR_BNDS_NORMandERR_BNDS_COMP).- If
N_NORMS >= 1return normwise error bounds. - If
N_NORMS >= 2return componentwise error bounds.
- If
ERR_BNDS_NORMβ REAL array, dimension (NRHS, N_ERR_BNDS). For each right-hand side, this array carries info about various error bounds and condition numbers tied to the normwise relative error, which is defined like this:
Normwise relative error in the ith 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β 'Trust/don't trust' boolean. Trust the answer if the reciprocal condition number is less than the thresholdsqrt(n) * slamch('Epsilon').err = 2β 'Guaranteed' error bound: the estimated forward error, almost certainly within a factor of 10 of the true error, so long as the next entry is greater than the thresholdsqrt(n) * slamch('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) * slamch('Epsilon')to determine if the error estimate is 'guaranteed'. These reciprocal condition numbers are1 / (norm(Z^{-1},inf) * norm(Z,inf))for some appropriately scaled matrixZ. LetZ = S*A, whereSscales each row by a power of the radix so all absolute row sums ofZare approximately 1.
This subroutine is only responsible for setting the second field above. See Lapack Working Note 165 for further details and extra cautions. π
ERR_BNDS_COMPβ REAL array, dimension (NRHS, N_ERR_BNDS). For each right-hand side, this array carries info about various error bounds and condition numbers tied to the componentwise relative error, defined like so:
Componentwise relative error in the ith 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β 'Trust/don't trust' boolean. Trust the answer if the reciprocal condition number is less than the thresholdsqrt(n) * slamch('Epsilon').err = 2β 'Guaranteed' error bound: the estimated forward error, almost certainly within a factor of 10 of the true error, so long as the next entry is greater than the thresholdsqrt(n) * slamch('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) * slamch('Epsilon')to determine if the error estimate is 'guaranteed'. These reciprocal condition numbers are1 / (norm(Z^{-1},inf) * norm(Z,inf))for some appropriately scaled matrixZ. LetZ = S*(A*diag(x)), wherexis the solution for the current right-hand side andSscales each row ofA*diag(x)by a power of the radix so all absolute row sums ofZare approximately 1.
This subroutine is only responsible for setting the second field above. See Lapack Working Note 165 for further details and extra cautions. π¦
RESβ REAL array, dimension (N). Workspace to hold the intermediate residual. Just a lil holding spot. πAYBβ REAL array, dimension (N). Workspace. And yes, this can be the same workspace you passed forY_TAIL. Recycle, queen. β»οΈDYβ REAL array, dimension (N). Workspace to hold the intermediate solution.Y_TAILβ REAL array, dimension (N). Workspace to hold the trailing bits of the intermediate solution.RCONDβ REAL. Reciprocal scaled condition number. It's an estimate of the reciprocal Skeel condition number of the matrixAafter equilibration (if that was done). If this is less than the machine precision (in particular, if it is zero), the matrix is singular to working precision. But ngl, note that the error may still be small even if this number is very small and the matrix appears ill-conditioned. Don't panic prematurely. πITHRESHβ INTEGER. The maximum number of residual computations allowed for refinement. The default is10. For 'aggressive' set to100to permit convergence using approximate factorizations or factorizations other than LU. If the factorization uses a technique other than Gaussian elimination, the guarantees inERR_BNDS_NORMandERR_BNDS_COMPmay no longer be trustworthy. π¨RTHRESHβ REAL. Determines when to stop refinement if the error estimate stops decreasing. Refinement will stop when the next solution no longer satisfiesnorm(dx_{i+1}) < RTHRESH * norm(dx_i)wherenorm(Z)is the infinity norm ofZ.RTHRESHsatisfies0 < RTHRESH <= 1. The default value is0.5. For 'aggressive' set to0.9to permit convergence on extremely ill-conditioned matrices. See LAWN 165 for more details.DZ_UBβ REAL. Determines when to start considering componentwise convergence. Componentwise convergence is only considered after each component of the solutionYis stable, which we define as the relative change in each component being less thanDZ_UB. The default value is0.25, requiring the first bit to be stable. See LAWN 165 for more details.IGNORE_CWISEβ LOGICAL. If.TRUE.then ignore componentwise convergence. Default value is.FALSE.. Simple as that. πΈINFOβ INTEGER.= 0: Successful exit. π< 0: ifINFO = -i, the *i*th argument toSGBTRShad an illegal value.
π Author π
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
π real function sla_gbrpvgrw π
real function sla_gbrpvgrw (integer N, integer KL, integer KU, integer
NCOLS, real, dimension( ldab, * ) AB, integer LDAB, real, dimension(
ldafb, * ) AFB, integer LDAFB)
SLA_GBRPVGRW computes the reciprocal pivot growth factor norm(A)/norm(U) for a general banded matrix. π
β¨ Purpose β¨
SLA_GBRPVGRW computes the reciprocal pivot growth factor norm(A)/norm(U). The 'max absolute element' norm is used. If this is much less than 1, the stability of the LU factorization of the (equilibrated) matrix A could be poor. This also means that the solution X, estimated condition numbers, and error bounds could be unreliable. So likeβ¦ vibe check your pivot growth, fr fr. π
π Parameters π
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.NCOLSβ INTEGER. The number of columns of the matrixA.NCOLS >= 0.ABβABβ okay bestie,ABis aREAL array, dimension (LDAB,N). On entry, the matrixAin band storage, in rows1toKL+KU+1. The j-th column ofAis stored in the j-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)
LDABβLDAB is INTEGER. The leading dimension of the arrayAB.LDAB >= KL+KU+1.AFBβAFB is REAL array, dimension (LDAFB,N). Details of the LU factorization of the band matrixA, as computed bySGBTRF.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.LDAFBβLDAFB is INTEGER. The leading dimension of the arrayAFB.LDAFB >= 2*KL+KU+1.
π Author π
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
subroutine sorgbr (character VECT, integer M, integer N, integer K, real,
dimension( lda, * ) A, integer LDA, real, dimension( * ) TAU, real,
dimension( * ) WORK, integer LWORK, integer INFO)
πΈ SORGBR πΈ
π Purpose π
SORGBR generates one of the real orthogonal matrices Q or PT determined by SGEBRD when reducing a real matrix A to bidiagonal form: A = Q * B * PT. Q and P**T are defined as products of elementary reflectors H(i) or G(i) respectively.
If VECT = 'Q', A is assumed to have been an M-by-K matrix, and Q is of order M:
- if m >= k, Q = H(1) H(2) . . . H(k) and SORGBR returns the first n columns of Q, where m >= n >= k;
- if m < k, Q = H(1) H(2) . . . H(m-1) and SORGBR returns Q as an M-by-M matrix.
If VECT = 'P', A is assumed to have been a K-by-N matrix, and P**T is of order N:
- if k < n, PT = G(k) . . . G(2) G(1) and SORGBR returns the first m rows of PT, where n >= m >= k;
- if k >= n, PT = G(n-1) . . . G(2) G(1) and SORGBR returns PT as an N-by-N matrix.
π Parameters π
VECTβVECT is CHARACTER*1. Specifies whether the matrixQor the matrixP**Tis required, as defined in the transformation applied bySGEBRD:= 'Q': generateQ;= 'P': generateP**T.
MβM is INTEGER. The number of rows of the matrixQorP**Tto be returned.M >= 0.NβN is INTEGER. The number of columns of the matrixQorP**Tto be returned.N >= 0. IfVECT = 'Q',M >= N >= min(M,K); ifVECT = 'P',N >= M >= min(N,K).KβK is INTEGER. IfVECT = 'Q', the number of columns in the originalM-by-Kmatrix reduced bySGEBRD. IfVECT = 'P', the number of rows in the originalK-by-Nmatrix reduced bySGEBRD.K >= 0.AβA is REAL array, dimension (LDA,N). On entry, the vectors which define the elementary reflectors, as returned bySGEBRD. On exit, theM-by-NmatrixQorP**T.LDAβLDA is INTEGER. The leading dimension of the arrayA.LDA >= max(1,M).TAUβTAU is REAL array, dimension
(min(M,K)) if VECT = 'Q'
(min(N,K)) if VECT = 'P'
TAU(i) must contain the scalar factor of the elementary reflector H(i) or G(i), which determines Q or P**T, as returned by SGEBRD in its array argument TAUQ or TAUP.
WORKβWORK is REAL array, dimension (MAX(1,LWORK)). On exit, ifINFO = 0,WORK(1)returns the optimalLWORK.LWORKβLWORK is INTEGER. The dimension of the arrayWORK.LWORK >= max(1,min(M,N)). For optimum performanceLWORK >= min(M,N)*NB, whereNBis the optimal blocksize. IfLWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of theWORKarray, returns this value as the first entry of theWORKarray, and no error message related toLWORKis issued byXERBLA.INFOβINFO is INTEGER= 0: successful exit< 0: ifINFO = -i, the i-th argument had an illegal value
π Author π
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
And that's a wrap, bestie! π This page was auto-generated by Doxygen for LAPACK from the source code, version 3.11.0, dated Sun Nov 27 2022. Stay iconic! β¨
π¦ where this page comes from
- debian bookworm: liblapack-doc 3.11.0-2 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms