commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From celes...@apache.org
Subject svn commit: r1173965 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/linear/ main/java/org/apache/commons/math/optimization/direct/ test/java/org/apache/commons/math/linear/
Date Thu, 22 Sep 2011 06:43:56 GMT
Author: celestin
Date: Thu Sep 22 06:43:55 2011
New Revision: 1173965

URL: http://svn.apache.org/viewvc?rev=1173965&view=rev
Log:
Merged EigenDecomposition and EigenDecompositionImpl (see MATH-662).

Added:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecomposition.java
      - copied, changed from r1173787, commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecompositionImpl.java
Removed:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecompositionImpl.java
Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/CMAESOptimizer.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/EigenDecompositionTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/EigenSolverTest.java

Copied: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecomposition.java
(from r1173787, commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecompositionImpl.java)
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecomposition.java?p2=commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecomposition.java&p1=commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecompositionImpl.java&r1=1173787&r2=1173965&rev=1173965&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecompositionImpl.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecomposition.java
Thu Sep 22 06:43:55 2011
@@ -26,10 +26,21 @@ import org.apache.commons.math.util.Fast
 /**
  * Calculates the eigen decomposition of a real <strong>symmetric</strong>
  * matrix.
- * <p>
- * The eigen decomposition of matrix A is a set of two matrices: V and D such
- * that A = V D V<sup>T</sup>. A, V and D are all m &times; m matrices.
- * </p>
+ * <p>The eigen decomposition of matrix A is a set of two matrices:
+ * V and D such that A = V &times; D &times; V<sup>T</sup>.
+ * A, V and D are all m &times; m matrices.</p>
+ * <p>This class is similar in spirit to the <code>EigenvalueDecomposition</code>
+ * class from the <a href="http://math.nist.gov/javanumerics/jama/">JAMA</a>
+ * library, with the following changes:</p>
+ * <ul>
+ *   <li>a {@link #getVT() getVt} method has been added,</li>
+ *   <li>two {@link #getRealEigenvalue(int) getRealEigenvalue} and {@link #getImagEigenvalue(int)
+ *   getImagEigenvalue} methods to pick up a single eigenvalue have been added,</li>
+ *   <li>a {@link #getEigenvector(int) getEigenvector} method to pick up a single
+ *   eigenvector has been added,</li>
+ *   <li>a {@link #getDeterminant() getDeterminant} method has been added.</li>
+ *   <li>a {@link #getSolver() getSolver} method has been added.</li>
+ * </ul>
  * <p>
  * As of 2.0, this class supports only <strong>symmetric</strong> matrices, and
  * hence computes only real realEigenvalues. This implies the D matrix returned
@@ -48,10 +59,12 @@ import org.apache.commons.math.util.Fast
  * Handbook for automatic computation, vol. 2, Linear algebra, Springer-Verlag,
  * New-York
  * </p>
+ * @see <a href="http://mathworld.wolfram.com/EigenDecomposition.html">MathWorld</a>
+ * @see <a href="http://en.wikipedia.org/wiki/Eigendecomposition_of_a_matrix">Wikipedia</a>
  * @version $Id$
- * @since 2.0
+ * @since 2.0 (changed to concrete class in 3.0)
  */
-public class EigenDecompositionImpl implements EigenDecomposition {
+public class EigenDecomposition{
 
     /** Maximum number of iterations accepted in the implicit QL transformation */
     private byte maxIter = 30;
@@ -95,7 +108,7 @@ public class EigenDecompositionImpl impl
      * @throws NonSymmetricMatrixException if the matrix is not symmetric.
      * @throws MaxCountExceededException if the algorithm fails to converge.
      */
-    public EigenDecompositionImpl(final RealMatrix matrix,
+    public EigenDecomposition(final RealMatrix matrix,
                                   final double splitTolerance)  {
         if (isSymmetric(matrix, true)) {
             transformToTridiagonal(matrix);
@@ -113,7 +126,7 @@ public class EigenDecompositionImpl impl
      * compatibility only).
      * @throws MaxCountExceededException if the algorithm fails to converge.
      */
-    public EigenDecompositionImpl(final double[] main,final double[] secondary,
+    public EigenDecomposition(final double[] main,final double[] secondary,
                                   final double splitTolerance) {
         this.main      = main.clone();
         this.secondary = secondary.clone();
@@ -157,7 +170,15 @@ public class EigenDecompositionImpl impl
         return true;
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Returns the matrix V of the decomposition.
+     * <p>V is an orthogonal matrix, i.e. its transpose is also its inverse.</p>
+     * <p>The columns of V are the eigenvectors of the original matrix.</p>
+     * <p>No assumption is made about the orientation of the system axes formed
+     * by the columns of V (e.g. in a 3-dimension space, V can form a left-
+     * or right-handed system).</p>
+     * @return the V matrix
+     */
     public RealMatrix getV() {
 
         if (cachedV == null) {
@@ -172,7 +193,15 @@ public class EigenDecompositionImpl impl
 
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Returns the block diagonal matrix D of the decomposition.
+     * <p>D is a block diagonal matrix.</p>
+     * <p>Real eigenvalues are on the diagonal while complex values are on
+     * 2x2 blocks { {real +imaginary}, {-imaginary, real} }.</p>
+     * @return the D matrix
+     * @see #getRealEigenvalues()
+     * @see #getImagEigenvalues()
+     */
     public RealMatrix getD() {
         if (cachedD == null) {
             // cache the matrix for subsequent calls
@@ -181,7 +210,15 @@ public class EigenDecompositionImpl impl
         return cachedD;
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Returns the transpose of the matrix V of the decomposition.
+     * <p>V is an orthogonal matrix, i.e. its transpose is also its inverse.</p>
+     * <p>The columns of V are the eigenvectors of the original matrix.</p>
+     * <p>No assumption is made about the orientation of the system axes formed
+     * by the columns of V (e.g. in a 3-dimension space, V can form a left-
+     * or right-handed system).</p>
+     * @return the transpose of the V matrix
+     */
     public RealMatrix getVT() {
 
         if (cachedVt == null) {
@@ -197,27 +234,58 @@ public class EigenDecompositionImpl impl
         return cachedVt;
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Returns a copy of the real parts of the eigenvalues of the original matrix.
+     * @return a copy of the real parts of the eigenvalues of the original matrix
+     * @see #getD()
+     * @see #getRealEigenvalue(int)
+     * @see #getImagEigenvalues()
+     */
     public double[] getRealEigenvalues() {
         return realEigenvalues.clone();
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Returns the real part of the i<sup>th</sup> eigenvalue of the original
matrix.
+     * @param i index of the eigenvalue (counting from 0)
+     * @return real part of the i<sup>th</sup> eigenvalue of the original matrix
+     * @see #getD()
+     * @see #getRealEigenvalues()
+     * @see #getImagEigenvalue(int)
+     */
     public double getRealEigenvalue(final int i) {
         return realEigenvalues[i];
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Returns a copy of the imaginary parts of the eigenvalues of the original matrix.
+     * @return a copy of the imaginary parts of the eigenvalues of the original matrix
+     * @see #getD()
+     * @see #getImagEigenvalue(int)
+     * @see #getRealEigenvalues()
+     */
     public double[] getImagEigenvalues() {
         return imagEigenvalues.clone();
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Returns the imaginary part of the i<sup>th</sup> eigenvalue of the original
matrix.
+     * @param i index of the eigenvalue (counting from 0)
+     * @return imaginary part of the i<sup>th</sup> eigenvalue of the original
matrix
+     * @see #getD()
+     * @see #getImagEigenvalues()
+     * @see #getRealEigenvalue(int)
+     */
     public double getImagEigenvalue(final int i) {
         return imagEigenvalues[i];
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Returns a copy of the i<sup>th</sup> eigenvector of the original matrix.
+     * @param i index of the eigenvector (counting from 0)
+     * @return copy of the i<sup>th</sup> eigenvector of the original matrix
+     * @see #getD()
+     */
     public RealVector getEigenvector(final int i) {
         return eigenvectors[i].copy();
     }
@@ -234,7 +302,10 @@ public class EigenDecompositionImpl impl
         return determinant;
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Get a solver for finding the A &times; X = B solution in exact linear sense.
+     * @return a solver
+     */
     public DecompositionSolver getSolver() {
         return new Solver(realEigenvalues, imagEigenvalues, eigenvectors);
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/CMAESOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/CMAESOptimizer.java?rev=1173965&r1=1173964&r2=1173965&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/CMAESOptimizer.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/CMAESOptimizer.java
Thu Sep 22 06:43:55 2011
@@ -28,7 +28,7 @@ import org.apache.commons.math.exception
 import org.apache.commons.math.exception.OutOfRangeException;
 import org.apache.commons.math.exception.TooManyEvaluationsException;
 import org.apache.commons.math.linear.Array2DRowRealMatrix;
-import org.apache.commons.math.linear.EigenDecompositionImpl;
+import org.apache.commons.math.linear.EigenDecomposition;
 import org.apache.commons.math.linear.MatrixUtils;
 import org.apache.commons.math.linear.RealMatrix;
 import org.apache.commons.math.optimization.GoalType;
@@ -768,7 +768,7 @@ public class CMAESOptimizer extends
             // to achieve O(N^2)
             C = triu(C, 0).add(triu(C, 1).transpose());
             // enforce symmetry to prevent complex numbers
-            EigenDecompositionImpl eig = new EigenDecompositionImpl(C, 1.0);
+            EigenDecomposition eig = new EigenDecomposition(C, 1.0);
             B = eig.getV(); // eigen decomposition, B==normalized eigenvectors
             D = eig.getD();
             diagD = diag(D);

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/EigenDecompositionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/EigenDecompositionTest.java?rev=1173965&r1=1173964&r2=1173965&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/EigenDecompositionTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/EigenDecompositionTest.java
Thu Sep 22 06:43:55 2011
@@ -37,8 +37,8 @@ public class EigenDecompositionTest {
     public void testDimension1() {
         RealMatrix matrix =
             MatrixUtils.createRealMatrix(new double[][] { { 1.5 } });
-        EigenDecompositionImpl ed;
-        ed = new EigenDecompositionImpl(matrix, MathUtils.SAFE_MIN);
+        EigenDecomposition ed;
+        ed = new EigenDecomposition(matrix, MathUtils.SAFE_MIN);
         Assert.assertEquals(1.5, ed.getRealEigenvalue(0), 1.0e-15);
     }
 
@@ -49,8 +49,8 @@ public class EigenDecompositionTest {
                     { 59.0, 12.0 },
                     { 12.0, 66.0 }
             });
-        EigenDecompositionImpl ed;
-        ed = new EigenDecompositionImpl(matrix, MathUtils.SAFE_MIN);
+        EigenDecomposition ed;
+        ed = new EigenDecomposition(matrix, MathUtils.SAFE_MIN);
         Assert.assertEquals(75.0, ed.getRealEigenvalue(0), 1.0e-15);
         Assert.assertEquals(50.0, ed.getRealEigenvalue(1), 1.0e-15);
     }
@@ -63,8 +63,8 @@ public class EigenDecompositionTest {
                                    {  -4824.0,  8693.0,   7920.0 },
                                    { -16560.0,  7920.0,  17300.0 }
                                });
-        EigenDecompositionImpl ed;
-        ed = new EigenDecompositionImpl(matrix, MathUtils.SAFE_MIN);
+        EigenDecomposition ed;
+        ed = new EigenDecomposition(matrix, MathUtils.SAFE_MIN);
         Assert.assertEquals(50000.0, ed.getRealEigenvalue(0), 3.0e-11);
         Assert.assertEquals(12500.0, ed.getRealEigenvalue(1), 3.0e-11);
         Assert.assertEquals( 3125.0, ed.getRealEigenvalue(2), 3.0e-11);
@@ -78,8 +78,8 @@ public class EigenDecompositionTest {
                     { 10,   20,   30 },
                     { 15,   30,   45 }
             });
-        EigenDecompositionImpl ed;
-        ed = new EigenDecompositionImpl(matrix, MathUtils.SAFE_MIN);
+        EigenDecomposition ed;
+        ed = new EigenDecomposition(matrix, MathUtils.SAFE_MIN);
         Assert.assertEquals(70.0, ed.getRealEigenvalue(0), 3.0e-11);
         Assert.assertEquals(0.0,  ed.getRealEigenvalue(1), 3.0e-11);
         Assert.assertEquals(0.0,  ed.getRealEigenvalue(2), 3.0e-11);
@@ -94,8 +94,8 @@ public class EigenDecompositionTest {
                                    {  0.000,  0.000,  0.164, -0.048 },
                                    {  0.000,  0.000, -0.048,  0.136 }
                                });
-        EigenDecompositionImpl ed;
-        ed = new EigenDecompositionImpl(matrix, MathUtils.SAFE_MIN);
+        EigenDecomposition ed;
+        ed = new EigenDecomposition(matrix, MathUtils.SAFE_MIN);
         Assert.assertEquals(1.0, ed.getRealEigenvalue(0), 1.0e-15);
         Assert.assertEquals(0.4, ed.getRealEigenvalue(1), 1.0e-15);
         Assert.assertEquals(0.2, ed.getRealEigenvalue(2), 1.0e-15);
@@ -111,8 +111,8 @@ public class EigenDecompositionTest {
                                    {  0.1152, -0.2304,  0.3088, -0.1344 },
                                    { -0.2976,  0.1152, -0.1344,  0.3872 }
                                });
-        EigenDecompositionImpl ed;
-        ed = new EigenDecompositionImpl(matrix, MathUtils.SAFE_MIN);
+        EigenDecomposition ed;
+        ed = new EigenDecomposition(matrix, MathUtils.SAFE_MIN);
         Assert.assertEquals(1.0, ed.getRealEigenvalue(0), 1.0e-15);
         Assert.assertEquals(0.4, ed.getRealEigenvalue(1), 1.0e-15);
         Assert.assertEquals(0.2, ed.getRealEigenvalue(2), 1.0e-15);
@@ -143,8 +143,8 @@ public class EigenDecompositionTest {
             new ArrayRealVector(new double[] { -0.584677060845929,  0.367177264979103,  0.721453187784497,
-0.052971054621812,  0.005740715188257 })
         };
 
-        EigenDecompositionImpl decomposition;
-        decomposition = new EigenDecompositionImpl(mainTridiagonal,
+        EigenDecomposition decomposition;
+        decomposition = new EigenDecomposition(mainTridiagonal,
                                                    secondaryTridiagonal,
                                                    MathUtils.SAFE_MIN);
 
@@ -188,8 +188,8 @@ public class EigenDecompositionTest {
         };
 
         // the following line triggers the exception
-        EigenDecompositionImpl decomposition;
-        decomposition = new EigenDecompositionImpl(mainTridiagonal,
+        EigenDecomposition decomposition;
+        decomposition = new EigenDecomposition(mainTridiagonal,
                                                    secondaryTridiagonal,
                                                    MathUtils.SAFE_MIN);
 
@@ -235,8 +235,8 @@ public class EigenDecompositionTest {
         };
 
         // the following line triggers the exception
-        EigenDecompositionImpl decomposition;
-        decomposition = new EigenDecompositionImpl(mainTridiagonal,
+        EigenDecomposition decomposition;
+        decomposition = new EigenDecomposition(mainTridiagonal,
                                                    secondaryTridiagonal,
                                                    MathUtils.SAFE_MIN);
 
@@ -267,8 +267,8 @@ public class EigenDecompositionTest {
         Arrays.sort(ref);
         TriDiagonalTransformer t =
             new TriDiagonalTransformer(createTestMatrix(r, ref));
-        EigenDecompositionImpl ed;
-        ed = new EigenDecompositionImpl(t.getMainDiagonalRef(),
+        EigenDecomposition ed;
+        ed = new EigenDecomposition(t.getMainDiagonalRef(),
                                         t.getSecondaryDiagonalRef(),
                                         MathUtils.SAFE_MIN);
         double[] eigenValues = ed.getRealEigenvalues();
@@ -283,8 +283,8 @@ public class EigenDecompositionTest {
     @Test
     public void testDimensions() {
         final int m = matrix.getRowDimension();
-        EigenDecompositionImpl ed;
-        ed = new EigenDecompositionImpl(matrix, MathUtils.SAFE_MIN);
+        EigenDecomposition ed;
+        ed = new EigenDecomposition(matrix, MathUtils.SAFE_MIN);
         Assert.assertEquals(m, ed.getV().getRowDimension());
         Assert.assertEquals(m, ed.getV().getColumnDimension());
         Assert.assertEquals(m, ed.getD().getColumnDimension());
@@ -296,8 +296,8 @@ public class EigenDecompositionTest {
     /** test eigenvalues */
     @Test
     public void testEigenvalues() {
-        EigenDecompositionImpl ed;
-        ed = new EigenDecompositionImpl(matrix, MathUtils.SAFE_MIN);
+        EigenDecomposition ed;
+        ed = new EigenDecomposition(matrix, MathUtils.SAFE_MIN);
         double[] eigenValues = ed.getRealEigenvalues();
         Assert.assertEquals(refValues.length, eigenValues.length);
         for (int i = 0; i < refValues.length; ++i) {
@@ -314,8 +314,8 @@ public class EigenDecompositionTest {
             bigValues[i] = 2 * r.nextDouble() - 1;
         }
         Arrays.sort(bigValues);
-        EigenDecompositionImpl ed;
-        ed = new EigenDecompositionImpl(createTestMatrix(r, bigValues),
+        EigenDecomposition ed;
+        ed = new EigenDecomposition(createTestMatrix(r, bigValues),
                                         MathUtils.SAFE_MIN);
         double[] eigenValues = ed.getRealEigenvalues();
         Assert.assertEquals(bigValues.length, eigenValues.length);
@@ -327,8 +327,8 @@ public class EigenDecompositionTest {
     /** test eigenvectors */
     @Test
     public void testEigenvectors() {
-        EigenDecompositionImpl ed;
-        ed = new EigenDecompositionImpl(matrix, MathUtils.SAFE_MIN);
+        EigenDecomposition ed;
+        ed = new EigenDecomposition(matrix, MathUtils.SAFE_MIN);
         for (int i = 0; i < matrix.getRowDimension(); ++i) {
             double lambda = ed.getRealEigenvalue(i);
             RealVector v  = ed.getEigenvector(i);
@@ -340,8 +340,8 @@ public class EigenDecompositionTest {
     /** test A = VDVt */
     @Test
     public void testAEqualVDVt() {
-        EigenDecompositionImpl ed;
-        ed = new EigenDecompositionImpl(matrix, MathUtils.SAFE_MIN);
+        EigenDecomposition ed;
+        ed = new EigenDecomposition(matrix, MathUtils.SAFE_MIN);
         RealMatrix v  = ed.getV();
         RealMatrix d  = ed.getD();
         RealMatrix vT = ed.getVT();
@@ -352,7 +352,7 @@ public class EigenDecompositionTest {
     /** test that V is orthogonal */
     @Test
     public void testVOrthogonal() {
-        RealMatrix v = new EigenDecompositionImpl(matrix, MathUtils.SAFE_MIN).getV();
+        RealMatrix v = new EigenDecomposition(matrix, MathUtils.SAFE_MIN).getV();
         RealMatrix vTv = v.transpose().multiply(v);
         RealMatrix id  = MatrixUtils.createRealIdentityMatrix(vTv.getRowDimension());
         Assert.assertEquals(0, vTv.subtract(id).getNorm(), 2.0e-13);
@@ -363,8 +363,8 @@ public class EigenDecompositionTest {
     public void testDiagonal() {
         double[] diagonal = new double[] { -3.0, -2.0, 2.0, 5.0 };
         RealMatrix m = createDiagonalMatrix(diagonal, diagonal.length, diagonal.length);
-        EigenDecompositionImpl ed;
-        ed = new EigenDecompositionImpl(m, MathUtils.SAFE_MIN);
+        EigenDecomposition ed;
+        ed = new EigenDecomposition(m, MathUtils.SAFE_MIN);
         Assert.assertEquals(diagonal[0], ed.getRealEigenvalue(3), 2.0e-15);
         Assert.assertEquals(diagonal[1], ed.getRealEigenvalue(2), 2.0e-15);
         Assert.assertEquals(diagonal[2], ed.getRealEigenvalue(1), 2.0e-15);
@@ -381,8 +381,8 @@ public class EigenDecompositionTest {
                 {2,  0,  2},
                 {4,  2,  3}
         });
-        EigenDecompositionImpl ed;
-        ed = new EigenDecompositionImpl(repeated, MathUtils.SAFE_MIN);
+        EigenDecomposition ed;
+        ed = new EigenDecomposition(repeated, MathUtils.SAFE_MIN);
         checkEigenValues((new double[] {8, -1, -1}), ed, 1E-12);
         checkEigenVector((new double[] {2, 1, 2}), ed, 1E-12);
     }
@@ -397,8 +397,8 @@ public class EigenDecompositionTest {
                 {1, 3, -4},
                 {-4, -4, 8}
         });
-        EigenDecompositionImpl ed;
-        ed = new EigenDecompositionImpl(distinct, MathUtils.SAFE_MIN);
+        EigenDecomposition ed;
+        ed = new EigenDecomposition(distinct, MathUtils.SAFE_MIN);
         checkEigenValues((new double[] {2, 0, 12}), ed, 1E-12);
         checkEigenVector((new double[] {1, -1, 0}), ed, 1E-12);
         checkEigenVector((new double[] {1, 1, 1}), ed, 1E-12);
@@ -415,8 +415,8 @@ public class EigenDecompositionTest {
                 { 1.0, 1.0, 0.0 },
                 { -1.0,0.0, 1.0 }
         });
-        EigenDecompositionImpl ed;
-        ed = new EigenDecompositionImpl(indefinite, MathUtils.SAFE_MIN);
+        EigenDecomposition ed;
+        ed = new EigenDecomposition(indefinite, MathUtils.SAFE_MIN);
         checkEigenValues((new double[] {2, 1, -1}), ed, 1E-12);
         double isqrt3 = 1/FastMath.sqrt(3.0);
         checkEigenVector((new double[] {isqrt3,isqrt3,-isqrt3}), ed, 1E-12);
@@ -431,7 +431,7 @@ public class EigenDecompositionTest {
      * values to differ by tolerance.
      */
     protected void checkEigenValues(double[] targetValues,
-            EigenDecompositionImpl ed, double tolerance) {
+            EigenDecomposition ed, double tolerance) {
         double[] observed = ed.getRealEigenvalues();
         for (int i = 0; i < observed.length; i++) {
             Assert.assertTrue(isIncludedValue(observed[i], targetValues, tolerance));
@@ -463,7 +463,7 @@ public class EigenDecompositionTest {
      * used to find vectors in one-dimensional eigenspaces.
      */
     protected void checkEigenVector(double[] eigenVector,
-            EigenDecompositionImpl ed, double tolerance) {
+            EigenDecomposition ed, double tolerance) {
         Assert.assertTrue(isIncludedColumn(eigenVector, ed.getV(), tolerance));
     }
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/EigenSolverTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/EigenSolverTest.java?rev=1173965&r1=1173964&r2=1173965&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/EigenSolverTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/EigenSolverTest.java
Thu Sep 22 06:43:55 2011
@@ -33,7 +33,7 @@ public class EigenSolverTest {
         Random r = new Random(9994100315209l);
         RealMatrix m =
             EigenDecompositionTest.createTestMatrix(r, new double[] { 1.0, 0.0, -1.0, -2.0,
-3.0 });
-        DecompositionSolver es = new EigenDecompositionImpl(m, MathUtils.SAFE_MIN).getSolver();
+        DecompositionSolver es = new EigenDecomposition(m, MathUtils.SAFE_MIN).getSolver();
         Assert.assertFalse(es.isNonSingular());
         try {
             es.getInverse();
@@ -49,7 +49,7 @@ public class EigenSolverTest {
         Random r = new Random(9994100315209l);
         RealMatrix m =
             EigenDecompositionTest.createTestMatrix(r, new double[] { 1.0, 0.5, -1.0, -2.0,
-3.0 });
-        DecompositionSolver es = new EigenDecompositionImpl(m, MathUtils.SAFE_MIN).getSolver();
+        DecompositionSolver es = new EigenDecomposition(m, MathUtils.SAFE_MIN).getSolver();
         Assert.assertTrue(es.isNonSingular());
         RealMatrix inverse = es.getInverse();
         RealMatrix error =
@@ -65,7 +65,7 @@ public class EigenSolverTest {
         };
         final RealMatrix matrix = EigenDecompositionTest.createTestMatrix(new Random(35992629946426l),
refValues);
 
-        DecompositionSolver es = new EigenDecompositionImpl(matrix, MathUtils.SAFE_MIN).getSolver();
+        DecompositionSolver es = new EigenDecomposition(matrix, MathUtils.SAFE_MIN).getSolver();
         RealMatrix b = MatrixUtils.createRealMatrix(new double[2][2]);
         try {
             es.solve(b);
@@ -98,7 +98,7 @@ public class EigenSolverTest {
                 { 40,  2, 21,  9, 51, 19 },
                 { 14, -1,  8,  0, 19, 14 }
         });
-        DecompositionSolver es = new EigenDecompositionImpl(m, MathUtils.SAFE_MIN).getSolver();
+        DecompositionSolver es = new EigenDecomposition(m, MathUtils.SAFE_MIN).getSolver();
         RealMatrix b = MatrixUtils.createRealMatrix(new double[][] {
                 { 1561, 269, 188 },
                 {   69, -21,  70 },



Mime
View raw message