linearalgebra
Class LinearSystem

java.lang.Object
  extended by linearalgebra.LinearSystem

public class LinearSystem
extends java.lang.Object


Field Summary
private  NumericMatrixInterface a
           
private  NumericColumnInterface b
           
private  NumericColumnInterface c
           
private static byte INFINITE
           
private  NumericMatrixInterface L
           
private  boolean m_partialPivot
           
private  byte m_solvableStatus
           
private static byte SINGULAR
           
private static byte UNSOLVED
           
private  UnknownValue[] x
           
private static byte ZEROSOLN
           
 
Constructor Summary
LinearSystem(NumericMatrixInterface m)
           
LinearSystem(NumericMatrixInterface m, boolean partialPivot)
           
LinearSystem(NumericMatrixInterface m, NumericColumnInterface b)
           
LinearSystem(NumericMatrixInterface m, NumericColumnInterface b, boolean partialPivot)
           
 
Method Summary
private static double appendSign(double v, java.lang.StringBuffer s)
           
 void backSubstituteLower()
           
 void backSubstituteUpper()
           
private  void clearAllBindings()
           
 void combineRows(int srcRow, int dstRow, double scalar)
           
 int getEquationCount()
           
 GeneralSolution getGeneralSolution()
           
 double getLeastSquaresError()
           
 NumericColumnInterface getLeastSquaresProjection()
           
 NumericColumnInterface getLeastSquaresSolution()
           
 NumericColumnInterface getLeastSquaresSolutionForOrthonomolColumns()
           
 double getPivot(int srcRow, int dstRow)
           
private  int getPivotColumn(int row)
           
 int getRank()
           
 int getRowLeftPivotIndex(int row)
           
 java.lang.String getSolution(int row)
           
 NumericColumnInterface getSolutionColumn()
           
 java.lang.String getSolvableDescription()
           
 LinearEquation getSymbolicEquation(int rowIndex)
           
 UnknownValue getUnknown(int row)
           
private  LinearExpression getUnknownConstraint(int row, int unknownColumn)
           
 java.lang.String getUnknownDescription(int index)
           
 double getUnknownValue(int row)
           
 int getVariableCount()
           
private  java.lang.String getVariableName(int index)
           
 boolean isInconsistent()
           
 boolean isNonsingular()
           
 boolean isUnderdetermined()
           
 void leftEliminate()
           
 void multiplyRow(int row, double scalar)
           
 void normalize()
           
 void normalizeRow(int row)
           
private  NumericColumnInterface rhs()
           
 void rightEliminate()
           
 void setB(NumericColumn b)
           
private  void setInconsistentRow()
           
private  void setSingular()
           
private  void setUnderdeterminedUnknown()
           
private  void shiftOriginToZero()
           
 void simplifyConstraints()
           
 void solve()
           
private  void swapRows(int row1, int row2)
           
 void swapUnknowns(int row1, int row2)
           
 void swapUnknowns(PermutationMatrix p)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

L

private NumericMatrixInterface L

a

private final NumericMatrixInterface a

x

private final UnknownValue[] x

b

private NumericColumnInterface b

c

private NumericColumnInterface c

m_partialPivot

private boolean m_partialPivot

UNSOLVED

private static final byte UNSOLVED
See Also:
Constant Field Values

SINGULAR

private static final byte SINGULAR
See Also:
Constant Field Values

INFINITE

private static final byte INFINITE
See Also:
Constant Field Values

ZEROSOLN

private static final byte ZEROSOLN
See Also:
Constant Field Values

m_solvableStatus

private byte m_solvableStatus
Constructor Detail

LinearSystem

public LinearSystem(NumericMatrixInterface m)

LinearSystem

public LinearSystem(NumericMatrixInterface m,
                    boolean partialPivot)

LinearSystem

public LinearSystem(NumericMatrixInterface m,
                    NumericColumnInterface b)

LinearSystem

public LinearSystem(NumericMatrixInterface m,
                    NumericColumnInterface b,
                    boolean partialPivot)
Method Detail

solve

public void solve()

getSolutionColumn

public NumericColumnInterface getSolutionColumn()

getRowLeftPivotIndex

public int getRowLeftPivotIndex(int row)

getUnknownValue

public double getUnknownValue(int row)

swapUnknowns

public void swapUnknowns(int row1,
                         int row2)

getUnknown

public UnknownValue getUnknown(int row)

swapUnknowns

public void swapUnknowns(PermutationMatrix p)

getUnknownDescription

public java.lang.String getUnknownDescription(int index)

getVariableName

private java.lang.String getVariableName(int index)

leftEliminate

public void leftEliminate()

swapRows

private void swapRows(int row1,
                      int row2)

rightEliminate

public void rightEliminate()

normalize

public void normalize()
               throws SwapRowsException,
                      OnlyZeroRowsError
Throws:
SwapRowsException
OnlyZeroRowsError

backSubstituteUpper

public void backSubstituteUpper()

backSubstituteLower

public void backSubstituteLower()

getEquationCount

public int getEquationCount()

multiplyRow

public void multiplyRow(int row,
                        double scalar)

normalizeRow

public void normalizeRow(int row)
                  throws SwapRowsException,
                         OnlyZeroRowsError
Throws:
SwapRowsException
OnlyZeroRowsError

combineRows

public void combineRows(int srcRow,
                        int dstRow,
                        double scalar)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getVariableCount

public int getVariableCount()

getPivot

public double getPivot(int srcRow,
                       int dstRow)
                throws SwapRowsException,
                       OnlyZeroRowsError
Throws:
SwapRowsException
OnlyZeroRowsError

getPivotColumn

private int getPivotColumn(int row)
                    throws SwapRowsException,
                           OnlyZeroRowsError
Throws:
SwapRowsException
OnlyZeroRowsError

getSolution

public java.lang.String getSolution(int row)

getUnknownConstraint

private LinearExpression getUnknownConstraint(int row,
                                              int unknownColumn)

appendSign

private static double appendSign(double v,
                                 java.lang.StringBuffer s)

rhs

private NumericColumnInterface rhs()

isNonsingular

public final boolean isNonsingular()

isUnderdetermined

public final boolean isUnderdetermined()

setSingular

private final void setSingular()

setUnderdeterminedUnknown

private final void setUnderdeterminedUnknown()

setInconsistentRow

private final void setInconsistentRow()

clearAllBindings

private void clearAllBindings()

isInconsistent

public final boolean isInconsistent()

getSolvableDescription

public java.lang.String getSolvableDescription()

getSymbolicEquation

public LinearEquation getSymbolicEquation(int rowIndex)

simplifyConstraints

public void simplifyConstraints()

getGeneralSolution

public GeneralSolution getGeneralSolution()

getRank

public int getRank()

setB

public void setB(NumericColumn b)

getLeastSquaresSolution

public NumericColumnInterface getLeastSquaresSolution()

getLeastSquaresProjection

public NumericColumnInterface getLeastSquaresProjection()

getLeastSquaresError

public double getLeastSquaresError()

getLeastSquaresSolutionForOrthonomolColumns

public NumericColumnInterface getLeastSquaresSolutionForOrthonomolColumns()

shiftOriginToZero

private void shiftOriginToZero()