|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectch.javasoft.smx.ops.Gauss
public class Gauss
Matrix operations based on gauss, i.e. adding multiples of one row to another row to cancel values. This can be used to create the (reduced) row echelon form of a matrix, from which rank and nullspace can be derived. One could also compute matrix inverses using gauss.
This class currently supports double and rational matrices. Default instances
for these cases are available at getDoubleInstance() and
getRationalInstance().
| Field Summary | |
|---|---|
double |
mTolerance
|
| Constructor Summary | |
|---|---|
Gauss(double tolerance)
Constructor for Gauss with tolerance, a usually positive
number close to zero, indicating which values have to be treated as
zero. |
|
| Method Summary | |
|---|---|
static Gauss |
getDefaultInstance(Class<? extends Number> numberClass)
Returns the default instance depending on the specified number type, which is: rational instance for one of
BigFraction
BigInteger
Long
Integer
double instance for one of
Double
Float
For other class arguments, an illegal argument exception is thrown. |
static Gauss |
getDoubleInstance()
Returns the default instance for double computations, i.e. |
static Gauss |
getRationalInstance()
Returns the default instance for rational computations, i.e. |
BigIntegerRationalMatrix |
invert(ReadableBigIntegerRationalMatrix mx)
Computes the inverse of a square matrix. |
DoubleMatrix |
invert(ReadableDoubleMatrix mx)
Computes the inverse of a square matrix. |
BigIntegerRationalMatrix |
invertMaximalSubmatrix(ReadableBigIntegerRationalMatrix mx,
int[][] ptrRowmap,
int[][] ptrColmap)
Computes the inverse of a submatrix of a non-square or singular square matrix. |
DoubleMatrix |
invertMaximalSubmatrix(ReadableDoubleMatrix mx,
int[][] ptrRowmap,
int[][] ptrColmap)
Computes the inverse of a submatrix of a non-square or singular square matrix. |
int |
nullity(ReadableBigIntegerRationalMatrix mx)
Computes the dimension of the nullspace, that is, columns - rank |
int |
nullity(ReadableDoubleMatrix mx)
Computes the dimension of the nullspace, that is, columns - rank |
BigIntegerRationalMatrix |
nullspace(ReadableBigIntegerRationalMatrix mx)
Computes a basis for the nullspace using gauss with full pivoting. |
DoubleMatrix |
nullspace(ReadableDoubleMatrix mx)
Computes a basis for the nullspace using gauss with full pivoting. |
int |
rank(ReadableBigIntegerRationalMatrix mx)
Computes the rank of the given matrix |
int |
rank(ReadableDoubleMatrix mx)
Computes the rank of the given matrix |
int |
reducedRowEchelon(DoubleMatrix mx)
Reduced row echelon form using gauss with full pivoting. |
int |
rowEchelon(BigIntegerRationalMatrix mx,
boolean reduced,
int[] rowmap,
int[] colmap)
Row echelon form using gauss with full pivoting. |
int |
rowEchelon(DoubleMatrix mx)
Row echelon form using gauss with full pivoting. |
int |
rowEchelon(DoubleMatrix mx,
boolean reduced,
int[] rowmap,
int[] colmap)
Row echelon form using gauss with full pivoting. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final double mTolerance
| Constructor Detail |
|---|
public Gauss(double tolerance)
Gauss with tolerance, a usually positive
number close to zero, indicating which values have to be treated as
zero. For rational computations, zero is typically used.
tolerance - positive number close to zero, e.g. 1e-10| Method Detail |
|---|
public int rank(ReadableDoubleMatrix mx)
mx - the matrix for which the rank should be computedpublic int rank(ReadableBigIntegerRationalMatrix mx)
mx - the matrix for which the rank should be computedpublic int nullity(ReadableDoubleMatrix mx)
public int nullity(ReadableBigIntegerRationalMatrix mx)
public DoubleMatrix invert(ReadableDoubleMatrix mx)
The method used is computing the reduced row-echelon form of the matrix [mx I], ending up in a matrix [I inv(mx)].
IllegalArgumentException - if the matrix is not a square matrix
SingularMatrixException - if the matrix is singular
public DoubleMatrix invertMaximalSubmatrix(ReadableDoubleMatrix mx,
int[][] ptrRowmap,
int[][] ptrColmap)
The method used is computing the reduced row-echelon form of the matrix [mx I], ending up in a matrix [I inv(mx)].
mx - the matrix from which submatrix of maximal rank is taken
and invertedptrRowmap - a pointer to the row mapping (out parameter), if not
null, ptrRowmap[0] will contain the row indices taken
for the inverted submatrix.ptrColmap - a pointer to the column mapping (out parameter), if not
null, ptrColmap[0] will contain the column indices taken
for the inverted submatrix.
public BigIntegerRationalMatrix invert(ReadableBigIntegerRationalMatrix mx)
The method used is computing the reduced row-echelon form of the matrix [mx I], ending up in a matrix [I inv(mx)].
IllegalArgumentException - if the matrix is not a square matrix
SingularMatrixException - if the matrix is singular
public BigIntegerRationalMatrix invertMaximalSubmatrix(ReadableBigIntegerRationalMatrix mx,
int[][] ptrRowmap,
int[][] ptrColmap)
The method used is computing the reduced row-echelon form of the matrix [mx I], ending up in a matrix [I inv(mx)].
mx - the matrix from which submatrix of maximal rank is taken
and invertedptrRowmap - a pointer to the row mapping (out parameter), if not
null, ptrRowmap[0] will contain the row indices taken
for the inverted submatrix.ptrColmap - a pointer to the column mapping (out parameter), if not
null, ptrColmap[0] will contain the column indices taken
for the inverted submatrix.
public DoubleMatrix nullspace(ReadableDoubleMatrix mx)
mx - the input matrix
public BigIntegerRationalMatrix nullspace(ReadableBigIntegerRationalMatrix mx)
mx - the input matrix
public int rowEchelon(DoubleMatrix mx)
mx - the matrix to reduce
public int reducedRowEchelon(DoubleMatrix mx)
mx - the matrix to reduce
public int rowEchelon(DoubleMatrix mx,
boolean reduced,
int[] rowmap,
int[] colmap)
mx - the matrix to reducereduced - if true, the reduced row echelon form is returned, that
is, zeros above the diagonal, toorowmap - the row mapping to reestablish the original row
ordering. the mapping is only used as out parameter, but
its length determines how many rows to use as pivot rowscolmap - the column mapping to reestablish the original column
ordering. the mapping is only used as out parameter, but
its length determines how many columns to use as pivot
columns
public int rowEchelon(BigIntegerRationalMatrix mx,
boolean reduced,
int[] rowmap,
int[] colmap)
mx - the matrix to reducereduced - if true, the reduced row echelon form is returned, that
is, zeros above the diagonal, toorowmap - the row mapping to reestablish the original row
ordering. the mapping is only used as out parameter, but
its length determines how many rows to use as pivot rowscolmap - the column mapping to reestablish the original column
ordering. the mapping is only used as out parameter, but
its length determines how many columns to use as pivot
columns
public static Gauss getDoubleInstance()
public static Gauss getRationalInstance()
public static Gauss getDefaultInstance(Class<? extends Number> numberClass)
rational instance for one ofdouble instance for one of
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||