Class BackwardSubstitution
- java.lang.Object
-
- dev.nm.algebra.linear.matrix.doubles.linearsystem.BackwardSubstitution
-
public class BackwardSubstitution extends Object
Backward substitution solves a matrix equation in the form Ux = b by an iterative process for an upper triangular matrix U. The process is so called because for an upper triangular matrix, one first computes xn, then substitutes that backward into the next equation to solve for xn-1, and repeats until x1. Note that some diagonal entries in U can be 0s, provided that the system of equations is consistent. For example, \[ \begin{bmatrix} 1 & 2 & 3\\ 0 & 0 & 5\\ 0 & 0 & 0 \end{bmatrix} \times \begin{bmatrix} 10\\ 0\\ 0 \end{bmatrix} = \begin{bmatrix} 10\\ 0\\ 0 \end{bmatrix} \]- See Also:
- Wikipedia: Forward and Back Substitution
-
-
Constructor Summary
Constructors Constructor Description BackwardSubstitution()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Matrix
solve(UpperTriangularMatrix U, Matrix B)
Matrix
solve(UpperTriangularMatrix U, Matrix B, double epsilon)
Vector
solve(UpperTriangularMatrix U, Vector b)
Solve Ux = b.Vector
solve(UpperTriangularMatrix U, Vector b, double epsilon)
-
-
-
Method Detail
-
solve
public Vector solve(UpperTriangularMatrix U, Vector b)
Solve Ux = b.- Parameters:
U
- an upper triangular matrix, representing the system of linear equations (the homogeneous part)b
- a vector- Returns:
- a solution x such that Ux = b
- Throws:
LinearSystemSolver.NoSolution
- if there is no solution to the system
-
solve
public Vector solve(UpperTriangularMatrix U, Vector b, double epsilon)
-
solve
public Matrix solve(UpperTriangularMatrix U, Matrix B)
-
solve
public Matrix solve(UpperTriangularMatrix U, Matrix B, double epsilon)
-
-