Class LUSolver


  • public class LUSolver
    extends Object
    Use LU decomposition to solve Ax = b where A is square and det(A) != 0. The dimensions of A and b must match. The algorithm goes as follows.
    
     Ax = b;
     LUx = PAx = Pb
     
    We first solve Ly = b by forward substitution and then Ux = y by backward substitution.
    See Also:
    Wikipedia: Solving linear equations
    • Constructor Detail

      • LUSolver

        public LUSolver()
    • Method Detail

      • solve

        public Vector solve​(LSProblem problem)
        Solve Ax = b.
        Parameters:
        problem - a system of linear equations
        Returns:
        x a solution such that Ax = b
        Throws:
        LinearSystemSolver.NoSolution - if there is no solution to the system
      • solve

        public Matrix solve​(Matrix A,
                            Matrix B)
        Solves AX = B.
        Parameters:
        A - the left-hand side coefficient matrix
        B - the right-hand side of the equation
        Returns:
        the solution, X