Helper function for double sweep method (Thomas algorithm)
Source:R/double_sweep.R
solve_double_sweep.RdThis function solves a tridiagonal system of equations of the form $$Ax = b$$ where the matrix \(A\) has the entries \(D_1, D_2, \dots, D_N\) on the main diagonal, \(L_2, L_3, \dots, L_N\) on the lower diagonal, and \(U_1, U_2, \dots, U_{N-1}\) on the upper diagonal.
Arguments
- U
Upper diagonal entries. Even though the matrix only uses \(U_1\dots U_{N-1}\), you need to supply a full vector of length \(N\). The last element will be ignored.
- L
Lower diagonal entries. Even though the matrix only uses \(L_2\dots L_N\), you need to supply a full vector of length \(N\). The first element will be ignored.
- D
Main diagonal entries
- b
Right-hand side vector
Details
For more details on the double sweep method, see the vignette
vignette("diffusion")