Function navtk::solve_tridiagonal

Function Documentation

Vector navtk::solve_tridiagonal(const Vector &low, const Vector &mid, const Vector &up, const Vector &b)

Recursively solve a system of equations of the form Ax = b, where A is a tridiagonal matrix (zeros everywhere except on diagonal, and first upper and lower diagonals).

See https://en.wikipedia.org/wiki/Tridiagonal_matrix_algorithm.

Parameters
  • low – Vector representation of lower diagonal of A, length N - 1.

  • mid – Vector representation of diagonal of A, length N. Diagonal must be free of zeros to avoid division by zero, but is not checked.

  • up – Vector representation of upper diagonal of A, length N - 1.

  • b – Solution vector of system to solve, length N.

Returns

Vector x such that Ax = b.