Systems of Linear Equations



Tridiagonal Systems

Tridiagonal Systems.

These routines constitute Doolittle's LU decomposition of a tridiagonal matrix A and the solution of the linear equation A x = B after the LU decomposition has been performed. The decomposition is performed without pivoting and therefore may fail if during the decomposition a diagonal element becomes 0, if A is positive definite symmetric or diagonally dominant, then the decomposition should not fail.

For a tridiagonal matrix, only the subdiagonal, diagonal, and superdiagonal elements are stored in memory.

Function List

  • int Tridiagonal_LU_Decomposition( double subdiagonal[ ], double diagonal[ ], double superdiagonal[ ], int n )

    Given the n×n matrix A, Tridiagonal_LU_Decomposition uses Doolittle's algorithm to decompose the n×n-matrix A with subdiagonal subdiagonal, diagonal diagonal, and superdiagonal superdiagonal, into the product of a unit lower triangular matrix and an upper triangular matrix. The non-diagonal lower triangular part of the unit lower triangular matrix is returned in subdiagonal, the diagonal of the upper triangular part of the upper triangular matrix is returned in diagonal and the superdiagonal of the upper triangular part of the upper triangular matrix is returned in superdiagonal.  Tridiagonal_LU_Decomposition returns 0 if the decomposition was successful and returns -1 if the decomposition fails.

  • int Tridiagonal_LU_Solve( double subdiagonal[ ], double diagonal[ ], double superdiagonal[ ], double B[ ], double x[ ], int n )

    Tridiagonal_LU_Solve solves the system of linear equations LU x = B for x, where LU is the LU decomposition of A returned from Tridiagonal_LU_Decomposition.  Tridiagonal_LU_Solve returns 0 if the solution was found and returns -1 if the matrix is singular.

C Source Code

  • The file, tridiagonal.c, contains the routines Tridiagonal_LU_Decomposition( ) and Tridiagonal_LU_Solve( ).