Skip to main content

Module tridiagonal

Module tridiagonal 

Source
Expand description

Tridiagonal system solver.

Solves systems of the form:

a_i * x_{i-1} + b_i * x_i + c_i * x_{i+1} = d_i

where a is the sub-diagonal (length n-1), b is the main diagonal (length n), c is the super-diagonal (length n-1), and d is the right-hand side (length n).

Two algorithms are provided:

  • Thomas algorithm (sequential): O(n) time, O(1) extra space. Used internally for single-system solves when the system is small.
  • Cyclic reduction (parallel-friendly): O(n) work in O(log n) parallel steps. Forms the basis of the GPU kernel for large systems.

For batched solves, each independent system can be solved concurrently.

Functionsยง

batched_tridiagonal_solve
Solves a batch of independent tridiagonal systems.
tridiagonal_solve
Solves a tridiagonal system using the Thomas algorithm (sequential).