SRC/slagts.f(3)
π SRC/slagts.f β from the Library Functions Manual, bestie
okay so this is a Fortran source file page from the LAPACK docs, and it's honestly kind of a big deal. it's all about a subroutine that solves tridiagonal systems after somebody else already did the factoring. very "i'm the cleanup crew" of it. anyway, let's get into it β¨
β¨ SYNOPSIS β¨
Functions/Subroutines π
subroutine slagts (job, n, a, b, c, d, in, y, tol, info)βSLAGTSsolves the system of equations(T-Ξ»I)x = yor(T-Ξ»I)^Tx = y, whereTis a general tridiagonal matrix andΞ»a scalar, using the LU factorization computed byslagtf.
π¦ Function/Subroutine Documentation π¦
subroutine slagts (integer job, integer n, real, dimension( * ) a, real,
dimension( * ) b, real, dimension( * ) c, real, dimension( * ) d,
integer, dimension( * ) in, real, dimension( * ) y, real tol, integer
info)
SLAGTS solves the system of equations (T-Ξ»I)x = y or (T-Ξ»I)^Tx = y, where T is a general tridiagonal matrix and Ξ» a scalar, using the LU factorization computed by slagtf. no cap, that's the whole gig π
Purpose πΈ
SLAGTS may be used to solve one of the systems of equations
(T - lambda*I)*x = y or (T - lambda*I)**T*x = y,
whereTis annbyntridiagonal matrix, forx, following the factorization of(T - lambda*I)as
(T - lambda*I) = P*L*U ,
by routineSLAGTF. The choice of equation to be solved is controlled by the argumentJOB, and in each case there is an option to perturb zero or very small diagonal elements ofU, this option being intended for use in applications such as inverse iteration.
so yeah, SLAGTF does the glow-up (the P*L*U factorization) and SLAGTS walks in afterwards and actually solves stuff. iconic teamwork honestly π«Ά
Parameters π
JOB
JOBisINTEGERSpecifies the job to be performed bySLAGTSas follows:
= 1: The equations(T - lambda*I)x = yare to be solved, but diagonal elements ofUare not to be perturbed.= -1: The equations(T - lambda*I)x = yare to be solved and, if overflow would otherwise occur, the diagonal elements ofUare to be perturbed. See argumentTOLbelow.= 2: The equations(T - lambda*I)**Tx = yare to be solved, but diagonal elements ofUare not to be perturbed.= -2: The equations(T - lambda*I)**Tx = yare to be solved and, if overflow would otherwise occur, the diagonal elements ofUare to be perturbed. See argumentTOLbelow.
so positive JOB = hands off the U diagonals, negative JOB = go ahead and nudge them if overflow is about to ruin the vibe π
N
NisINTEGERThe order of the matrixT.
literally just how big the matrix is. that's it, that's the whole parameter π
A
AisREALarray, dimension(N)On entry,Amust contain the diagonal elements ofUas returned fromSLAGTF.
B
BisREALarray, dimension(N-1)On entry,Bmust contain the first super-diagonal elements ofUas returned fromSLAGTF.
C
CisREALarray, dimension(N-1)On entry,Cmust contain the sub-diagonal elements ofLas returned fromSLAGTF.
D
DisREALarray, dimension(N-2)On entry,Dmust contain the second super-diagonal elements ofUas returned fromSLAGTF.
okay note that D is N-2 long, not N-1 β bestie do NOT mess that up π and all four of these bad boys come straight out of SLAGTF. don't go hand-crafting them, that's not the assignment.
IN
INisINTEGERarray, dimension(N)On entry,INmust contain details of the matrixPas returned fromSLAGTF.
Y
YisREALarray, dimension(N)On entry, the right hand side vectory. On exit,Yis overwritten by the solution vectorx.
main character energy: y goes in, x comes out, same array. glow-up arc fr fr β¨
TOL
TOLisREALOn entry, withJOB < 0,TOLshould be the minimum perturbation to be made to very small diagonal elements ofU.TOLshould normally be chosen as abouteps*norm(U), whereepsis the relative machine precision, but ifTOLis supplied as non-positive, then it is reset toeps*max( abs( u(i,j) ) ). IfJOB > 0thenTOLis not referenced. On exit,TOLis changed as described above, only ifTOLis non-positive on entry. OtherwiseTOLis unchanged.
so real talk: TOL only matters when JOB < 0. and it can get rewritten on the way out, but only if you fed it a non-positive value. otherwise it stays exactly as you left it π
INFO
INFOisINTEGER
= 0: successful exit< 0: ifINFO = -i, the i-th argument had an illegal value> 0: overflow would occur when computing theINFOth element of the solution vectorx. This can only occur whenJOBis supplied as positive and either means that a diagonal element ofUis very small, or that the elements of the right-hand side vectoryare very large.
β οΈ heads up bestie: a positiveINFOis not a slay. it means overflow happened at that element, and it can only happen whenJOBis positive β i.e. when you told it not to perturb theUdiagonals. tiny diagonal, hugey, boom. π
π Author π
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Definition at line 162 of file slagts.f.
β Author β
Generated automatically by Doxygen for LAPACK from the source code.
okay that's the whole page, bestie β every flag, every array bound, every INFO case, nothing skipped. this beauty is LAPACK Version 3.12.0, and it says goodbye from SRC/slagts.f(3) π¦π stay factored, stay unbothered β¨
π¦ 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