commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1372556 - in /commons/proper/math/trunk/src: changes/changes.xml test/java/org/apache/commons/math3/distribution/MultivariateNormalDistributionTest.java
Date Mon, 13 Aug 2012 19:14:00 GMT
Author: erans
Date: Mon Aug 13 19:14:00 2012
New Revision: 1372556

URL: http://svn.apache.org/viewvc?rev=1372556&view=rev
Log:
MATH-815
Unit test update (patch provided by Jared Becksfort).

Modified:
    commons/proper/math/trunk/src/changes/changes.xml
    commons/proper/math/trunk/src/test/java/org/apache/commons/math3/distribution/MultivariateNormalDistributionTest.java

Modified: commons/proper/math/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/changes/changes.xml?rev=1372556&r1=1372555&r2=1372556&view=diff
==============================================================================
--- commons/proper/math/trunk/src/changes/changes.xml (original)
+++ commons/proper/math/trunk/src/changes/changes.xml Mon Aug 13 19:14:00 2012
@@ -52,6 +52,10 @@ If the output is not quite correct, chec
   <body>
     <release version="3.1" date="TBD" description="
 ">
+      <action dev="erans" type="add" issue="MATH-815" due-to="Jared Becksfort">
+        New interface for multivariate distributions.
+        Added multivariate normal distribution.
+      </action>
       <action dev="luc" type="add" >
         Added a utility method to compute Stirling numbers of the second kind.
       </action>

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/distribution/MultivariateNormalDistributionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/distribution/MultivariateNormalDistributionTest.java?rev=1372556&r1=1372555&r2=1372556&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/distribution/MultivariateNormalDistributionTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/distribution/MultivariateNormalDistributionTest.java
Mon Aug 13 19:14:00 2012
@@ -75,7 +75,7 @@ public class MultivariateNormalDistribut
         final MultivariateNormalDistribution d = new MultivariateNormalDistribution(mu, sigma);
         d.reseedRandomGenerator(50);
 
-        final int n = 30;
+        final int n = 500000;
 
         final double[][] samples = d.sample(n);
         final int dim = d.getDimensions();
@@ -87,17 +87,16 @@ public class MultivariateNormalDistribut
             }
         }
 
-        final double sampledMeanTolerance = 1e-1;
+        final double sampledValueTolerance = 1e-2;
         for (int j = 0; j < dim; j++) {
             sampleMeans[j] /= samples.length;
-            Assert.assertEquals(mu[j], sampleMeans[j], sampledMeanTolerance);
+            Assert.assertEquals(mu[j], sampleMeans[j], sampledValueTolerance);
         }
 
-        final double sampledCovarianceTolerance = 2;
         final double[][] sampleSigma = new Covariance(samples).getCovarianceMatrix().getData();
         for (int i = 0; i < dim; i++) {
             for (int j = 0; j < dim; j++) {
-                Assert.assertEquals(sigma[i][j], sampleSigma[i][j], sampledCovarianceTolerance);
+                Assert.assertEquals(sigma[i][j], sampleSigma[i][j], sampledValueTolerance);
             }
         }
     }



Mime
View raw message