commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1034209 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/linear/ main/java/org/apache/commons/math/random/ test/java/org/apache/commons/math/random/
Date Thu, 11 Nov 2010 23:36:32 GMT
Author: erans
Date: Thu Nov 11 23:36:32 2010
New Revision: 1034209

URL: http://svn.apache.org/viewvc?rev=1034209&view=rev
Log:
MATH-438
Removed deprecated class. Updated affected files to use the new
"NonPositiveDefiniteMatrixException" defined in package "exception".

Removed:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/NotPositiveDefiniteMatrixException.java
Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/CorrelatedRandomVectorGenerator.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/CorrelatedRandomVectorGeneratorTest.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/CorrelatedRandomVectorGenerator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/CorrelatedRandomVectorGenerator.java?rev=1034209&r1=1034208&r2=1034209&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/CorrelatedRandomVectorGenerator.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/CorrelatedRandomVectorGenerator.java
Thu Nov 11 23:36:32 2010
@@ -18,8 +18,8 @@
 package org.apache.commons.math.random;
 
 import org.apache.commons.math.DimensionMismatchException;
+import org.apache.commons.math.exception.NonPositiveDefiniteMatrixException;
 import org.apache.commons.math.linear.MatrixUtils;
-import org.apache.commons.math.linear.NotPositiveDefiniteMatrixException;
 import org.apache.commons.math.linear.RealMatrix;
 import org.apache.commons.math.util.FastMath;
 
@@ -89,7 +89,7 @@ public class CorrelatedRandomVectorGener
      * components
      * @exception IllegalArgumentException if there is a dimension
      * mismatch between the mean vector and the covariance matrix
-     * @exception NotPositiveDefiniteMatrixException if the
+     * @exception NonPositiveDefiniteMatrixException if the
      * covariance matrix is not strictly positive definite
      * @exception DimensionMismatchException if the mean and covariance
      * arrays dimensions don't match
@@ -97,7 +97,7 @@ public class CorrelatedRandomVectorGener
     public CorrelatedRandomVectorGenerator(double[] mean,
                                            RealMatrix covariance, double small,
                                            NormalizedRandomGenerator generator)
-    throws NotPositiveDefiniteMatrixException, DimensionMismatchException {
+    throws DimensionMismatchException {
 
         int order = covariance.getRowDimension();
         if (mean.length != order) {
@@ -120,13 +120,11 @@ public class CorrelatedRandomVectorGener
      * considered to be dependent on previous ones and are discarded
      * @param generator underlying generator for uncorrelated normalized
      * components
-     * @exception NotPositiveDefiniteMatrixException if the
+     * @exception NonPositiveDefiniteMatrixException if the
      * covariance matrix is not strictly positive definite
      */
     public CorrelatedRandomVectorGenerator(RealMatrix covariance, double small,
-                                           NormalizedRandomGenerator generator)
-    throws NotPositiveDefiniteMatrixException {
-
+                                           NormalizedRandomGenerator generator) {
         int order = covariance.getRowDimension();
         mean = new double[order];
         for (int i = 0; i < order; ++i) {
@@ -182,12 +180,10 @@ public class CorrelatedRandomVectorGener
      * @param covariance covariance matrix
      * @param small diagonal elements threshold under which  column are
      * considered to be dependent on previous ones and are discarded
-     * @exception NotPositiveDefiniteMatrixException if the
+     * @exception NonPositiveDefiniteMatrixException if the
      * covariance matrix is not strictly positive definite
      */
-    private void decompose(RealMatrix covariance, double small)
-    throws NotPositiveDefiniteMatrixException {
-
+    private void decompose(RealMatrix covariance, double small) {
         int order = covariance.getRowDimension();
         double[][] c = covariance.getData();
         double[][] b = new double[order][order];
@@ -224,7 +220,7 @@ public class CorrelatedRandomVectorGener
             if (c[ir][ir] < small) {
 
                 if (rank == 0) {
-                    throw new NotPositiveDefiniteMatrixException();
+                    throw new NonPositiveDefiniteMatrixException(ir, small);
                 }
 
                 // check remaining diagonal elements
@@ -232,7 +228,7 @@ public class CorrelatedRandomVectorGener
                     if (c[index[i]][index[i]] < -small) {
                         // there is at least one sufficiently negative diagonal element,
                         // the covariance matrix is wrong
-                        throw new NotPositiveDefiniteMatrixException();
+                        throw new NonPositiveDefiniteMatrixException(i, small);
                     }
                 }
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/CorrelatedRandomVectorGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/CorrelatedRandomVectorGeneratorTest.java?rev=1034209&r1=1034208&r2=1034209&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/CorrelatedRandomVectorGeneratorTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/CorrelatedRandomVectorGeneratorTest.java
Thu Nov 11 23:36:32 2010
@@ -20,8 +20,8 @@ package org.apache.commons.math.random;
 import junit.framework.TestCase;
 
 import org.apache.commons.math.DimensionMismatchException;
+import org.apache.commons.math.exception.NonPositiveDefiniteMatrixException;
 import org.apache.commons.math.linear.MatrixUtils;
-import org.apache.commons.math.linear.NotPositiveDefiniteMatrixException;
 import org.apache.commons.math.linear.RealMatrix;
 import org.apache.commons.math.stat.descriptive.moment.VectorialCovariance;
 import org.apache.commons.math.stat.descriptive.moment.VectorialMean;
@@ -42,7 +42,7 @@ extends TestCase {
     }
 
     public void testMath226()
-        throws DimensionMismatchException, NotPositiveDefiniteMatrixException {
+        throws DimensionMismatchException {
         double[] mean = { 1, 1, 10, 1 };
         double[][] cov = {
                 { 1, 3, 2, 6 },
@@ -129,7 +129,7 @@ extends TestCase {
                                                             rawGenerator);
         } catch (DimensionMismatchException e) {
             fail(e.getMessage());
-        } catch (NotPositiveDefiniteMatrixException e) {
+        } catch (NonPositiveDefiniteMatrixException e) {
             fail("not positive definite matrix");
         }
     }



Mime
View raw message