# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.algebra.linear.matrix.doubles.factorization.gaussianelimination

## Class GaussJordanElimination

• java.lang.Object
• com.numericalmethod.suanshu.algebra.linear.matrix.doubles.factorization.gaussianelimination.GaussJordanElimination

• public class GaussJordanElimination
extends Object
Gauss-Jordan elimination performs elementary row operations to reduce a matrix to the reduced row echelon form. The three elementary row operations are: scaling rows, swapping rows, and adding multiples of a row to another row. That is, T * A == U where T is the transformation matrix, U is in the reduced row echelon form.

This implementation makes sure that the leading 1s are numerically 1 for comparison purpose. Suppose there is a leading 1 at [i,j], U.get(i, j) == 1 always returns true.

• ### Constructor Summary

Constructors
Constructor and Description
GaussJordanElimination(Matrix A)
Run the Gauss-Jordan elimination algorithm.
GaussJordanElimination(Matrix A, boolean usePivoting, double epsilon)
Run the Gauss-Jordan elimination algorithm.
• ### Method Summary

All Methods
Modifier and Type Method and Description
Matrix T()
Get the transformation matrix, T, such that T * A = U.
Matrix U()
Get the reduced row echelon form matrix, U, such that T * A = U.
• ### Methods inherited from class java.lang.Object

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

• #### GaussJordanElimination

public GaussJordanElimination(Matrix A,
boolean usePivoting,
double epsilon)
Run the Gauss-Jordan elimination algorithm.
Parameters:
A - a matrix
usePivoting - true if partial pivoting is wanted, e.g., for numerical stability
epsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0
• #### GaussJordanElimination

public GaussJordanElimination(Matrix A)
Run the Gauss-Jordan elimination algorithm.
Parameters:
A - a matrix
• ### Method Detail

• #### T

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

public Matrix U()
Get the reduced row echelon form matrix, U, such that T * A = U.
Returns:
the reduced row echelon form matrix