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;
|
private double numericalZero = 10E-12;
|
||||||
|
|
||||||
/** The lower triangular matrix */
|
/** The lower triangular matrix */
|
||||||
private RealMatrixImpl decompMatrix;
|
private Array2DRowRealMatrix decompMatrix;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -108,7 +108,7 @@ public class CholeskySolver {
|
||||||
|
|
||||||
}//for all columns
|
}//for all columns
|
||||||
|
|
||||||
decompMatrix = new RealMatrixImpl(decomp);
|
decompMatrix = new Array2DRowRealMatrix(decomp);
|
||||||
|
|
||||||
}//decompose
|
}//decompose
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ public class CholeskySolver {
|
||||||
* Caution: Every call of this Method will return the same object.
|
* Caution: Every call of this Method will return the same object.
|
||||||
* Decomposing another matrix will generate a new one.
|
* Decomposing another matrix will generate a new one.
|
||||||
*/
|
*/
|
||||||
public RealMatrixImpl getDecomposition() {
|
public Array2DRowRealMatrix getDecomposition() {
|
||||||
return decompMatrix;
|
return decompMatrix;
|
||||||
}//getDecomposition
|
}//getDecomposition
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ extends TestCase {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
solver.decompose(
|
solver.decompose(
|
||||||
new RealMatrixImpl(new double[][]{{numericalZero/2, 0},
|
new Array2DRowRealMatrix(new double[][]{{numericalZero/2, 0},
|
||||||
{0, numericalZero/2}}));
|
{0, numericalZero/2}}));
|
||||||
fail("testing numericalZero");
|
fail("testing numericalZero");
|
||||||
} catch (IllegalArgumentException e) {}
|
} catch (IllegalArgumentException e) {}
|
||||||
|
@ -127,7 +127,7 @@ extends TestCase {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CholeskySolver solver = new CholeskySolver();
|
CholeskySolver solver = new CholeskySolver();
|
||||||
solver.decompose(new RealMatrixImpl(m7));
|
solver.decompose(new Array2DRowRealMatrix(m7));
|
||||||
fail("Decomposing matrix m7");
|
fail("Decomposing matrix m7");
|
||||||
} catch (IllegalArgumentException e) {}
|
} catch (IllegalArgumentException e) {}
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ extends TestCase {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CholeskySolver solver = new CholeskySolver();
|
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]");
|
fail("Solving matrix m3[3x3], v[4]");
|
||||||
} catch (IllegalArgumentException e) {}
|
} catch (IllegalArgumentException e) {}
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ extends TestCase {
|
||||||
private void testDecompose(double[][] lowerTriangularMatrix, String message)
|
private void testDecompose(double[][] lowerTriangularMatrix, String message)
|
||||||
throws IllegalArgumentException {
|
throws IllegalArgumentException {
|
||||||
|
|
||||||
RealMatrix triangularMatrix = new RealMatrixImpl(lowerTriangularMatrix);
|
RealMatrix triangularMatrix = new Array2DRowRealMatrix(lowerTriangularMatrix);
|
||||||
RealMatrix pdMatrix =
|
RealMatrix pdMatrix =
|
||||||
triangularMatrix.multiply(triangularMatrix.transpose());
|
triangularMatrix.multiply(triangularMatrix.transpose());
|
||||||
|
|
||||||
|
@ -220,9 +220,9 @@ extends TestCase {
|
||||||
private void testSolve(double[][] lowerTriangularMatrix, String message) {
|
private void testSolve(double[][] lowerTriangularMatrix, String message) {
|
||||||
|
|
||||||
RealMatrix triangularMatrix =
|
RealMatrix triangularMatrix =
|
||||||
new RealMatrixImpl(lowerTriangularMatrix);
|
new Array2DRowRealMatrix(lowerTriangularMatrix);
|
||||||
RealMatrixImpl pdMatrix =
|
Array2DRowRealMatrix pdMatrix =
|
||||||
(RealMatrixImpl) triangularMatrix.multiply(triangularMatrix.transpose());
|
(Array2DRowRealMatrix) triangularMatrix.multiply(triangularMatrix.transpose());
|
||||||
CholeskySolver solver =
|
CholeskySolver solver =
|
||||||
new CholeskySolver();
|
new CholeskySolver();
|
||||||
|
|
||||||
|
@ -232,10 +232,10 @@ extends TestCase {
|
||||||
c[i] += lowerTriangularMatrix[i][j];
|
c[i] += lowerTriangularMatrix[i][j];
|
||||||
|
|
||||||
solver.decompose(pdMatrix);
|
solver.decompose(pdMatrix);
|
||||||
RealMatrix x = new RealMatrixImpl(solver.solve(c));
|
RealMatrix x = new Array2DRowRealMatrix(solver.solve(c));
|
||||||
|
|
||||||
assertTrue(message,
|
assertTrue(message,
|
||||||
areEqual(pdMatrix.multiply(x), new RealMatrixImpl(c), 1.0E-10));
|
areEqual(pdMatrix.multiply(x), new Array2DRowRealMatrix(c), 1.0E-10));
|
||||||
}//testSolve
|
}//testSolve
|
||||||
|
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ extends TestCase {
|
||||||
String message)
|
String message)
|
||||||
throws IllegalArgumentException {
|
throws IllegalArgumentException {
|
||||||
|
|
||||||
RealMatrix triangularMatrix = new RealMatrixImpl(lowerTriangularMatrix);
|
RealMatrix triangularMatrix = new Array2DRowRealMatrix(lowerTriangularMatrix);
|
||||||
RealMatrix pdMatrix =
|
RealMatrix pdMatrix =
|
||||||
triangularMatrix.multiply(triangularMatrix.transpose());
|
triangularMatrix.multiply(triangularMatrix.transpose());
|
||||||
double pdDeterminant = determinant * determinant;
|
double pdDeterminant = determinant * determinant;
|
||||||
|
|
Loading…
Reference in New Issue