You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ps...@apache.org on 2009/09/05 19:37:05 UTC

svn commit: r811685 [21/24] - in /commons/proper/math/trunk: ./ src/main/java/org/apache/commons/math/ src/main/java/org/apache/commons/math/analysis/ src/main/java/org/apache/commons/math/analysis/integration/ src/main/java/org/apache/commons/math/ana...

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/MinpackTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/MinpackTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/MinpackTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/MinpackTest.java Sat Sep  5 17:36:48 2009
@@ -33,7 +33,7 @@
 /**
  * <p>Some of the unit tests are re-implementations of the MINPACK <a
  * href="http://www.netlib.org/minpack/ex/file17">file17</a> and <a
- * href="http://www.netlib.org/minpack/ex/file22">file22</a> test files. 
+ * href="http://www.netlib.org/minpack/ex/file22">file22</a> test files.
  * The redistribution policy for MINPACK is available <a
  * href="http://www.netlib.org/minpack/disclaimer">here</a>, for
  * convenience, it is reproduced below.</p>
@@ -134,7 +134,7 @@
     minpackTest(new HelicalValleyFunction(new double[] { -100.0, 0.0, 0.0},
                                           991.261822123701), false);
   }
-    
+
   public void testMinpackPowellSingular() {
     minpackTest(new PowellSingularFunction(new double[] { 3.0, -1.0, 0.0, 1.0 },
                                            14.6628782986152), false);
@@ -143,7 +143,7 @@
     minpackTest(new PowellSingularFunction(new double[] { 300.0, -100.0, 0.0, 100.0 },
                                            126887.903284750), false);
   }
-    
+
   public void testMinpackFreudensteinRoth() {
     minpackTest(new FreudensteinRothFunction(new double[] { 0.5, -2.0 },
                                              20.0124960961895, 6.99887517584575,
@@ -164,7 +164,7 @@
                                                -0.89680510749204
                                              }), false);
   }
-    
+
   public void testMinpackBard() {
     minpackTest(new BardFunction(1.0, 6.45613629515967, 0.0906359603390466,
                                  new double[] {
@@ -185,7 +185,7 @@
                                    -164464906.857771
                                  }), false);
   }
-    
+
   public void testMinpackKowalikOsborne() {
     minpackTest(new KowalikOsborneFunction(new double[] { 0.25, 0.39, 0.415, 0.39 },
                                            0.0728915102882945,
@@ -215,7 +215,7 @@
                                              0.134575665392506
                                            }), false);
   }
-    
+
   public void testMinpackMeyer() {
     minpackTest(new MeyerFunction(new double[] { 0.02, 4000.0, 250.0 },
                                   41153.4665543031, 9.37794514651874,
@@ -232,9 +232,9 @@
                                     901.268527953801
                                   }), true);
   }
-    
+
   public void testMinpackWatson() {
-  
+
     minpackTest(new WatsonFunction(6, 0.0,
                                    5.47722557505166, 0.0478295939097601,
                                    new double[] {
@@ -317,12 +317,12 @@
                                    }), false);
 
   }
-    
+
   public void testMinpackBox3Dimensional() {
     minpackTest(new Box3DimensionalFunction(10, new double[] { 0.0, 10.0, 20.0 },
                                             32.1115837449572), false);
   }
-    
+
   public void testMinpackJennrichSampson() {
     minpackTest(new JennrichSampsonFunction(10, new double[] { 0.3, 0.4 },
                                             64.5856498144943, 11.1517793413499,
@@ -354,7 +354,7 @@
                                          -0.403688070279258, 0.236665033746463
                                         }), false);
   }
-    
+
   public void testMinpackChebyquad() {
     minpackTest(new ChebyquadFunction(1, 8, 1.0,
                                       1.88623796907732, 1.88623796907732,
@@ -392,7 +392,7 @@
                                         0.833291216194063,  0.940379732824644
                                       }), false);
   }
-    
+
   public void testMinpackBrownAlmostLinear() {
     minpackTest(new BrownAlmostLinearFunction(10, 0.5,
                                               16.5302162063499, 0.0,
@@ -411,7 +411,7 @@
                                                0.979430303349865, 0.979430303349865,
                                                0.979430303349865, 0.979430303349865,
                                                0.979430303349865, 1.20569696650135
-                                              }), false);  
+                                              }), false);
     minpackTest(new BrownAlmostLinearFunction(10, 50.0,
                                               0.9765625e17, 0.0,
                                               new double[] {
@@ -460,7 +460,7 @@
                                                 0.999999999999121
                                               }), false);
     }
-    
+
   public void testMinpackOsborne1() {
       minpackTest(new Osborne1Function(new double[] { 0.5, 1.5, -1.0, 0.01, 0.02, },
                                        0.937564021037838, 0.00739249260904843,
@@ -470,9 +470,9 @@
                                          0.0221227011813076
                                        }), false);
     }
-    
+
   public void testMinpackOsborne2() {
-      
+
     minpackTest(new Osborne2Function(new double[] {
                                        1.3, 0.65, 0.65, 0.7, 0.6,
                                        3.0, 5.0, 7.0, 2.0, 4.5, 5.5
@@ -512,7 +512,7 @@
 
   private static abstract class MinpackFunction
       implements DifferentiableMultivariateVectorialFunction, Serializable {
- 
+
       private static final long serialVersionUID = -6209760235478794233L;
       protected int      n;
       protected int      m;
@@ -1025,7 +1025,7 @@
       34780.0, 28610.0, 23650.0, 19630.0,
       16370.0, 13720.0, 11540.0,  9744.0,
        8261.0,  7030.0,  6005.0,  5147.0,
-       4427.0,  3820.0,  3307.0,  2872.0                  
+       4427.0,  3820.0,  3307.0,  2872.0
     };
 
   }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizerTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizerTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizerTest.java Sat Sep  5 17:36:48 2009
@@ -40,7 +40,7 @@
 /**
  * <p>Some of the unit tests are re-implementations of the MINPACK <a
  * href="http://www.netlib.org/minpack/ex/file17">file17</a> and <a
- * href="http://www.netlib.org/minpack/ex/file22">file22</a> test files. 
+ * href="http://www.netlib.org/minpack/ex/file22">file22</a> test files.
  * The redistribution policy for MINPACK is available <a
  * href="http://www.netlib.org/minpack/disclaimer">here</a>, for
  * convenience, it is reproduced below.</p>

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/linear/SimplexSolverTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/linear/SimplexSolverTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/linear/SimplexSolverTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/linear/SimplexSolverTest.java Sat Sep  5 17:36:48 2009
@@ -41,7 +41,7 @@
 
         SimplexSolver solver = new SimplexSolver();
         RealPointValuePair solution = solver.optimize(f, constraints, GoalType.MINIMIZE, true);
-        
+
         assertEquals(0.0, solution.getPoint()[0], .0000001);
         assertEquals(1.0, solution.getPoint()[1], .0000001);
         assertEquals(1.0, solution.getPoint()[2], .0000001);
@@ -121,7 +121,7 @@
         assertEquals(10.0, solution.getPoint()[0], 0.0);
         assertEquals(30.0, solution.getValue(), 0.0);
     }
-    
+
     /**
      * With no artificial variables needed (no equals and no greater than
      * constraints) we can go straight to Phase 2.
@@ -227,7 +227,7 @@
       assertEquals(0.0, solution.getPoint()[2], 0.0);
       assertEquals(15.0, solution.getValue(), 0.0);
   }
-    
+
     @Test
     public void testTrivialModel() throws OptimizationException {
         LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 1, 1 }, 0);
@@ -365,7 +365,7 @@
         RealPointValuePair solution = solver.optimize(f, constraints, GoalType.MINIMIZE, true);
         assertEquals(7518.0, solution.getValue(), .0000001);
     }
-    
+
     /**
      * Converts a test string to a {@link LinearConstraint}.
      * Ex: x0 + x1 + x2 + x3 - x12 = 0

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/linear/SimplexTableauTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/linear/SimplexTableauTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/linear/SimplexTableauTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/linear/SimplexTableauTest.java Sat Sep  5 17:36:48 2009
@@ -27,7 +27,7 @@
 
 public class SimplexTableauTest extends TestCase {
 
-    public void testInitialization() {    
+    public void testInitialization() {
         LinearObjectiveFunction f = createFunction();
         Collection<LinearConstraint> constraints = createConstraints();
         SimplexTableau tableau =
@@ -42,7 +42,7 @@
         assertMatrixEquals(expectedInitialTableau, tableau.getData());
     }
 
-    public void testdiscardArtificialVariables() {    
+    public void testdiscardArtificialVariables() {
         LinearObjectiveFunction f = createFunction();
         Collection<LinearConstraint> constraints = createConstraints();
         SimplexTableau tableau =
@@ -62,7 +62,7 @@
         Collection<LinearConstraint> constraints = new ArrayList<LinearConstraint>();
         constraints.add(new LinearConstraint(new double[] {1, 0}, Relationship.LEQ, 2));
         constraints.add(new LinearConstraint(new double[] {0, 1}, Relationship.LEQ, 3));
-        constraints.add(new LinearConstraint(new double[] {1, 1}, Relationship.LEQ, 4));    
+        constraints.add(new LinearConstraint(new double[] {1, 1}, Relationship.LEQ, 4));
         SimplexTableau tableau =
             new SimplexTableau(f, constraints, GoalType.MAXIMIZE, false, 1.0e-6);
         double[][] initialTableau = {

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/univariate/BrentMinimizerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/univariate/BrentMinimizerTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/univariate/BrentMinimizerTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/univariate/BrentMinimizerTest.java Sat Sep  5 17:36:48 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,7 +31,7 @@
 import org.junit.Test;
 
 /**
- * @version $Revision$ $Date$ 
+ * @version $Revision$ $Date$
  */
 public final class BrentMinimizerTest {
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/AbstractRandomGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/AbstractRandomGeneratorTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/AbstractRandomGeneratorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/AbstractRandomGeneratorTest.java Sat Sep  5 17:36:48 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,7 +19,7 @@
 import junit.framework.TestSuite;
 
 import org.apache.commons.math.stat.Frequency;
- 
+
 
 /**
  * Test cases for the AbstractRandomGenerator class
@@ -28,20 +28,20 @@
  */
 
 public class AbstractRandomGeneratorTest extends RandomDataTest {
-    
+
     protected TestRandomGenerator testGenerator = new TestRandomGenerator();
-    
+
     public AbstractRandomGeneratorTest(String name) {
         super(name);
         randomData = new RandomDataImpl(testGenerator);
-    } 
-    
+    }
+
     public static Test suite() {
         TestSuite suite = new TestSuite(AbstractRandomGeneratorTest.class);
         suite.setName("AbstractRandomGenerator Tests");
         return suite;
     }
-    
+
     @Override
     public void testNextInt() {
         try {
@@ -55,26 +55,26 @@
         for (int i=0; i<smallSampleSize; i++) {
             value = testGenerator.nextInt(4);
             assertTrue("nextInt range",(value >= 0) && (value <= 3));
-            freq.addValue(value);  
+            freq.addValue(value);
         }
         long[] observed = new long[4];
         for (int i=0; i<4; i++) {
             observed[i] = freq.getCount(i);
-        } 
-        
+        }
+
         /* Use ChiSquare dist with df = 4-1 = 3, alpha = .001
          * Change to 11.34 for alpha = .01
          */
         assertTrue("chi-square test -- will fail about 1 in 1000 times",
-                testStatistic.chiSquare(expected,observed) < 16.27);    
+                testStatistic.chiSquare(expected,observed) < 16.27);
     }
-    
+
     @Override
     public void testNextLong() {
         long q1 = Long.MAX_VALUE/4;
         long q2 = 2 *  q1;
         long q3 = 3 * q1;
-        
+
         Frequency freq = new Frequency();
         long val = 0;
         int value = 0;
@@ -89,22 +89,22 @@
             } else {
                 value = 3;
             }
-            freq.addValue(value);  
+            freq.addValue(value);
         }
         long[] observed = new long[4];
         for (int i=0; i<4; i++) {
             observed[i] = freq.getCount(i);
-        } 
-        
+        }
+
         /* Use ChiSquare dist with df = 4-1 = 3, alpha = .001
          * Change to 11.34 for alpha = .01
          */
         assertTrue("chi-square test -- will fail about 1 in 1000 times",
-                testStatistic.chiSquare(expected,observed) < 16.27);    
+                testStatistic.chiSquare(expected,observed) < 16.27);
     }
-    
+
     public void testNextBoolean() {
-        long halfSampleSize = smallSampleSize / 2; 
+        long halfSampleSize = smallSampleSize / 2;
         double[] expected = {halfSampleSize, halfSampleSize};
         long[] observed = new long[2];
         for (int i=0; i<smallSampleSize; i++) {
@@ -118,9 +118,9 @@
          * Change to 6.635 for alpha = .01
          */
         assertTrue("chi-square test -- will fail about 1 in 1000 times",
-                testStatistic.chiSquare(expected,observed) < 10.828);    
+                testStatistic.chiSquare(expected,observed) < 10.828);
     }
-    
+
     public void testNextFloat() {
         Frequency freq = new Frequency();
         float val = 0;
@@ -136,17 +136,17 @@
             } else {
                 value = 3;
             }
-            freq.addValue(value);  
+            freq.addValue(value);
         }
         long[] observed = new long[4];
         for (int i=0; i<4; i++) {
             observed[i] = freq.getCount(i);
-        } 
-        
+        }
+
         /* Use ChiSquare dist with df = 4-1 = 3, alpha = .001
          * Change to 11.34 for alpha = .01
          */
         assertTrue("chi-square test -- will fail about 1 in 1000 times",
-                testStatistic.chiSquare(expected,observed) < 16.27);    
+                testStatistic.chiSquare(expected,observed) < 16.27);
     }
 }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/EmpiricalDistributionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/EmpiricalDistributionTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/EmpiricalDistributionTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/EmpiricalDistributionTest.java Sat Sep  5 17:36:48 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -42,9 +42,9 @@
     protected EmpiricalDistribution empiricalDistribution = null;
     protected EmpiricalDistribution empiricalDistribution2 = null;
     protected File file = null;
-    protected URL url = null; 
+    protected URL url = null;
     protected double[] dataArray = null;
-    
+
     public EmpiricalDistributionTest(String name) {
         super(name);
     }
@@ -53,9 +53,9 @@
     public void setUp() throws IOException {
         empiricalDistribution = new EmpiricalDistributionImpl(100);
         url = getClass().getResource("testData.txt");
-        
+
         empiricalDistribution2 = new EmpiricalDistributionImpl(100);
-        BufferedReader in = 
+        BufferedReader in =
                 new BufferedReader(new InputStreamReader(
                         url.openStream()));
         String str = null;
@@ -65,13 +65,13 @@
         }
         in.close();
         in = null;
-        
+
         dataArray = new double[list.size()];
         int i = 0;
         for (Double data : list) {
             dataArray[i] = data.doubleValue();
             i++;
-        }                 
+        }
     }
 
     public static Test suite() {
@@ -81,12 +81,12 @@
     }
 
     /**
-     * Test EmpiricalDistrbution.load() using sample data file.<br> 
-     * Check that the sampleCount, mu and sigma match data in 
+     * Test EmpiricalDistrbution.load() using sample data file.<br>
+     * Check that the sampleCount, mu and sigma match data in
      * the sample data file.
      */
     public void testLoad() throws Exception {
-        empiricalDistribution.load(url);   
+        empiricalDistribution.load(url);
         // testData File has 10000 values, with mean ~ 5.0, std dev ~ 1
         // Make sure that loaded distribution matches this
         assertEquals(empiricalDistribution.getSampleStats().getN(),1000,10E-7);
@@ -101,12 +101,12 @@
 
     /**
      * Test EmpiricalDistrbution.load(double[]) using data taken from
-     * sample data file.<br> 
-     * Check that the sampleCount, mu and sigma match data in 
+     * sample data file.<br>
+     * Check that the sampleCount, mu and sigma match data in
      * the sample data file.
      */
     public void testDoubleLoad() throws Exception {
-        empiricalDistribution2.load(dataArray);   
+        empiricalDistribution2.load(dataArray);
         // testData File has 10000 values, with mean ~ 5.0, std dev ~ 1
         // Make sure that loaded distribution matches this
         assertEquals(empiricalDistribution2.getSampleStats().getN(),1000,10E-7);
@@ -117,14 +117,14 @@
         assertEquals
           (empiricalDistribution2.getSampleStats().getStandardDeviation(),
                 1.0173699343977738,10E-7);
-        
+
         double[] bounds = empiricalDistribution2.getUpperBounds();
         assertEquals(bounds.length, 100);
         assertEquals(bounds[99], 1.0, 10e-12);
-          
+
     }
-   
-    /** 
+
+    /**
       * Generate 1000 random values and make sure they look OK.<br>
       * Note that there is a non-zero (but very small) probability that
       * these tests will fail even if the code is working as designed.
@@ -133,7 +133,7 @@
         tstGen(0.1);
         tstDoubleGen(0.1);
     }
-    
+
     /**
       * Make sure exception thrown if digest getNext is attempted
       * before loading empiricalDistribution.
@@ -149,17 +149,17 @@
             fail("wrong exception caught");
         }
     }
-    
+
     /**
      * Make sure we can handle a grid size that is too fine
      */
     public void testGridTooFine() throws Exception {
         empiricalDistribution = new EmpiricalDistributionImpl(1001);
-        tstGen(0.1);    
-        empiricalDistribution2 = new EmpiricalDistributionImpl(1001);           
+        tstGen(0.1);
+        empiricalDistribution2 = new EmpiricalDistributionImpl(1001);
         tstDoubleGen(0.1);
     }
-    
+
     /**
      * How about too fat?
      */
@@ -167,10 +167,10 @@
         empiricalDistribution = new EmpiricalDistributionImpl(1);
         tstGen(5); // ridiculous tolerance; but ridiculous grid size
                    // really just checking to make sure we do not bomb
-        empiricalDistribution2 = new EmpiricalDistributionImpl(1);           
-        tstDoubleGen(5);           
+        empiricalDistribution2 = new EmpiricalDistributionImpl(1);
+        tstDoubleGen(5);
     }
-    
+
     /**
      * Test bin index overflow problem (BZ 36450)
      */
@@ -178,15 +178,15 @@
         double[] x = new double[] {9474.94326071674, 2080107.8865462579};
         new EmpiricalDistributionImpl().load(x);
     }
-    
+
     public void testSerialization() {
         // Empty
         EmpiricalDistribution dist = new EmpiricalDistributionImpl();
         EmpiricalDistribution dist2 = (EmpiricalDistribution) TestUtils.serializeAndRecover(dist);
         verifySame(dist, dist2);
-        
+
         // Loaded
-        empiricalDistribution2.load(dataArray);   
+        empiricalDistribution2.load(dataArray);
         dist2 = (EmpiricalDistribution) TestUtils.serializeAndRecover(empiricalDistribution2);
         verifySame(empiricalDistribution2, dist2);
     }
@@ -238,9 +238,9 @@
             assertEquals(d1.getBinStats(), d2.getBinStats());
         }
     }
-    
+
     private void tstGen(double tolerance)throws Exception {
-        empiricalDistribution.load(url);   
+        empiricalDistribution.load(url);
         SummaryStatistics stats = new SummaryStatistics();
         for (int i = 1; i < 1000; i++) {
             stats.addValue(empiricalDistribution.getNextValue());
@@ -251,7 +251,7 @@
     }
 
     private void tstDoubleGen(double tolerance)throws Exception {
-        empiricalDistribution2.load(dataArray);   
+        empiricalDistribution2.load(dataArray);
         SummaryStatistics stats = new SummaryStatistics();
         for (int i = 1; i < 1000; i++) {
             stats.addValue(empiricalDistribution2.getNextValue());

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/MersenneTwisterTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/MersenneTwisterTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/MersenneTwisterTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/MersenneTwisterTest.java Sat Sep  5 17:36:48 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -276,7 +276,7 @@
             950049240l, 4173257693l, 1760124957l,  512151405l,  681175196l,  580563018l, 1169662867l, 4015033554l,
             2687781101l,  699691603l, 2673494188l, 1137221356l,  123599888l,  472658308l, 1053598179l, 1012713758l,
             3481064843l, 3759461013l, 3981457956l, 3830587662l, 1877191791l, 3650996736l,  988064871l, 3515461600l,
-            4089077232l, 2225147448l, 1249609188l, 2643151863l, 3896204135l, 2416995901l, 1397735321l, 3460025646l 
+            4089077232l, 2225147448l, 1249609188l, 2643151863l, 3896204135l, 2416995901l, 1397735321l, 3460025646l
         };
         double[] refDouble = {
             0.76275443, 0.99000644, 0.98670464, 0.10143112, 0.27933125, 0.69867227, 0.94218740, 0.03427201,

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/RandomAdaptorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/RandomAdaptorTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/RandomAdaptorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/RandomAdaptorTest.java Sat Sep  5 17:36:48 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,29 +26,29 @@
  */
 
 public class RandomAdaptorTest extends RandomDataTest {
-    
+
     public RandomAdaptorTest(String name) {
         super(name);
-    } 
-    
+    }
+
     public static Test suite() {
         TestSuite suite = new TestSuite(RandomAdaptorTest.class);
         suite.setName("RandomAdaptor Tests");
         return suite;
     }
-    
+
     public void testAdaptor() {
         ConstantGenerator generator = new ConstantGenerator();
         Random random = RandomAdaptor.createAdaptor(generator);
         checkConstant(random);
         RandomAdaptor randomAdaptor = new RandomAdaptor(generator);
-        checkConstant(randomAdaptor); 
+        checkConstant(randomAdaptor);
     }
-    
+
     private void checkConstant(Random random) {
         byte[] bytes = new byte[] {0};
         random.nextBytes(bytes);
-        assertEquals(0, bytes[0]);  
+        assertEquals(0, bytes[0]);
         assertEquals(false, random.nextBoolean());
         assertEquals(0, random.nextDouble(), 0);
         assertEquals(0, random.nextFloat(), 0);
@@ -59,18 +59,18 @@
         random.setSeed(100);
         assertEquals(0, random.nextDouble(), 0);
     }
-    
+
     /*
      * "Constant" generator to test Adaptor delegation.
      * "Powered by Eclipse ;-)"
-     * 
+     *
      */
     private static class ConstantGenerator implements RandomGenerator {
-        
+
         public boolean nextBoolean() {
             return false;
         }
-        
+
         public void nextBytes(byte[] bytes) {
         }
 
@@ -100,7 +100,7 @@
 
         public void setSeed(int seed) {
         }
-        
+
         public void setSeed(int[] seed) {
         }
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/RandomDataTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/RandomDataTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/RandomDataTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/RandomDataTest.java Sat Sep  5 17:36:48 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,7 +27,7 @@
 
 /**
  * Test cases for the RandomData class.
- * 
+ *
  * @version $Revision$ $Date: 2009-04-05 11:55:59 -0500 (Sun, 05 Apr
  *          2009) $
  */
@@ -451,7 +451,7 @@
 
 		/*
 		 * remove this test back soon, since it takes about 4 seconds
-		 * 
+		 *
 		 * try { randomData.setSecureAlgorithm("SHA1PRNG","SUN"); } catch
 		 * (NoSuchProviderException ex) { ; } assertTrue("different seeds",
 		 * !hex.equals(randomData.nextSecureHexString(40))); try {
@@ -459,7 +459,7 @@
 		 * fail("expecting NoSuchAlgorithmException"); } catch
 		 * (NoSuchProviderException ex) { ; } catch (NoSuchAlgorithmException
 		 * ex) { ; }
-		 * 
+		 *
 		 * try { randomData.setSecureAlgorithm("SHA1PRNG","NOSUCHPROVIDER");
 		 * fail("expecting NoSuchProviderException"); } catch
 		 * (NoSuchProviderException ex) { ; }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/TestRandomGenerator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/TestRandomGenerator.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/TestRandomGenerator.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/TestRandomGenerator.java Sat Sep  5 17:36:48 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
 import java.util.Random;
 
 /**
- * Dummy AbstractRandomGenerator concrete subclass that just wraps a 
+ * Dummy AbstractRandomGenerator concrete subclass that just wraps a
  * java.util.Random instance.  Used by AbstractRandomGeneratorTest to test
  * default implementations in AbstractRandomGenerator.
  *

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/UniformRandomGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/UniformRandomGeneratorTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/UniformRandomGeneratorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/UniformRandomGeneratorTest.java Sat Sep  5 17:36:48 2009
@@ -39,8 +39,8 @@
         assertEquals(0.0, StatUtils.mean(sample), 0.07);
         assertEquals(1.0, StatUtils.variance(sample), 0.02);
     }
-    
-    
+
+
     public static Test suite() {
         return new TestSuite(UniformRandomGeneratorTest.class);
     }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/ValueServerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/ValueServerTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/ValueServerTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/ValueServerTest.java Sat Sep  5 17:36:48 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,7 +24,7 @@
 
 import org.apache.commons.math.RetryTestCase;
 import org.apache.commons.math.stat.descriptive.SummaryStatistics;
- 
+
 /**
  * Test cases for the ValueServer class.
  *
@@ -34,7 +34,7 @@
 public final class ValueServerTest extends RetryTestCase {
 
     private ValueServer vs = new ValueServer();
-    
+
     public ValueServerTest(String name) {
         super(name);
     }
@@ -44,7 +44,7 @@
         vs.setMode(ValueServer.DIGEST_MODE);
         try {
             URL url = getClass().getResource("testData.txt");
-            vs.setValuesFileURL(url); 
+            vs.setValuesFileURL(url);
         } catch (Exception ex) {
             fail("malformed test URL");
         }
@@ -56,8 +56,8 @@
         return suite;
     }
 
-   
-    /** 
+
+    /**
       * Generate 1000 random values and make sure they look OK.<br>
       * Note that there is a non-zero (but very small) probability that
       * these tests will fail even if the code is working as designed.
@@ -66,31 +66,31 @@
         double next = 0.0;
         double tolerance = 0.1;
         vs.computeDistribution();
-        assertTrue("empirical distribution property", 
+        assertTrue("empirical distribution property",
             vs.getEmpiricalDistribution() != null);
         SummaryStatistics stats = new SummaryStatistics();
         for (int i = 1; i < 1000; i++) {
             next = vs.getNext();
             stats.addValue(next);
-        }    
+        }
         assertEquals("mean", 5.069831575018909, stats.getMean(), tolerance);
         assertEquals
-         ("std dev", 1.0173699343977738, stats.getStandardDeviation(), 
+         ("std dev", 1.0173699343977738, stats.getStandardDeviation(),
             tolerance);
-        
+
         vs.computeDistribution(500);
         stats = new SummaryStatistics();
         for (int i = 1; i < 1000; i++) {
             next = vs.getNext();
             stats.addValue(next);
-        }    
+        }
         assertEquals("mean", 5.069831575018909, stats.getMean(), tolerance);
         assertEquals
-         ("std dev", 1.0173699343977738, stats.getStandardDeviation(), 
+         ("std dev", 1.0173699343977738, stats.getStandardDeviation(),
             tolerance);
-        
+
     }
-    
+
     /**
       * Make sure exception thrown if digest getNext is attempted
       * before loading empiricalDistribution.
@@ -131,7 +131,7 @@
     }
 
     /**
-     * Test ValueServer REPLAY_MODE using values in testData file.<br> 
+     * Test ValueServer REPLAY_MODE using values in testData file.<br>
      * Check that the values 1,2,1001,1002 match data file values 1 and 2.
      * the sample data file.
      */
@@ -157,8 +157,8 @@
         // make sure no NPE
         vs.closeReplayFile();
     }
-    
-    /** 
+
+    /**
      * Test other ValueServer modes
      */
     public void testModes() throws Exception {
@@ -185,7 +185,7 @@
             // ignored
         }
     }
-    
+
     /**
      * Test fill
      */
@@ -202,7 +202,7 @@
             assertEquals("fill test in place",2,v2[i],Double.MIN_VALUE);
         }
     }
-    
+
     /**
      * Test getters to make Clover happy
      */
@@ -213,5 +213,5 @@
         URL url = vs.getValuesFileURL();
         assertEquals("valuesFileURL test","http://www.apache.org",url.toString());
     }
-                          
+
 }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/special/BetaTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/special/BetaTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/special/BetaTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/special/BetaTest.java Sat Sep  5 17:36:48 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -60,60 +60,60 @@
     public void testRegularizedBetaPositivePositiveNan() {
         testRegularizedBeta(Double.NaN, 0.5, 1.0, Double.NaN);
     }
-    
+
     public void testRegularizedBetaNegativePositivePositive() {
         testRegularizedBeta(Double.NaN, -0.5, 1.0, 2.0);
     }
-    
+
     public void testRegularizedBetaPositiveNegativePositive() {
         testRegularizedBeta(Double.NaN, 0.5, -1.0, 2.0);
     }
-    
+
     public void testRegularizedBetaPositivePositiveNegative() {
         testRegularizedBeta(Double.NaN, 0.5, 1.0, -2.0);
     }
-    
+
     public void testRegularizedBetaZeroPositivePositive() {
         testRegularizedBeta(0.0, 0.0, 1.0, 2.0);
     }
-    
+
     public void testRegularizedBetaPositiveZeroPositive() {
         testRegularizedBeta(Double.NaN, 0.5, 0.0, 2.0);
     }
-    
+
     public void testRegularizedBetaPositivePositiveZero() {
         testRegularizedBeta(Double.NaN, 0.5, 1.0, 0.0);
     }
-    
+
     public void testRegularizedBetaPositivePositivePositive() {
         testRegularizedBeta(0.75, 0.5, 1.0, 2.0);
     }
-    
+
     public void testLogBetaNanPositive() {
         testLogBeta(Double.NaN, Double.NaN, 2.0);
     }
-    
+
     public void testLogBetaPositiveNan() {
         testLogBeta(Double.NaN, 1.0, Double.NaN);
     }
-    
+
     public void testLogBetaNegativePositive() {
         testLogBeta(Double.NaN, -1.0, 2.0);
     }
-    
+
     public void testLogBetaPositiveNegative() {
         testLogBeta(Double.NaN, 1.0, -2.0);
     }
-    
+
     public void testLogBetaZeroPositive() {
         testLogBeta(Double.NaN, 0.0, 2.0);
     }
-    
+
     public void testLogBetaPositiveZero() {
         testLogBeta(Double.NaN, 1.0, 0.0);
     }
-    
+
     public void testLogBetaPositivePositive() {
         testLogBeta(-0.693147180559945, 1.0, 2.0);
     }
-}
\ No newline at end of file
+}

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/special/ErfTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/special/ErfTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/special/ErfTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/special/ErfTest.java Sat Sep  5 17:36:48 2009
@@ -48,7 +48,7 @@
         double actual = Erf.erf(x);
         double expected = 0.99;
         assertEquals(expected, actual, 1.0e-5);
-    
+
         actual = Erf.erf(-x);
         expected = -expected;
         assertEquals(expected, actual, 1.0e-5);
@@ -59,7 +59,7 @@
         double actual = Erf.erf(x);
         double expected = 0.995;
         assertEquals(expected, actual, 1.0e-5);
-        
+
         actual = Erf.erf(-x);
         expected = -expected;
         assertEquals(expected, actual, 1.0e-5);
@@ -70,7 +70,7 @@
         double actual = Erf.erf(x);
         double expected = 0.999;
         assertEquals(expected, actual, 1.0e-5);
-        
+
         actual = Erf.erf(-x);
         expected = -expected;
         assertEquals(expected, actual, 1.0e-5);

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/special/GammaTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/special/GammaTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/special/GammaTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/special/GammaTest.java Sat Sep  5 17:36:48 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,7 +25,7 @@
  * @version $Revision$ $Date$
  */
 public class GammaTest extends TestCase {
-     
+
     public GammaTest(String name) {
         super(name);
     }
@@ -53,39 +53,39 @@
     public void testRegularizedGammaPositiveNan() {
         testRegularizedGamma(Double.NaN, 1.0, Double.NaN);
     }
-    
+
     public void testRegularizedGammaNegativePositive() {
         testRegularizedGamma(Double.NaN, -1.5, 1.0);
     }
-    
+
     public void testRegularizedGammaPositiveNegative() {
         testRegularizedGamma(Double.NaN, 1.0, -1.0);
     }
-    
+
     public void testRegularizedGammaZeroPositive() {
         testRegularizedGamma(Double.NaN, 0.0, 1.0);
     }
-    
+
     public void testRegularizedGammaPositiveZero() {
         testRegularizedGamma(0.0, 1.0, 0.0);
     }
-    
+
     public void testRegularizedGammaPositivePositive() {
         testRegularizedGamma(0.632120558828558, 1.0, 1.0);
     }
-    
+
     public void testLogGammaNan() {
         testLogGamma(Double.NaN, Double.NaN);
     }
-    
+
     public void testLogGammaNegative() {
         testLogGamma(Double.NaN, -1.0);
     }
-    
+
     public void testLogGammaZero() {
         testLogGamma(Double.NaN, 0.0);
     }
-    
+
     public void testLogGammaPositive() {
         testLogGamma(0.6931471805599457, 3.0);
     }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/CertifiedDataTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/CertifiedDataTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/CertifiedDataTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/CertifiedDataTest.java Sat Sep  5 17:36:48 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -61,20 +61,20 @@
         SummaryStatistics u = new SummaryStatistics();
         loadStats("data/PiDigits.txt", u);
         assertEquals("PiDigits: std", std, u.getStandardDeviation(), 1E-13);
-        assertEquals("PiDigits: mean", mean, u.getMean(), 1E-13);  
+        assertEquals("PiDigits: mean", mean, u.getMean(), 1E-13);
 
         loadStats("data/Mavro.txt", u);
         assertEquals("Mavro: std", std, u.getStandardDeviation(), 1E-14);
         assertEquals("Mavro: mean", mean, u.getMean(), 1E-14);
-        
+
         loadStats("data/Michelso.txt", u);
         assertEquals("Michelso: std", std, u.getStandardDeviation(), 1E-13);
-        assertEquals("Michelso: mean", mean, u.getMean(), 1E-13);   
-                                        
+        assertEquals("Michelso: mean", mean, u.getMean(), 1E-13);
+
         loadStats("data/NumAcc1.txt", u);
         assertEquals("NumAcc1: std", std, u.getStandardDeviation(), 1E-14);
         assertEquals("NumAcc1: mean", mean, u.getMean(), 1E-14);
-        
+
         loadStats("data/NumAcc2.txt", u);
         assertEquals("NumAcc2: std", std, u.getStandardDeviation(), 1E-14);
         assertEquals("NumAcc2: mean", mean, u.getMean(), 1E-14);
@@ -87,23 +87,23 @@
     public void testDescriptiveStatistics() throws Exception {
 
         DescriptiveStatistics u = new DescriptiveStatistics();
-        
+
         loadStats("data/PiDigits.txt", u);
         assertEquals("PiDigits: std", std, u.getStandardDeviation(), 1E-14);
         assertEquals("PiDigits: mean", mean, u.getMean(), 1E-14);
-        
+
         loadStats("data/Mavro.txt", u);
         assertEquals("Mavro: std", std, u.getStandardDeviation(), 1E-14);
-        assertEquals("Mavro: mean", mean, u.getMean(), 1E-14);        
-        
+        assertEquals("Mavro: mean", mean, u.getMean(), 1E-14);
+
         loadStats("data/Michelso.txt", u);
         assertEquals("Michelso: std", std, u.getStandardDeviation(), 1E-14);
-        assertEquals("Michelso: mean", mean, u.getMean(), 1E-14);   
+        assertEquals("Michelso: mean", mean, u.getMean(), 1E-14);
 
         loadStats("data/NumAcc1.txt", u);
         assertEquals("NumAcc1: std", std, u.getStandardDeviation(), 1E-14);
         assertEquals("NumAcc1: mean", mean, u.getMean(), 1E-14);
-        
+
         loadStats("data/NumAcc2.txt", u);
         assertEquals("NumAcc2: std", std, u.getStandardDeviation(), 1E-14);
         assertEquals("NumAcc2: mean", mean, u.getMean(), 1E-14);
@@ -115,7 +115,7 @@
      * @param statistical summary
      */
     private void loadStats(String resource, Object u) throws Exception {
-        
+
         DescriptiveStatistics d = null;
         SummaryStatistics s = null;
         if (u instanceof DescriptiveStatistics) {
@@ -127,14 +127,14 @@
                 "clear", new Class[]{}).invoke(u, new Object[]{});
         mean = Double.NaN;
         std = Double.NaN;
-        
+
         BufferedReader in =
             new BufferedReader(
                     new InputStreamReader(
                             CertifiedDataTest.class.getResourceAsStream(resource)));
-        
+
         String line = null;
-        
+
         for (int j = 0; j < 60; j++) {
             line = in.readLine();
             if (j == 40) {
@@ -148,9 +148,9 @@
                             line.substring(line.lastIndexOf(":") + 1).trim());
             }
         }
-        
+
         line = in.readLine();
-        
+
         while (line != null) {
             if (d != null) {
                 d.addValue(Double.parseDouble(line.trim()));
@@ -159,7 +159,7 @@
             }
             line = in.readLine();
         }
-        
+
         in.close();
     }
 }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/FrequencyTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/FrequencyTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/FrequencyTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/FrequencyTest.java Sat Sep  5 17:36:48 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -42,22 +42,22 @@
     private int threeI=3;
     private double tolerance = 10E-15;
     private Frequency f = null;
-    
+
     public FrequencyTest(String name) {
         super(name);
     }
 
     @Override
-    public void setUp() {  
+    public void setUp() {
         f = new Frequency();
     }
-    
+
     public static Test suite() {
         TestSuite suite = new TestSuite(FrequencyTest.class);
         suite.setName("Frequency Tests");
         return suite;
     }
-    
+
     /** test freq counts */
     public void testCounts() {
         assertEquals("total count",0,f.getSumFreq());
@@ -75,10 +75,10 @@
         assertEquals("Integer argument cum freq",4, f.getCumFreq(Integer.valueOf(2)));
         assertEquals("five cumulative frequency", 4,  f.getCumFreq(5));
         assertEquals("foo cumulative frequency", 0,  f.getCumFreq("foo"));
-        
+
         f.clear();
         assertEquals("total count",0,f.getSumFreq());
-        
+
         // userguide examples -------------------------------------------------------------------
         f.addValue("one");
         f.addValue("One");
@@ -89,7 +89,7 @@
         assertEquals("z cumulative pct", 1.0,  f.getCumPct("z"), tolerance);
         assertEquals("Ot cumulative pct", 0.25,  f.getCumPct("Ot"), tolerance);
         f.clear();
-        
+
         f = null;
         Frequency f = new Frequency();
         f.addValue(1);
@@ -102,8 +102,8 @@
         assertEquals("0 cum pct", 0.2, f.getCumPct(0), tolerance);
         assertEquals("1 pct", 0.6, f.getPct(Integer.valueOf(1)), tolerance);
         assertEquals("-2 cum pct", 0, f.getCumPct(-2), tolerance);
-        assertEquals("10 cum pct", 1, f.getCumPct(10), tolerance);   
-        
+        assertEquals("10 cum pct", 1, f.getCumPct(10), tolerance);
+
         f = null;
         f = new Frequency(String.CASE_INSENSITIVE_ORDER);
         f.addValue("one");
@@ -129,8 +129,8 @@
         assertEquals(0.25, f.getPct('a'), 0.0);
         assertEquals(0.5, f.getCumPct('b'), 0.0);
         assertEquals(1.0, f.getCumPct('e'), 0.0);
-    }     
-    
+    }
+
     /** test pcts */
     public void testPcts() {
         f.addValue(oneL);
@@ -154,7 +154,7 @@
         assertEquals("zero cum pct",0.0,f.getCumPct(0),tolerance);
         assertEquals("foo cum pct",0,f.getCumPct("foo"),tolerance);
     }
-    
+
     /** test adding incomparable values */
     public void testAdd() {
         char aChar = 'a';
@@ -163,7 +163,7 @@
         f.addValue(aChar);
         f.addValue(bChar);
         try {
-            f.addValue(aString);    
+            f.addValue(aString);
             fail("Expecting IllegalArgumentException");
         } catch (IllegalArgumentException ex) {
             // expected
@@ -178,17 +178,17 @@
         assertEquals("b cum pct",1.0,f.getCumPct(bChar),tolerance);
         assertEquals("a string pct",0.0,f.getPct(aString),tolerance);
         assertEquals("a string cum pct",0.0,f.getCumPct(aString),tolerance);
-        
+
         f = new Frequency();
         f.addValue("One");
         try {
-            f.addValue(new Integer("One")); 
+            f.addValue(new Integer("One"));
             fail("Expecting IllegalArgumentException");
         } catch (IllegalArgumentException ex) {
             // expected
         }
     }
-    
+
     // Check what happens when non-Comparable objects are added
     @SuppressWarnings("deprecation")
     public void testAddNonComparable(){
@@ -216,18 +216,18 @@
         assertTrue("pct, empty table", Double.isNaN(f.getPct(0)));
         assertTrue("pct, empty table", Double.isNaN(f.getPct(Integer.valueOf(0))));
         assertTrue("cum pct, empty table", Double.isNaN(f.getCumPct(0)));
-        assertTrue("cum pct, empty table", Double.isNaN(f.getCumPct(Integer.valueOf(0))));   
+        assertTrue("cum pct, empty table", Double.isNaN(f.getCumPct(Integer.valueOf(0))));
     }
-    
+
     /**
-     * Tests toString() 
+     * Tests toString()
      */
     public void testToString(){
         f.addValue(oneL);
         f.addValue(twoL);
         f.addValue(oneI);
         f.addValue(twoI);
-        
+
         String s = f.toString();
         //System.out.println(s);
         assertNotNull(s);
@@ -235,10 +235,10 @@
         try {
             String line = reader.readLine(); // header line
             assertNotNull(line);
-            
+
             line = reader.readLine(); // one's or two's line
             assertNotNull(line);
-                        
+
             line = reader.readLine(); // one's or two's line
             assertNotNull(line);
 
@@ -246,7 +246,7 @@
             assertNull(line);
         } catch(IOException ex){
             fail(ex.getMessage());
-        }        
+        }
     }
     public void testIntegerValues() {
         Comparable<?> obj1 = null;
@@ -265,9 +265,9 @@
         Iterator<?> it = f.valuesIterator();
         while (it.hasNext()) {
             assertTrue(it.next() instanceof Long);
-        }     
+        }
     }
-    
+
     public void testSerial() {
         f.addValue(oneL);
         f.addValue(twoL);

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/StatUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/StatUtilsTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/StatUtilsTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/StatUtilsTest.java Sat Sep  5 17:36:48 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -117,10 +117,10 @@
         }
 
     }
-    
+
     public void testSumSq() {
         double[] x = null;
-        
+
         // test null
         try {
             StatUtils.sumSq(x);
@@ -128,33 +128,33 @@
         } catch (IllegalArgumentException ex) {
             // success
         }
-        
+
         try {
             StatUtils.sumSq(x, 0, 4);
             fail("null is not a valid data array.");
         } catch (IllegalArgumentException ex) {
             // success
         }
-        
+
         // test empty
         x = new double[] {};
         TestUtils.assertEquals(Double.NaN, StatUtils.sumSq(x), tolerance);
         TestUtils.assertEquals(Double.NaN, StatUtils.sumSq(x, 0, 0), tolerance);
-        
+
         // test one
         x = new double[] {two};
         TestUtils.assertEquals(4, StatUtils.sumSq(x), tolerance);
         TestUtils.assertEquals(4, StatUtils.sumSq(x, 0, 1), tolerance);
-        
+
         // test many
         x = new double[] {one, two, two, three};
         TestUtils.assertEquals(18, StatUtils.sumSq(x), tolerance);
         TestUtils.assertEquals(8, StatUtils.sumSq(x, 1, 2), tolerance);
     }
-    
+
     public void testProduct() {
         double[] x = null;
-        
+
         // test null
         try {
             StatUtils.product(x);
@@ -162,33 +162,33 @@
         } catch (IllegalArgumentException ex) {
             // success
         }
-        
+
         try {
             StatUtils.product(x, 0, 4);
             fail("null is not a valid data array.");
         } catch (IllegalArgumentException ex) {
             // success
         }
-        
+
         // test empty
         x = new double[] {};
         TestUtils.assertEquals(Double.NaN, StatUtils.product(x), tolerance);
         TestUtils.assertEquals(Double.NaN, StatUtils.product(x, 0, 0), tolerance);
-        
+
         // test one
         x = new double[] {two};
         TestUtils.assertEquals(two, StatUtils.product(x), tolerance);
         TestUtils.assertEquals(two, StatUtils.product(x, 0, 1), tolerance);
-        
+
         // test many
         x = new double[] {one, two, two, three};
         TestUtils.assertEquals(12, StatUtils.product(x), tolerance);
         TestUtils.assertEquals(4, StatUtils.product(x, 1, 2), tolerance);
     }
-    
+
     public void testSumLog() {
         double[] x = null;
-        
+
         // test null
         try {
             StatUtils.sumLog(x);
@@ -196,98 +196,98 @@
         } catch (IllegalArgumentException ex) {
             // success
         }
-        
+
         try {
             StatUtils.sumLog(x, 0, 4);
             fail("null is not a valid data array.");
         } catch (IllegalArgumentException ex) {
             // success
         }
-        
+
         // test empty
         x = new double[] {};
         TestUtils.assertEquals(Double.NaN, StatUtils.sumLog(x), tolerance);
         TestUtils.assertEquals(Double.NaN, StatUtils.sumLog(x, 0, 0), tolerance);
-        
+
         // test one
         x = new double[] {two};
         TestUtils.assertEquals(Math.log(two), StatUtils.sumLog(x), tolerance);
         TestUtils.assertEquals(Math.log(two), StatUtils.sumLog(x, 0, 1), tolerance);
-        
+
         // test many
         x = new double[] {one, two, two, three};
         TestUtils.assertEquals(Math.log(one) + 2.0 * Math.log(two) + Math.log(three), StatUtils.sumLog(x), tolerance);
         TestUtils.assertEquals(2.0 * Math.log(two), StatUtils.sumLog(x, 1, 2), tolerance);
     }
-    
+
     public void testMean() {
         double[] x = null;
-        
+
         try {
             StatUtils.mean(x, 0, 4);
             fail("null is not a valid data array.");
         } catch (IllegalArgumentException ex) {
             // success
         }
-        
+
         // test empty
         x = new double[] {};
         TestUtils.assertEquals(Double.NaN, StatUtils.mean(x, 0, 0), tolerance);
-        
+
         // test one
         x = new double[] {two};
         TestUtils.assertEquals(two, StatUtils.mean(x, 0, 1), tolerance);
-        
+
         // test many
         x = new double[] {one, two, two, three};
         TestUtils.assertEquals(2.5, StatUtils.mean(x, 2, 2), tolerance);
     }
-    
+
     public void testVariance() {
         double[] x = null;
-        
+
         try {
             StatUtils.variance(x, 0, 4);
             fail("null is not a valid data array.");
         } catch (IllegalArgumentException ex) {
             // success
         }
-        
+
         // test empty
         x = new double[] {};
         TestUtils.assertEquals(Double.NaN, StatUtils.variance(x, 0, 0), tolerance);
-        
+
         // test one
         x = new double[] {two};
         TestUtils.assertEquals(0.0, StatUtils.variance(x, 0, 1), tolerance);
-        
+
         // test many
         x = new double[] {one, two, two, three};
         TestUtils.assertEquals(0.5, StatUtils.variance(x, 2, 2), tolerance);
-        
+
         // test precomputed mean
         x = new double[] {one, two, two, three};
         TestUtils.assertEquals(0.5, StatUtils.variance(x,2.5, 2, 2), tolerance);
     }
-    
+
     public void testMax() {
         double[] x = null;
-        
+
         try {
             StatUtils.max(x, 0, 4);
             fail("null is not a valid data array.");
         } catch (IllegalArgumentException ex) {
             // success
         }
-        
+
         // test empty
         x = new double[] {};
         TestUtils.assertEquals(Double.NaN, StatUtils.max(x, 0, 0), tolerance);
-        
+
         // test one
         x = new double[] {two};
         TestUtils.assertEquals(two, StatUtils.max(x, 0, 1), tolerance);
-        
+
         // test many
         x = new double[] {one, two, two, three};
         TestUtils.assertEquals(three, StatUtils.max(x, 1, 3), tolerance);
@@ -299,7 +299,7 @@
         // test middle nan is ignored
         x = new double[] {one, nan, three};
         TestUtils.assertEquals(three, StatUtils.max(x), tolerance);
-        
+
         // test last nan is ignored
         x = new double[] {one, two, nan};
         TestUtils.assertEquals(two, StatUtils.max(x), tolerance);
@@ -308,25 +308,25 @@
         x = new double[] {nan, nan, nan};
         TestUtils.assertEquals(nan, StatUtils.max(x), tolerance);
     }
-    
+
     public void testMin() {
         double[] x = null;
-        
+
         try {
             StatUtils.min(x, 0, 4);
             fail("null is not a valid data array.");
         } catch (IllegalArgumentException ex) {
             // success
         }
-        
+
         // test empty
         x = new double[] {};
         TestUtils.assertEquals(Double.NaN, StatUtils.min(x, 0, 0), tolerance);
-        
+
         // test one
         x = new double[] {two};
         TestUtils.assertEquals(two, StatUtils.min(x, 0, 1), tolerance);
-        
+
         // test many
         x = new double[] {one, two, two, three};
         TestUtils.assertEquals(two, StatUtils.min(x, 1, 3), tolerance);
@@ -338,7 +338,7 @@
         // test middle nan is ignored
         x = new double[] {one, nan, three};
         TestUtils.assertEquals(one, StatUtils.min(x), tolerance);
-        
+
         // test last nan is ignored
         x = new double[] {one, two, nan};
         TestUtils.assertEquals(one, StatUtils.min(x), tolerance);
@@ -347,10 +347,10 @@
         x = new double[] {nan, nan, nan};
         TestUtils.assertEquals(nan, StatUtils.min(x), tolerance);
     }
-    
+
     public void testPercentile() {
         double[] x = null;
-        
+
         // test null
         try {
             StatUtils.percentile(x, .25);
@@ -358,30 +358,30 @@
         } catch (IllegalArgumentException ex) {
             // success
         }
-        
+
         try {
             StatUtils.percentile(x, 0, 4, 0.25);
             fail("null is not a valid data array.");
         } catch (IllegalArgumentException ex) {
             // success
         }
-        
+
         // test empty
         x = new double[] {};
         TestUtils.assertEquals(Double.NaN, StatUtils.percentile(x, 25), tolerance);
         TestUtils.assertEquals(Double.NaN, StatUtils.percentile(x, 0, 0, 25), tolerance);
-        
+
         // test one
         x = new double[] {two};
         TestUtils.assertEquals(two, StatUtils.percentile(x, 25), tolerance);
         TestUtils.assertEquals(two, StatUtils.percentile(x, 0, 1, 25), tolerance);
-        
+
         // test many
         x = new double[] {one, two, two, three};
         TestUtils.assertEquals(2.5, StatUtils.percentile(x, 70), tolerance);
         TestUtils.assertEquals(2.5, StatUtils.percentile(x, 1, 3, 62.5), tolerance);
     }
-    
+
     public void testDifferenceStats() throws Exception {
         double sample1[] = {1d, 2d, 3d, 4d};
         double sample2[] = {1d, 3d, 4d, 2d};
@@ -390,7 +390,7 @@
         double meanDifference = StatUtils.meanDifference(sample1, sample2);
         assertEquals(StatUtils.sumDifference(sample1, sample2), StatUtils.sum(diff), tolerance);
         assertEquals(meanDifference, StatUtils.mean(diff), tolerance);
-        assertEquals(StatUtils.varianceDifference(sample1, sample2, meanDifference), 
+        assertEquals(StatUtils.varianceDifference(sample1, sample2, meanDifference),
                 StatUtils.variance(diff), tolerance);
         try {
             StatUtils.meanDifference(sample1, small);
@@ -412,7 +412,7 @@
             // expected
         }
     }
-    
+
     public void testGeometricMean() throws Exception {
         double[] test = null;
         try {
@@ -422,9 +422,9 @@
             // expected
         }
         test = new double[] {2, 4, 6, 8};
-        assertEquals(Math.exp(0.25d * StatUtils.sumLog(test)), 
+        assertEquals(Math.exp(0.25d * StatUtils.sumLog(test)),
                 StatUtils.geometricMean(test), Double.MIN_VALUE);
-        assertEquals(Math.exp(0.5 * StatUtils.sumLog(test, 0, 2)), 
+        assertEquals(Math.exp(0.5 * StatUtils.sumLog(test, 0, 2)),
                 StatUtils.geometricMean(test, 0, 2), Double.MIN_VALUE);
     }
-}
\ No newline at end of file
+}

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/clustering/EuclideanIntegerPointTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/clustering/EuclideanIntegerPointTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/clustering/EuclideanIntegerPointTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/clustering/EuclideanIntegerPointTest.java Sat Sep  5 17:36:48 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,7 +33,7 @@
         int[] array = { -3, -2, -1, 0, 1 };
         assertTrue(array == new EuclideanIntegerPoint(array).getPoint());
     }
-    
+
     @Test
     public void testDistance() {
         EuclideanIntegerPoint e1 = new EuclideanIntegerPoint(new int[] { -3, -2, -1, 0, 1 });
@@ -42,7 +42,7 @@
         assertEquals(0.0, e1.distanceFrom(e1), 1.0e-15);
         assertEquals(0.0, e2.distanceFrom(e2), 1.0e-15);
     }
-    
+
     @Test
     public void testCentroid() {
         List<EuclideanIntegerPoint> list = new ArrayList<EuclideanIntegerPoint>();
@@ -54,11 +54,11 @@
         assertEquals(2, c.getPoint()[0]);
         assertEquals(3, c.getPoint()[1]);
     }
-    
+
     @Test
     public void testSerial() {
         EuclideanIntegerPoint p = new EuclideanIntegerPoint(new int[] { -3, -2, -1, 0, 1 });
         assertEquals(p, TestUtils.serializeAndRecover(p));
     }
-    
+
 }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/correlation/CovarianceTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/correlation/CovarianceTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/correlation/CovarianceTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/correlation/CovarianceTest.java Sat Sep  5 17:36:48 2009
@@ -24,7 +24,7 @@
 import junit.framework.TestCase;
 
 public class CovarianceTest extends TestCase {
-    
+
     protected final double[] longleyData = new double[] {
             60323,83.0,234289,2356,1590,107608,1947,
             61122,88.5,259426,2325,1456,108632,1948,
@@ -43,7 +43,7 @@
             69331,115.7,518173,4806,2572,127852,1961,
             70551,116.9,554894,4007,2827,130081,1962
         };
-    
+
     protected final double[] swissData = new double[] {
             80.2,17.0,15,12,9.96,
             83.1,45.1,6,9,84.84,
@@ -93,19 +93,19 @@
             44.7,46.6,16,29,50.43,
             42.8,27.7,22,29,58.33
         };
- 
-    
+
+
     /**
      * Test Longley dataset against R.
      * Data Source: J. Longley (1967) "An Appraisal of Least Squares
      * Programs for the Electronic Computer from the Point of View of the User"
      * Journal of the American Statistical Association, vol. 62. September,
      * pp. 819-841.
-     * 
+     *
      * Data are from NIST:
      * http://www.itl.nist.gov/div898/strd/lls/data/LINKS/DATA/Longley.dat
      */
-    public void testLongly() {  
+    public void testLongly() {
         RealMatrix matrix = createRealMatrix(longleyData, 16, 7);
         RealMatrix covarianceMatrix = new Covariance(matrix).getCovarianceMatrix();
         double[] rData = new double[] {
@@ -124,11 +124,11 @@
          16240.93333333333, 5.092333333333334e+01, 470977.900000000,
          2973.033333333333, 1382.433333333333, 32917.40000000, 22.66666666666667
         };
-        
+
         TestUtils.assertEquals("covariance matrix", createRealMatrix(rData, 7, 7), covarianceMatrix, 10E-9);
 
     }
-    
+
     /**
      * Test R Swiss fertility dataset against R.
      * Data Source: R datasets package
@@ -143,10 +143,10 @@
            -79.7295097132285, -139.6574005550416, 53.57585568917669, 92.4560592044403, -61.6988297872340,
             241.5632030527289, 379.9043755781684, -190.56061054579092, -61.6988297872340, 1739.2945371877890
          };
-         
+
          TestUtils.assertEquals("covariance matrix", createRealMatrix(rData, 5, 5), covarianceMatrix, 10E-13);
     }
-    
+
     /**
      * Constant column
      */
@@ -156,8 +156,8 @@
         assertEquals(0d, new Covariance().covariance(noVariance, values, true), Double.MIN_VALUE);
         assertEquals(0d, new Covariance().covariance(noVariance, noVariance, true), Double.MIN_VALUE);
     }
-    
-    
+
+
     /**
      * Insufficient data
      */
@@ -178,7 +178,7 @@
             // Expected
         }
     }
-    
+
     /**
      * Verify that diagonal entries are consistent with Variance computation and matrix matches
      * column-by-column covariances
@@ -186,18 +186,18 @@
     public void testConsistency() {
         final RealMatrix matrix = createRealMatrix(swissData, 47, 5);
         final RealMatrix covarianceMatrix = new Covariance(matrix).getCovarianceMatrix();
-        
+
         // Variances on the diagonal
         Variance variance = new Variance();
         for (int i = 0; i < 5; i++) {
             assertEquals(variance.evaluate(matrix.getColumn(i)), covarianceMatrix.getEntry(i,i), 10E-14);
         }
-        
+
         // Symmetry, column-consistency
-        assertEquals(covarianceMatrix.getEntry(2, 3), 
+        assertEquals(covarianceMatrix.getEntry(2, 3),
                 new Covariance().covariance(matrix.getColumn(2), matrix.getColumn(3), true), 10E-14);
         assertEquals(covarianceMatrix.getEntry(2, 3), covarianceMatrix.getEntry(3, 2), Double.MIN_VALUE);
-        
+
         // All columns same -> all entries = column variance
         RealMatrix repeatedColumns = new Array2DRowRealMatrix(47, 3);
         for (int i = 0; i < 3; i++) {
@@ -210,20 +210,20 @@
                 assertEquals(columnVariance, repeatedCovarianceMatrix.getEntry(i, j), 10E-14);
             }
         }
-        
+
         // Check bias-correction defaults
         double[][] data = matrix.getData();
-        TestUtils.assertEquals("Covariances", 
+        TestUtils.assertEquals("Covariances",
                 covarianceMatrix, new Covariance().computeCovarianceMatrix(data),Double.MIN_VALUE);
-        TestUtils.assertEquals("Covariances", 
+        TestUtils.assertEquals("Covariances",
                 covarianceMatrix, new Covariance().computeCovarianceMatrix(data, true),Double.MIN_VALUE);
-        
+
         double[] x = data[0];
         double[] y = data[1];
-        assertEquals(new Covariance().covariance(x, y), 
-                new Covariance().covariance(x, y, true), Double.MIN_VALUE); 
+        assertEquals(new Covariance().covariance(x, y),
+                new Covariance().covariance(x, y, true), Double.MIN_VALUE);
     }
-    
+
     protected RealMatrix createRealMatrix(double[] data, int nRows, int nCols) {
         double[][] matrixData = new double[nRows][nCols];
         int ptr = 0;
@@ -231,6 +231,6 @@
             System.arraycopy(data, ptr, matrixData[i], 0, nCols);
             ptr += nCols;
         }
-        return new Array2DRowRealMatrix(matrixData); 
+        return new Array2DRowRealMatrix(matrixData);
     }
 }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/correlation/PearsonsCorrelationTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/correlation/PearsonsCorrelationTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/correlation/PearsonsCorrelationTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/correlation/PearsonsCorrelationTest.java Sat Sep  5 17:36:48 2009
@@ -25,7 +25,7 @@
 import junit.framework.TestCase;
 
 public class PearsonsCorrelationTest extends TestCase {
-    
+
     protected final double[] longleyData = new double[] {
             60323,83.0,234289,2356,1590,107608,1947,
             61122,88.5,259426,2325,1456,108632,1948,
@@ -44,7 +44,7 @@
             69331,115.7,518173,4806,2572,127852,1961,
             70551,116.9,554894,4007,2827,130081,1962
         };
-    
+
     protected final double[] swissData = new double[] {
             80.2,17.0,15,12,9.96,
             83.1,45.1,6,9,84.84,
@@ -94,14 +94,14 @@
             44.7,46.6,16,29,50.43,
             42.8,27.7,22,29,58.33
         };
- 
-    
+
+
     /**
      * Test Longley dataset against R.
      */
-    public void testLongly() throws Exception {  
+    public void testLongly() throws Exception {
         RealMatrix matrix = createRealMatrix(longleyData, 16, 7);
-        PearsonsCorrelation corrInstance = new PearsonsCorrelation(matrix); 
+        PearsonsCorrelation corrInstance = new PearsonsCorrelation(matrix);
         RealMatrix correlationMatrix = corrInstance.getCorrelationMatrix();
         double[] rData = new double[] {
                 1.000000000000000, 0.9708985250610560, 0.9835516111796693, 0.5024980838759942,
@@ -118,28 +118,28 @@
                 0.3644162671890320, 1.000000000000000, 0.9939528462329257,
                 0.971329459192119, 0.9911491900672053, 0.9952734837647849, 0.6682566045621746,
                 0.4172451498349454, 0.993952846232926, 1.0000000000000000
-        }; 
+        };
         TestUtils.assertEquals("correlation matrix", createRealMatrix(rData, 7, 7), correlationMatrix, 10E-15);
-        
+
         double[] rPvalues = new double[] {
                 4.38904690369668e-10,
                 8.36353208910623e-12, 7.8159700933611e-14,
-                0.0472894097790304, 0.01030636128354301, 0.01316878049026582, 
+                0.0472894097790304, 0.01030636128354301, 0.01316878049026582,
                 0.0749178049642416, 0.06971758330341182, 0.0830166169296545, 0.510948586323452,
-                3.693245043123738e-09, 4.327782576751815e-11, 1.167954621905665e-13, 0.00331028281967516, 0.1652293725106684, 
+                3.693245043123738e-09, 4.327782576751815e-11, 1.167954621905665e-13, 0.00331028281967516, 0.1652293725106684,
                 3.95834476307755e-10, 1.114663916723657e-13, 1.332267629550188e-15, 0.00466039138541463, 0.1078477071581498, 7.771561172376096e-15
         };
         RealMatrix rPMatrix = createLowerTriangularRealMatrix(rPvalues, 7);
         fillUpper(rPMatrix, 0d);
         TestUtils.assertEquals("correlation p values", rPMatrix, corrInstance.getCorrelationPValues(), 10E-15);
     }
-    
+
     /**
      * Test R Swiss fertility dataset against R.
      */
     public void testSwissFertility() throws Exception {
          RealMatrix matrix = createRealMatrix(swissData, 47, 5);
-         PearsonsCorrelation corrInstance = new PearsonsCorrelation(matrix); 
+         PearsonsCorrelation corrInstance = new PearsonsCorrelation(matrix);
          RealMatrix correlationMatrix = corrInstance.getCorrelationMatrix();
          double[] rData = new double[] {
                1.0000000000000000, 0.3530791836199747, -0.6458827064572875, -0.6637888570350691,  0.4636847006517939,
@@ -149,7 +149,7 @@
                  0.4636847006517939, 0.4010950530487398, -0.5727418060641666, -0.1538589170909148, 1.0000000000000000
          };
          TestUtils.assertEquals("correlation matrix", createRealMatrix(rData, 5, 5), correlationMatrix, 10E-15);
-         
+
          double[] rPvalues = new double[] {
                  0.01491720061472623,
                  9.45043734069043e-07, 9.95151527133974e-08,
@@ -160,7 +160,7 @@
          fillUpper(rPMatrix, 0d);
          TestUtils.assertEquals("correlation p values", rPMatrix, corrInstance.getCorrelationPValues(), 10E-15);
     }
-    
+
     /**
      * Constant column
      */
@@ -169,12 +169,12 @@
         double[] values = new double[] {1, 2, 3, 4};
         assertTrue(Double.isNaN(new PearsonsCorrelation().correlation(noVariance, values)));
     }
-    
-    
+
+
     /**
      * Insufficient data
      */
-     
+
     public void testInsufficientData() {
         double[] one = new double[] {1};
         double[] two = new double[] {2};
@@ -192,7 +192,7 @@
             // Expected
         }
     }
-    
+
     /**
      * Verify that direct t-tests using standard error estimates are consistent
      * with reported p-values
@@ -200,7 +200,7 @@
     public void testStdErrorConsistency() throws Exception {
         TDistribution tDistribution = new TDistributionImpl(45);
         RealMatrix matrix = createRealMatrix(swissData, 47, 5);
-        PearsonsCorrelation corrInstance = new PearsonsCorrelation(matrix); 
+        PearsonsCorrelation corrInstance = new PearsonsCorrelation(matrix);
         RealMatrix rValues = corrInstance.getCorrelationMatrix();
         RealMatrix pValues = corrInstance.getCorrelationPValues();
         RealMatrix stdErrors = corrInstance.getCorrelationStandardErrors();
@@ -212,14 +212,14 @@
             }
         }
     }
-    
+
     /**
      * Verify that creating correlation from covariance gives same results as
      * direct computation from the original matrix
      */
     public void testCovarianceConsistency() throws Exception {
         RealMatrix matrix = createRealMatrix(longleyData, 16, 7);
-        PearsonsCorrelation corrInstance = new PearsonsCorrelation(matrix); 
+        PearsonsCorrelation corrInstance = new PearsonsCorrelation(matrix);
         Covariance covInstance = new Covariance(matrix);
         PearsonsCorrelation corrFromCovInstance = new PearsonsCorrelation(covInstance);
         TestUtils.assertEquals("correlation values", corrInstance.getCorrelationMatrix(),
@@ -228,8 +228,8 @@
                 corrFromCovInstance.getCorrelationPValues(), 10E-15);
         TestUtils.assertEquals("standard errors", corrInstance.getCorrelationStandardErrors(),
                 corrFromCovInstance.getCorrelationStandardErrors(), 10E-15);
-        
-        PearsonsCorrelation corrFromCovInstance2 = 
+
+        PearsonsCorrelation corrFromCovInstance2 =
             new PearsonsCorrelation(covInstance.getCovarianceMatrix(), 16);
         TestUtils.assertEquals("correlation values", corrInstance.getCorrelationMatrix(),
                 corrFromCovInstance2.getCorrelationMatrix(), 10E-15);
@@ -238,20 +238,20 @@
         TestUtils.assertEquals("standard errors", corrInstance.getCorrelationStandardErrors(),
                 corrFromCovInstance2.getCorrelationStandardErrors(), 10E-15);
     }
-    
-     
+
+
     public void testConsistency() {
         RealMatrix matrix = createRealMatrix(longleyData, 16, 7);
-        PearsonsCorrelation corrInstance = new PearsonsCorrelation(matrix); 
+        PearsonsCorrelation corrInstance = new PearsonsCorrelation(matrix);
         double[][] data = matrix.getData();
         double[] x = matrix.getColumn(0);
         double[] y = matrix.getColumn(1);
-        assertEquals(new PearsonsCorrelation().correlation(x, y), 
+        assertEquals(new PearsonsCorrelation().correlation(x, y),
                 corrInstance.getCorrelationMatrix().getEntry(0, 1), Double.MIN_VALUE);
         TestUtils.assertEquals("Correlation matrix", corrInstance.getCorrelationMatrix(),
                 new PearsonsCorrelation().computeCorrelationMatrix(data), Double.MIN_VALUE);
     }
-    
+
     protected RealMatrix createRealMatrix(double[] data, int nRows, int nCols) {
         double[][] matrixData = new double[nRows][nCols];
         int ptr = 0;
@@ -259,9 +259,9 @@
             System.arraycopy(data, ptr, matrixData[i], 0, nCols);
             ptr += nCols;
         }
-        return new BlockRealMatrix(matrixData); 
+        return new BlockRealMatrix(matrixData);
     }
-    
+
     protected RealMatrix createLowerTriangularRealMatrix(double[] data, int dimension) {
         int ptr = 0;
         RealMatrix result = new BlockRealMatrix(dimension, dimension);
@@ -273,7 +273,7 @@
         }
         return result;
     }
-    
+
     protected void fillUpper(RealMatrix matrix, double diagonalValue) {
         int dimension = matrix.getColumnDimension();
         for (int i = 0; i < dimension; i++) {
@@ -281,6 +281,6 @@
             for (int j = i+1; j < dimension; j++) {
                 matrix.setEntry(i, j, matrix.getEntry(j, i));
             }
-        }  
+        }
     }
 }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/correlation/SpearmansRankCorrelationTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/correlation/SpearmansRankCorrelationTest.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/correlation/SpearmansRankCorrelationTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/correlation/SpearmansRankCorrelationTest.java Sat Sep  5 17:36:48 2009
@@ -22,7 +22,7 @@
 
 /**
  * Test cases for Spearman's rank correlation
- * 
+ *
  * @since 2.0
  * @version $Revision$ $Date$
  */
@@ -37,14 +37,14 @@
     protected void tearDown() throws Exception {
         super.tearDown();
     }
-    
+
     /**
      * Test Longley dataset against R.
      */
     @Override
-    public void testLongly() throws Exception {  
+    public void testLongly() throws Exception {
         RealMatrix matrix = createRealMatrix(longleyData, 16, 7);
-        SpearmansCorrelation corrInstance = new SpearmansCorrelation(matrix); 
+        SpearmansCorrelation corrInstance = new SpearmansCorrelation(matrix);
         RealMatrix correlationMatrix = corrInstance.getCorrelationMatrix();
         double[] rData = new double[] {
                 1, 0.982352941176471, 0.985294117647059, 0.564705882352941, 0.2264705882352941, 0.976470588235294,
@@ -55,16 +55,16 @@
                 0.2205882352941176, 0.2235294117647059, -0.3411764705882353, 1, 0.2264705882352941, 0.2264705882352941,
                 0.976470588235294, 0.997058823529412, 0.9941176470588236, 0.685294117647059, 0.2264705882352941, 1, 1,
                 0.976470588235294, 0.997058823529412, 0.9941176470588236, 0.685294117647059, 0.2264705882352941, 1, 1
-        }; 
+        };
         TestUtils.assertEquals("Spearman's correlation matrix", createRealMatrix(rData, 7, 7), correlationMatrix, 10E-15);
     }
-    
+
     /**
      * Test R swiss fertility dataset.
      */
-    public void testSwiss() throws Exception {  
+    public void testSwiss() throws Exception {
         RealMatrix matrix = createRealMatrix(swissData, 47, 5);
-        SpearmansCorrelation corrInstance = new SpearmansCorrelation(matrix); 
+        SpearmansCorrelation corrInstance = new SpearmansCorrelation(matrix);
         RealMatrix correlationMatrix = corrInstance.getCorrelationMatrix();
         double[] rData = new double[] {
                 1, 0.2426642769364176, -0.660902996352354, -0.443257690360988, 0.4136455623012432,
@@ -72,10 +72,10 @@
                -0.660902996352354, -0.598859938748963, 1, 0.674603831406147, -0.4750575257171745,
                -0.443257690360988, -0.650463814145816, 0.674603831406147, 1, -0.1444163088302244,
                 0.4136455623012432, 0.2886878090882852, -0.4750575257171745, -0.1444163088302244, 1
-        }; 
+        };
         TestUtils.assertEquals("Spearman's correlation matrix", createRealMatrix(rData, 5, 5), correlationMatrix, 10E-15);
     }
-    
+
     /**
      * Constant column
      */
@@ -85,10 +85,10 @@
         double[] values = new double[] {1, 2, 3, 4};
         assertTrue(Double.isNaN(new SpearmansCorrelation().correlation(noVariance, values)));
     }
-    
+
     /**
      * Insufficient data
-     */ 
+     */
     @Override
     public void testInsufficientData() {
         double[] one = new double[] {1};
@@ -107,24 +107,24 @@
             // Expected
         }
     }
-    
+
     @Override
     public void testConsistency() {
         RealMatrix matrix = createRealMatrix(longleyData, 16, 7);
-        SpearmansCorrelation corrInstance = new SpearmansCorrelation(matrix); 
+        SpearmansCorrelation corrInstance = new SpearmansCorrelation(matrix);
         double[][] data = matrix.getData();
         double[] x = matrix.getColumn(0);
         double[] y = matrix.getColumn(1);
-        assertEquals(new SpearmansCorrelation().correlation(x, y), 
+        assertEquals(new SpearmansCorrelation().correlation(x, y),
                 corrInstance.getCorrelationMatrix().getEntry(0, 1), Double.MIN_VALUE);
         TestUtils.assertEquals("Correlation matrix", corrInstance.getCorrelationMatrix(),
                 new SpearmansCorrelation().computeCorrelationMatrix(data), Double.MIN_VALUE);
     }
-    
+
     // Not relevant here
     @Override
     public void testStdErrorConsistency() throws Exception {}
     @Override
     public void testCovarianceConsistency() throws Exception {}
-     
+
 }