|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.lmu.ifi.dbs.elki.math.linearalgebra.LinearEquationSystem
public class LinearEquationSystem
Class for systems of linear equations.
Field Summary | |
---|---|
private double[][] |
coeff
The matrix of coefficients. |
private int[] |
col
Encodes column permutations, column j is at position col[j]. |
private static Logging |
logger
Logger. |
private int |
rank
The rank of the coefficient matrix. |
private boolean |
reducedRowEchelonForm
Indicates if linear equation system is in reduced row echelon form. |
private double[] |
rhs
The right hand side of the equation system. |
private int[] |
row
Encodes row permutations, row i is at position row[i]. |
private boolean |
solvable
Indicates if linear equation system is solvable. |
private boolean |
solved
Indicates if solvability has been checked. |
private static int |
TOTAL_PIVOT_SEARCH
Indicates total pivot search strategy. |
private static int |
TRIVAL_PIVOT_SEARCH
Indicates trivial pivot search strategy. |
private double[][] |
u
Holds the space of solutions of the homogeneous linear equation system. |
private double[] |
x_0
Holds the special solution vector. |
Constructor Summary | |
---|---|
LinearEquationSystem(double[][] a,
double[] b)
Constructs a linear equation system with given coefficient matrix a and right hand side b . |
|
LinearEquationSystem(double[][] a,
double[] b,
int[] rowPermutations,
int[] columnPermutations)
Constructs a linear equation system with given coefficient matrix a and right hand side b . |
Method Summary | |
---|---|
String |
equationsToString(int fractionDigits)
Returns a string representation of this equation system. |
String |
equationsToString(NumberFormat nf)
Returns a string representation of this equation system. |
String |
equationsToString(String prefix,
int fractionDigits)
Returns a string representation of this equation system. |
String |
equationsToString(String prefix,
NumberFormat nf)
Returns a string representation of this equation system. |
private void |
format(NumberFormat nf,
StringBuffer buffer,
double value,
int maxIntegerDigits)
Helper method for output of equations and solution. |
double[][] |
getCoefficents()
Returns a copy of the coefficient array of this linear equation system. |
int[] |
getColumnPermutations()
Returns a copy of the column permutations, column i is at position column[i]. |
double[] |
getRHS()
Returns a copy of the right hand side of this linear equation system. |
int[] |
getRowPermutations()
Returns a copy of the row permutations, row i is at position row[i]. |
private int |
integerDigits(double d)
Returns the integer digits of the specified double value. |
boolean |
isSolvable()
Checks if a solved system is solvable. |
private boolean |
isSolvable(int method)
Checks solvability of this linear equation system with the chosen method. |
boolean |
isSolved()
Tests if system has already been tested for solvability. |
private int |
maxIntegerDigits(double[] values)
Returns the maximum integer digits of the specified values. |
private int[] |
maxIntegerDigits(double[][] values)
Returns the maximum integer digits in each column of the specified values. |
private IntIntPair |
nonZeroPivotSearch(int k)
Method for trivial pivot search, searches for non-zero entry. |
private void |
permutePivot(IntIntPair pos1,
IntIntPair pos2)
permutes two matrix rows and two matrix columns |
private void |
pivotOperation(int k)
performs a pivot operation |
private void |
reducedRowEchelonForm(int method)
Brings this linear equation system into reduced row echelon form with choice of pivot method. |
String |
solutionToString(int fractionDigits)
Returns a string representation of the solution of this equation system. |
private void |
solve(int method)
solves linear system with the chosen method |
void |
solveByTotalPivotSearch()
Solves this linear equation system by total pivot search. |
void |
solveByTrivialPivotSearch()
Solves this linear equation system by trivial pivot search. |
int |
subspacedim()
Return dimensionality of spanned subspace. |
private IntIntPair |
totalPivotSearch(int k)
Method for total pivot search, searches for x,y in {k,...n}, so that |a_xy| > |a_ij| |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final Logging logger
private static final int TRIVAL_PIVOT_SEARCH
private static final int TOTAL_PIVOT_SEARCH
private boolean solvable
private boolean solved
private int rank
private double[][] coeff
private double[] rhs
private int[] row
private int[] col
private double[] x_0
private double[][] u
private boolean reducedRowEchelonForm
Constructor Detail |
---|
public LinearEquationSystem(double[][] a, double[] b)
a
and right hand side b
.
a
- the matrix of the coefficients of the linear equation systemb
- the right hand side of the linear equation systempublic LinearEquationSystem(double[][] a, double[] b, int[] rowPermutations, int[] columnPermutations)
a
and right hand side b
.
a
- the matrix of the coefficients of the linear equation systemb
- the right hand side of the linear equation systemrowPermutations
- the row permutations, row i is at position row[i]columnPermutations
- the column permutations, column i is at position
column[i]Method Detail |
---|
public double[][] getCoefficents()
public double[] getRHS()
public int[] getRowPermutations()
public int[] getColumnPermutations()
public boolean isSolved()
public void solveByTotalPivotSearch()
( a_11 ... a_1n )
( 0 ... a_2n )
( 0 ... a_ii ... a_in )
( 0 ... a_(i+1)i ... a_(i+1)n )
( 0 ... a_ni ... a_nn )
Then we search for x,y in {i,...n}, so that |a_xy| > |a_ij|
public void solveByTrivialPivotSearch()
public boolean isSolvable()
public String equationsToString(String prefix, int fractionDigits)
prefix
- the prefix of each linefractionDigits
- the number of fraction digits for output accuracy
public String equationsToString(String prefix, NumberFormat nf)
prefix
- the prefix of each linenf
- the number format
public String equationsToString(NumberFormat nf)
nf
- the number format
public String equationsToString(int fractionDigits)
fractionDigits
- the number of fraction digits for output accuracy
public String solutionToString(int fractionDigits)
fractionDigits
- precision
private void reducedRowEchelonForm(int method)
method
- the pivot search method to useprivate IntIntPair totalPivotSearch(int k)
k
- search starts at entry (k,k)
private IntIntPair nonZeroPivotSearch(int k)
k
- search starts at entry (k,k)
private void permutePivot(IntIntPair pos1, IntIntPair pos2)
pos1
- the fist position for the permutationpos2
- the second position for the permutationprivate void pivotOperation(int k)
k
- pivoting takes place below (k,k)private void solve(int method) throws NullPointerException
method
- the pivot search method
NullPointerException
private boolean isSolvable(int method) throws NullPointerException
method
- the pivot search method
NullPointerException
private int[] maxIntegerDigits(double[][] values)
values
- the values array
private int maxIntegerDigits(double[] values)
values
- the values array
private int integerDigits(double d)
d
- the double value
private void format(NumberFormat nf, StringBuffer buffer, double value, int maxIntegerDigits)
nf
- the number formatbuffer
- the string buffer to append the value tovalue
- the value to appendmaxIntegerDigits
- the maximum number of integer digitspublic int subspacedim()
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |