TDMA solver¶
The Tridiagonal Matrix Algorithm (TDMA) or Thomas Algorithm is an algorithm that solves a linear system of equations of the form
\[A \cdot x = b\]
where \(A\) is of tridiagonal shape. Such shapes are common for the discretisation of one dimensional partial differential equations with a central difference scheme. It solves the system of equation in \(\mathcal{O}(n)\) and is thus significantly faster than Gaussian elimination. If an equation can be expressed by a tridiagonal matrix, it is preferred to solve it via this algorithm as it has optimal runtime for this problem (Patankar, 1980).