SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.matrix.doubles.linearsystem
Class BackwardSubstitution

java.lang.Object
  extended by com.numericalmethod.suanshu.matrix.doubles.linearsystem.BackwardSubstitution

public class BackwardSubstitution
extends java.lang.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 onto x1.

Note that some diagonal entries in U can be 0s, provided that the system of equations is consistent. E.g.,

 | 1 2 3 |     | 10 |   | 10 |
 | 0 0 5 | %*% |  0 | = |  0 |
 | 0 0 0 |     |  0 |   |  0 |
 

See Also:
Wikipedia: Forward and Back Substitution

Field Summary
 UpperTriangularMatrix U
          the system of linear equations (the homogeneous part)
 
Constructor Summary
BackwardSubstitution(UpperTriangularMatrix U)
          Construct a BackwardSubstitution instance to solve for different Vector b's.
 
Method Summary
 Vector solve(Vector b)
          Solve Ux = b
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

U

public final UpperTriangularMatrix U
the system of linear equations (the homogeneous part)

Constructor Detail

BackwardSubstitution

public BackwardSubstitution(UpperTriangularMatrix U)
Construct a BackwardSubstitution instance to solve for different Vector b's.

Parameters:
U - an upper triangular matrix
Method Detail

solve

public Vector solve(Vector b)
Solve
Ux = b

Parameters:
b - a vector
Returns:
x such that
Ux = b
Throws:
Solver.NoSolution - if there is no solution to this system

SuanShu, a Java numerical and statistical library

Copyright © 2011 Numerical Method Inc. Ltd. All Rights Reserved.