C4 Engine Terathon Software C4 Engine API Documentation

• Math Library

API Links
Developer Links

Math::SolveTridiagonalSystem

Defined in:  C4Computation.h
Solves a linear system having a tridiagonal coefficient matrix.
Prototype

void SolveTridiagonalSystem(int32 n, const float *a, const float *b, const float *c, const float *r, float *x);

Parameters
n The size of the tridiagonal matrix M.
a A pointer to the array containing the n subdiagonal entries of M. The coefficient a[0] does not exist and is never accessed.
b A pointer to the array containing the n diagonal entries of M.
c A pointer to the array containing the n superdiagonal entries of M. The coefficient c[n - 1] does not exist and is never accessed.
r A pointer to an array of n constant values representing the vector r for which the linear system Mx = r is to be solved.
x A pointer to the array in which the n solutions representing the vector x are to be returned. This may be the same pointer passed as the r parameter.
Description
The SolveTridiagonalSystem function solves a linear system Mx = r for which the coefficient matrix M is tridiagonal. The matrix M must be diagonally dominant to guarantee a valid solution.

The entries of the matrix M are specified as three arrays of size n containing the subdiagonal, diagonal, and superdiagonal entries arranged as follows.

M= b[0] c[0] 0 0 0 a[1] b[1] c[1] 0 0 0 a[2] b[2] c[2] 0
See Also

Math::SolveLinearSystem