Solves a tridiagonal linear system in operations (Gaussian elimination: ):
where:
- : unknowns,
- , , : lower, main and upper diagonal coefficients (),
- : right-hand side.
Forward sweep, starting from and :
Back substitution, starting from :
No pivoting, so it is only safe when the matrix is diagonally dominant (), as in discretised diffusion. Used in implicit diffusion schemes such as Crank-Nicolson, and for cubic splines.