renamed RealMatrixImpl, RealVectorImpl, FieldMatrixImpl and FieldVectorImpl
into Array2DRowRealMatrix, ArrayRealVector, Array2DRowFieldMatrix and ArrayFieldVector as suggested by Sam in http://markmail.org/message/hh37ivxpzaoapekj git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk/src/experimental@783702 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fd82d75e53
commit
bf8c2bf9ab
|
@ -37,7 +37,7 @@ public class CholeskySolver {
|
|||
private double numericalZero = 10E-12;
|
||||
|
||||
/** The lower triangular matrix */
|
||||
private RealMatrixImpl decompMatrix;
|
||||
private Array2DRowRealMatrix decompMatrix;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -108,7 +108,7 @@ public class CholeskySolver {
|
|||
|
||||
}//for all columns
|
||||
|
||||
decompMatrix = new RealMatrixImpl(decomp);
|
||||
decompMatrix = new Array2DRowRealMatrix(decomp);
|
||||
|
||||
}//decompose
|
||||
|
||||
|
@ -119,7 +119,7 @@ public class CholeskySolver {
|
|||
* Caution: Every call of this Method will return the same object.
|
||||
* Decomposing another matrix will generate a new one.
|
||||
*/
|
||||
public RealMatrixImpl getDecomposition() {
|
||||
public Array2DRowRealMatrix getDecomposition() {
|
||||
return decompMatrix;
|
||||
}//getDecomposition
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ extends TestCase {
|
|||
|
||||
try {
|
||||
solver.decompose(
|
||||
new RealMatrixImpl(new double[][]{{numericalZero/2, 0},
|
||||
new Array2DRowRealMatrix(new double[][]{{numericalZero/2, 0},
|
||||
{0, numericalZero/2}}));
|
||||
fail("testing numericalZero");
|
||||
} catch (IllegalArgumentException e) {}
|
||||
|
@ -127,7 +127,7 @@ extends TestCase {
|
|||
|
||||
try {
|
||||
CholeskySolver solver = new CholeskySolver();
|
||||
solver.decompose(new RealMatrixImpl(m7));
|
||||
solver.decompose(new Array2DRowRealMatrix(m7));
|
||||
fail("Decomposing matrix m7");
|
||||
} catch (IllegalArgumentException e) {}
|
||||
|
||||
|
@ -162,7 +162,7 @@ extends TestCase {
|
|||
|
||||
try {
|
||||
CholeskySolver solver = new CholeskySolver();
|
||||
solver.solve(new RealMatrixImpl(m3), new double[] {1, 2, 3, 4});
|
||||
solver.solve(new Array2DRowRealMatrix(m3), new double[] {1, 2, 3, 4});
|
||||
fail("Solving matrix m3[3x3], v[4]");
|
||||
} catch (IllegalArgumentException e) {}
|
||||
|
||||
|
@ -201,7 +201,7 @@ extends TestCase {
|
|||
private void testDecompose(double[][] lowerTriangularMatrix, String message)
|
||||
throws IllegalArgumentException {
|
||||
|
||||
RealMatrix triangularMatrix = new RealMatrixImpl(lowerTriangularMatrix);
|
||||
RealMatrix triangularMatrix = new Array2DRowRealMatrix(lowerTriangularMatrix);
|
||||
RealMatrix pdMatrix =
|
||||
triangularMatrix.multiply(triangularMatrix.transpose());
|
||||
|
||||
|
@ -220,9 +220,9 @@ extends TestCase {
|
|||
private void testSolve(double[][] lowerTriangularMatrix, String message) {
|
||||
|
||||
RealMatrix triangularMatrix =
|
||||
new RealMatrixImpl(lowerTriangularMatrix);
|
||||
RealMatrixImpl pdMatrix =
|
||||
(RealMatrixImpl) triangularMatrix.multiply(triangularMatrix.transpose());
|
||||
new Array2DRowRealMatrix(lowerTriangularMatrix);
|
||||
Array2DRowRealMatrix pdMatrix =
|
||||
(Array2DRowRealMatrix) triangularMatrix.multiply(triangularMatrix.transpose());
|
||||
CholeskySolver solver =
|
||||
new CholeskySolver();
|
||||
|
||||
|
@ -232,10 +232,10 @@ extends TestCase {
|
|||
c[i] += lowerTriangularMatrix[i][j];
|
||||
|
||||
solver.decompose(pdMatrix);
|
||||
RealMatrix x = new RealMatrixImpl(solver.solve(c));
|
||||
RealMatrix x = new Array2DRowRealMatrix(solver.solve(c));
|
||||
|
||||
assertTrue(message,
|
||||
areEqual(pdMatrix.multiply(x), new RealMatrixImpl(c), 1.0E-10));
|
||||
areEqual(pdMatrix.multiply(x), new Array2DRowRealMatrix(c), 1.0E-10));
|
||||
}//testSolve
|
||||
|
||||
|
||||
|
@ -247,7 +247,7 @@ extends TestCase {
|
|||
String message)
|
||||
throws IllegalArgumentException {
|
||||
|
||||
RealMatrix triangularMatrix = new RealMatrixImpl(lowerTriangularMatrix);
|
||||
RealMatrix triangularMatrix = new Array2DRowRealMatrix(lowerTriangularMatrix);
|
||||
RealMatrix pdMatrix =
|
||||
triangularMatrix.multiply(triangularMatrix.transpose());
|
||||
double pdDeterminant = determinant * determinant;
|
||||
|
|
Loading…
Reference in New Issue