Documentation of 'edu.princeton.cs.algs4.GaussianElimination' Java class
GaussianElimination
edu.princeton.cs.algs4

Class GaussianElimination



  • public class GaussianElimination
    extends java.lang.Object
    The GaussianElimination data type provides methods to solve a linear system of equations Ax = b, where A is an m-by-n matrix and b is a length n vector.

    This is a bare-bones implementation that uses Gaussian elimination with partial pivoting. See GaussianEliminationLite.java for a stripped-down version that assumes the matrix A is square and nonsingular. See GaussJordanElimination for an alternate implementation that uses Gauss-Jordan elimination. For an industrial-strength numerical linear algebra library, see JAMA.

    For additional documentation, see Section 9.9 Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.

    • Constructor Summary

      Constructors 
      Constructor and Description
      GaussianElimination(double[][] A, double[] b)
      Solves the linear system of equations Ax = b, where A is an m-by-n matrix and b is a length m vector.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean isFeasible()
      Returns true if there exists a solution to the linear system of equations Ax = b.
      static void main(java.lang.String[] args)
      Unit tests the GaussianElimination data type.
      double[] primal()
      Returns a solution to the linear system of equations Ax = b.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GaussianElimination

        public GaussianElimination(double[][] A,
                                   double[] b)
        Solves the linear system of equations Ax = b, where A is an m-by-n matrix and b is a length m vector.
        Parameters:
        A - the m-by-n constraint matrix
        b - the length m right-hand-side vector
        Throws:
        java.lang.IllegalArgumentException - if the dimensions disagree, i.e., the length of b does not equal m
    • Method Detail

      • primal

        public double[] primal()
        Returns a solution to the linear system of equations Ax = b.
        Returns:
        a solution x to the linear system of equations Ax = b; null if no such solution
      • isFeasible

        public boolean isFeasible()
        Returns true if there exists a solution to the linear system of equations Ax = b.
        Returns:
        true if there exists a solution to the linear system of equations Ax = b; false otherwise
      • main

        public static void main(java.lang.String[] args)
        Unit tests the GaussianElimination data type.
        Parameters:
        args - the command-line arguments

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.