# Class LinearSystemSolver

java.lang.Object
dev.nm.algebra.linear.matrix.doubles.linearsystem.LinearSystemSolver

public class LinearSystemSolver extends Object
Solve a system of linear equations in the form:
Ax = b,
We assume that, after row reduction, A has no more rows than columns. That is, the system must not be over-determined. For example, the following system is not over-determined. One of the rows is linearly dependent. $\begin{bmatrix} 1 invalid input: '&' -1 invalid input: '&' 0\\ 0 invalid input: '&' -2 invalid input: '&' 0\\ 0 invalid input: '&' 0 invalid input: '&' -1\\ 0 invalid input: '&' 0 invalid input: '&' -2 \end{bmatrix} x = \begin{bmatrix} -0.8\\ -1.6\\ 0.8\\ 1.6 \end{bmatrix}$ This linear system of equations is solved in two steps.
1. First, solve Ax = 0, the homogeneous system, for non trivial solutions.
2. Then, solve Ax = b for a particular solution.
If A has full rank, this implementation solves the system by LU decomposition. Otherwise, a particular solution is found by x = T * b. The final solution is:
x_particular + {x_null_space_of_A}
hence, the translation of the null space of A by the vector x_particular.
• ## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
static class
LinearSystemSolver.NoSolution
This is the runtime exception thrown when it fails to solve a system of linear equations.
static interface
LinearSystemSolver.Solution
This is the solution to a linear system of equations.
• ## Constructor Summary

Constructors
Constructor
Description
LinearSystemSolver(double epsilon)
Construct a solver for a linear system of equations.
• ## Method Summary

Modifier and Type
Method
Description
LinearSystemSolver.Solution
solve(Matrix A0)
Get a particular solution for the linear system, Ax = b.

### Methods inherited from class java.lang.Object

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

• ### LinearSystemSolver

public LinearSystemSolver(double epsilon)
Construct a solver for a linear system of equations.
Parameters:
epsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0
• ## Method Details

• ### solve

Get a particular solution for the linear system, Ax = b.
Parameters:
A0 - a matrix representing a linear system of equations (the homogeneous part)
Returns:
a particular solution