java.lang.Object
dev.nm.algebra.linear.matrix.doubles.factorization.gaussianelimination.GaussianElimination

public class GaussianElimination extends Object
The Gaussian elimination performs elementary row operations to reduce a matrix to the row echelon form. The two elementary row operations are: swapping rows, and adding multiples of a row to another row. This is equivalent to multiplying the original matrix with invertible matrices from the left. For a square matrix, this algorithm essentially computes an LU decomposition. We have,

 T * A == U
 
where T is the transformation matrix, U is in the row echelon form. And,

 P * A == L * U
 
where P is the permutation matrix, U is lower triangular, U is in the row echelon form.
See Also:
  • Constructor Details

    • GaussianElimination

      public GaussianElimination(Matrix A, boolean usePivoting, double epsilon)
      Run the Gaussian elimination algorithm.
      Parameters:
      A - a matrix
      usePivoting - true if to use partial pivoting, e.g., for numerical stability. In general, no pivoting means no row interchanges. It can be done only if Gaussian elimination never runs into zeros on the diagonal. Since division by zero is a fatal error we usually avoid no pivoting.
      epsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0
    • GaussianElimination

      public GaussianElimination(Matrix A)
      Run the Gaussian elimination algorithm with partial pivoting.
      Parameters:
      A - a matrix
  • Method Details

    • T

      public Matrix T()
      Get the transformation matrix, T, such that T * A = U.
      Returns:
      T
    • U

      public Matrix U()
      Get the upper triangular matrix, U, such that T * A = U and P * A = L * U.
      Returns:
      U
    • L

      public Matrix L()
      Get the lower triangular matrix L, such that P * A = L * U.
      Returns:
      L
    • P

      public PermutationMatrix P()
      Get the permutation matrix, P, such that P * A = L * U.
      Returns:
      P