# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.algebra.linear.matrix.doubles.linearsystem

## Class ForwardSubstitution

• java.lang.Object
• com.numericalmethod.suanshu.algebra.linear.matrix.doubles.linearsystem.ForwardSubstitution

• public class ForwardSubstitution
extends Object
Forward substitution solves a matrix equation in the form Lx = b by an iterative process for a lower triangular matrix L. The process is so called because for a lower triangular matrix, one first computes x1, then substitutes that forward into the next equation to solve for x2, and repeats until xn. Note that some diagonal entries in L can be 0s, provided that the system of equations is consistent. For example, $\begin{bmatrix} 0 & 0 & 0\\ 2 & 0 & 0\\ 4 & 5 & 6 \end{bmatrix} \times \begin{bmatrix} 0\\ 0\\ 30 \end{bmatrix} = \begin{bmatrix} 0\\ 0\\ 30 \end{bmatrix}$
Wikipedia: Forward substitution
• ### Constructor Summary

Constructors
Constructor and Description
ForwardSubstitution()
• ### Method Summary

All Methods
Modifier and Type Method and Description
Matrix solve(LowerTriangularMatrix L, Matrix B)
Matrix solve(LowerTriangularMatrix L, Matrix B, double epsilon)
Vector solve(LowerTriangularMatrix L, Vector b)
Solve Lx = b.
Vector solve(LowerTriangularMatrix L, Vector b, double epsilon)
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Constructor Detail

• #### ForwardSubstitution

public ForwardSubstitution()
• ### Method Detail

• #### solve

public Vector solve(LowerTriangularMatrix L,
Vector b)
Solve Lx = b.
Parameters:
L - a lower triangular matrix, representing the system of linear equations (the homogeneous part)
b - a vector
Returns:
a solution x such that Lx = b
Throws:
LinearSystemSolver.NoSolution - if there is no solution to the system
• #### solve

public Vector solve(LowerTriangularMatrix L,
Vector b,
double epsilon)
• #### solve

public Matrix solve(LowerTriangularMatrix L,
Matrix B)
• #### solve

public Matrix solve(LowerTriangularMatrix L,
Matrix B,
double epsilon)