Repository: commons-math
Updated Branches:
  refs/heads/master a14acdf63 -> c4768568c


Tab police

Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/c4768568
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/c4768568
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/c4768568

Branch: refs/heads/master
Commit: c4768568c9981ea4efc942d045d9349ef2596af8
Parents: a14acdf
Author: Sebb <s...@apache.org>
Authored: Mon Jan 12 18:54:16 2015 +0000
Committer: Sebb <s...@apache.org>
Committed: Mon Jan 12 18:54:16 2015 +0000

----------------------------------------------------------------------
 build.xml                                       |   2 +-
 .../AbstractIntegerDistributionTest.java        |  28 ++--
 .../ml/distance/EarthMoversDistanceTest.java    |  38 +++---
 .../stat/descriptive/SummaryStatisticsTest.java |  30 ++--
 .../userguide/genetics/HelloWorldExample.java   | 136 +++++++++----------
 .../userguide/sofm/ChineseRingsClassifier.java  |   2 +-
 6 files changed, 118 insertions(+), 118 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/c4768568/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index 4984b6d..09177b0 100644
--- a/build.xml
+++ b/build.xml
@@ -245,7 +245,7 @@
                doctitle="&lt;h1&gt;${component.title} 
${component.version}&lt;/h1&gt;"
             windowtitle="${component.title} ${component.version}"
                  bottom="Copyright (c) 2003-${current.year}  Apache Software 
Foundation"
-       additionalparam="-header &apos;&lt;script 
type=&quot;text/javascript&quot; 
src=&quot;http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML&quot;&gt;&lt;/script&gt;&apos;";
+        additionalparam="-header &apos;&lt;script 
type=&quot;text/javascript&quot; 
src=&quot;http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML&quot;&gt;&lt;/script&gt;&apos;";
            classpathref="compile.classpath">
         <link href="http://java.sun.com/j2se/1.5.0/docs/api/"/>  
     </javadoc>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/c4768568/src/test/java/org/apache/commons/math3/distribution/AbstractIntegerDistributionTest.java
----------------------------------------------------------------------
diff --git 
a/src/test/java/org/apache/commons/math3/distribution/AbstractIntegerDistributionTest.java
 
b/src/test/java/org/apache/commons/math3/distribution/AbstractIntegerDistributionTest.java
index d6f668b..6e140eb 100644
--- 
a/src/test/java/org/apache/commons/math3/distribution/AbstractIntegerDistributionTest.java
+++ 
b/src/test/java/org/apache/commons/math3/distribution/AbstractIntegerDistributionTest.java
@@ -30,20 +30,20 @@ public class AbstractIntegerDistributionTest {
     @Test
     public void testInverseCumulativeProbabilityMethod()
     {
-       double precision = 0.000000000000001;
-       Assert.assertEquals(1, 
diceDistribution.inverseCumulativeProbability(0));
-       Assert.assertEquals(1, 
diceDistribution.inverseCumulativeProbability((1d-Double.MIN_VALUE)/6d));
-       Assert.assertEquals(2, 
diceDistribution.inverseCumulativeProbability((1d+precision)/6d));
-       Assert.assertEquals(2, 
diceDistribution.inverseCumulativeProbability((2d-Double.MIN_VALUE)/6d));
-       Assert.assertEquals(3, 
diceDistribution.inverseCumulativeProbability((2d+precision)/6d));
-       Assert.assertEquals(3, 
diceDistribution.inverseCumulativeProbability((3d-Double.MIN_VALUE)/6d));
-       Assert.assertEquals(4, 
diceDistribution.inverseCumulativeProbability((3d+precision)/6d));
-       Assert.assertEquals(4, 
diceDistribution.inverseCumulativeProbability((4d-Double.MIN_VALUE)/6d));
-       Assert.assertEquals(5, 
diceDistribution.inverseCumulativeProbability((4d+precision)/6d));
-       Assert.assertEquals(5, 
diceDistribution.inverseCumulativeProbability((5d-precision)/6d));//Can't use 
Double.MIN
-       Assert.assertEquals(6, 
diceDistribution.inverseCumulativeProbability((5d+precision)/6d));
-       Assert.assertEquals(6, 
diceDistribution.inverseCumulativeProbability((6d-precision)/6d));//Can't use 
Double.MIN
-       Assert.assertEquals(6, 
diceDistribution.inverseCumulativeProbability((6d)/6d));
+        double precision = 0.000000000000001;
+        Assert.assertEquals(1, 
diceDistribution.inverseCumulativeProbability(0));
+        Assert.assertEquals(1, 
diceDistribution.inverseCumulativeProbability((1d-Double.MIN_VALUE)/6d));
+        Assert.assertEquals(2, 
diceDistribution.inverseCumulativeProbability((1d+precision)/6d));
+        Assert.assertEquals(2, 
diceDistribution.inverseCumulativeProbability((2d-Double.MIN_VALUE)/6d));
+        Assert.assertEquals(3, 
diceDistribution.inverseCumulativeProbability((2d+precision)/6d));
+        Assert.assertEquals(3, 
diceDistribution.inverseCumulativeProbability((3d-Double.MIN_VALUE)/6d));
+        Assert.assertEquals(4, 
diceDistribution.inverseCumulativeProbability((3d+precision)/6d));
+        Assert.assertEquals(4, 
diceDistribution.inverseCumulativeProbability((4d-Double.MIN_VALUE)/6d));
+        Assert.assertEquals(5, 
diceDistribution.inverseCumulativeProbability((4d+precision)/6d));
+        Assert.assertEquals(5, 
diceDistribution.inverseCumulativeProbability((5d-precision)/6d));//Can't use 
Double.MIN
+        Assert.assertEquals(6, 
diceDistribution.inverseCumulativeProbability((5d+precision)/6d));
+        Assert.assertEquals(6, 
diceDistribution.inverseCumulativeProbability((6d-precision)/6d));//Can't use 
Double.MIN
+        Assert.assertEquals(6, 
diceDistribution.inverseCumulativeProbability((6d)/6d));
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/commons-math/blob/c4768568/src/test/java/org/apache/commons/math3/ml/distance/EarthMoversDistanceTest.java
----------------------------------------------------------------------
diff --git 
a/src/test/java/org/apache/commons/math3/ml/distance/EarthMoversDistanceTest.java
 
b/src/test/java/org/apache/commons/math3/ml/distance/EarthMoversDistanceTest.java
index 01d1e79..43d3b6f 100644
--- 
a/src/test/java/org/apache/commons/math3/ml/distance/EarthMoversDistanceTest.java
+++ 
b/src/test/java/org/apache/commons/math3/ml/distance/EarthMoversDistanceTest.java
@@ -26,25 +26,25 @@ import org.junit.Test;
  */
 public class EarthMoversDistanceTest {
 
-       final DistanceMeasure distance = new EarthMoversDistance();
-       final double[] a = { 0.1, 0.3, 0.2, 0.0, 0.25, 0.15 };
-       final double[] b = { 0.3, 0.0, 0.4, 0.1, 0.0, 0.2 };
-       
-       @Test
-       public void testZero() {
+    final DistanceMeasure distance = new EarthMoversDistance();
+    final double[] a = { 0.1, 0.3, 0.2, 0.0, 0.25, 0.15 };
+    final double[] b = { 0.3, 0.0, 0.4, 0.1, 0.0, 0.2 };
+
+    @Test
+    public void testZero() {
         Assert.assertEquals(0, distance.compute(a, a), 0d);
-       }
-       
-       @Test
-       public void testZero2() {
-               final double[] zero = new double[] { 0, 0 };
-               Assert.assertEquals(0, distance.compute(zero, zero), 0d);       
        
-       }
+    }
+
+    @Test
+    public void testZero2() {
+        final double[] zero = new double[] { 0, 0 };
+        Assert.assertEquals(0, distance.compute(zero, zero), 0d);
+    }
 
-       @Test
-       public void test() {
-               double expected = 0.65; //0.2 + 0.1 + 0.1 + 0.2 + 0.05 + 0.0;
-               Assert.assertEquals(expected, distance.compute(a, b), 1e-10);
-               Assert.assertEquals(expected, distance.compute(b, a), 1e-10);
-       }
+    @Test
+    public void test() {
+        double expected = 0.65; //0.2 + 0.1 + 0.1 + 0.2 + 0.05 + 0.0;
+        Assert.assertEquals(expected, distance.compute(a, b), 1e-10);
+        Assert.assertEquals(expected, distance.compute(b, a), 1e-10);
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/c4768568/src/test/java/org/apache/commons/math3/stat/descriptive/SummaryStatisticsTest.java
----------------------------------------------------------------------
diff --git 
a/src/test/java/org/apache/commons/math3/stat/descriptive/SummaryStatisticsTest.java
 
b/src/test/java/org/apache/commons/math3/stat/descriptive/SummaryStatisticsTest.java
index ba77d87..f104d65 100644
--- 
a/src/test/java/org/apache/commons/math3/stat/descriptive/SummaryStatisticsTest.java
+++ 
b/src/test/java/org/apache/commons/math3/stat/descriptive/SummaryStatisticsTest.java
@@ -338,20 +338,20 @@ public class SummaryStatisticsTest {
     
     @Test
     public void testToString() {
-       SummaryStatistics u = createSummaryStatistics();
-       for (int i = 0; i < 5; i++) {
-               u.addValue(i);
-       }
-       final String[] labels = {"min", "max", "sum", "geometric mean", 
"variance",
-                       "population variance", "second moment", "sum of 
squares", "standard deviation",
-       "sum of logs"};
-       final double[] values = {u.getMin(), u.getMax(), u.getSum(), 
u.getGeometricMean(),
-                       u.getVariance(), u.getPopulationVariance(), 
u.getSecondMoment(), u.getSumsq(),
-                       u.getStandardDeviation(), u.getSumOfLogs()};
-       final String toString = u.toString();
-       Assert.assertTrue(toString.indexOf("n: " + u.getN()) > 0); // getN() 
returns a long
-       for (int i = 0; i < values.length; i++) {
-               Assert.assertTrue(toString.indexOf(labels[i] + ": " + 
String.valueOf(values[i])) > 0);
-       }
+        SummaryStatistics u = createSummaryStatistics();
+        for (int i = 0; i < 5; i++) {
+            u.addValue(i);
+        }
+        final String[] labels = {"min", "max", "sum", "geometric mean", 
"variance",
+                "population variance", "second moment", "sum of squares", 
"standard deviation",
+        "sum of logs"};
+        final double[] values = {u.getMin(), u.getMax(), u.getSum(), 
u.getGeometricMean(),
+                u.getVariance(), u.getPopulationVariance(), 
u.getSecondMoment(), u.getSumsq(),
+                u.getStandardDeviation(), u.getSumOfLogs()};
+        final String toString = u.toString();
+        Assert.assertTrue(toString.indexOf("n: " + u.getN()) > 0); // getN() 
returns a long
+        for (int i = 0; i < values.length; i++) {
+            Assert.assertTrue(toString.indexOf(labels[i] + ": " + 
String.valueOf(values[i])) > 0);
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/c4768568/src/userguide/java/org/apache/commons/math3/userguide/genetics/HelloWorldExample.java
----------------------------------------------------------------------
diff --git 
a/src/userguide/java/org/apache/commons/math3/userguide/genetics/HelloWorldExample.java
 
b/src/userguide/java/org/apache/commons/math3/userguide/genetics/HelloWorldExample.java
index 00c40e8..b4db00f 100644
--- 
a/src/userguide/java/org/apache/commons/math3/userguide/genetics/HelloWorldExample.java
+++ 
b/src/userguide/java/org/apache/commons/math3/userguide/genetics/HelloWorldExample.java
@@ -38,16 +38,16 @@ import org.apache.commons.math3.util.FastMath;
 import org.apache.commons.math3.util.Precision;
 
 public class HelloWorldExample {
-       public static final int    POPULATION_SIZE   = 1000;
-       public static final double CROSSOVER_RATE    = 0.9;
-       public static final double MUTATION_RATE     = 0.03;
-       public static final double ELITISM_RATE      = 0.1;
-       public static final int    TOURNAMENT_ARITY  = 2;
+    public static final int    POPULATION_SIZE   = 1000;
+    public static final double CROSSOVER_RATE    = 0.9;
+    public static final double MUTATION_RATE     = 0.03;
+    public static final double ELITISM_RATE      = 0.1;
+    public static final int    TOURNAMENT_ARITY  = 2;
 
-       public static final String TARGET_STRING = "Hello World!";
-       public static final int DIMENSION = TARGET_STRING.length();
+    public static final String TARGET_STRING = "Hello World!";
+    public static final int DIMENSION = TARGET_STRING.length();
 
-       public static void main(String[] args) {
+    public static void main(String[] args) {
         long startTime = System.currentTimeMillis();
 
         // initialize a new genetic algorithm
@@ -93,8 +93,8 @@ public class HelloWorldExample {
         Chromosome best = finalPopulation.getFittestChromosome();
         System.out.println("Generation " + ga.getGenerationsEvolved() + ": " + 
best.toString());
         System.out.println("Total execution time: " + (endTime - startTime) + 
"ms");
-       }
-       
+    }
+    
     private static List<Character> randomRepresentation(int length) {
         return asList(RandomStringUtils.randomAscii(length));
     }
@@ -112,20 +112,20 @@ public class HelloWorldExample {
         return new ElitisticListPopulation(popList, 2 * popList.size(), 
ELITISM_RATE);
     }
 
-       /**
-        * String Chromosome represented by a list of characters.
-        */
-       public static class StringChromosome extends 
AbstractListChromosome<Character> {
+    /**
+     * String Chromosome represented by a list of characters.
+     */
+    public static class StringChromosome extends 
AbstractListChromosome<Character> {
 
-           public StringChromosome(List<Character> repr) {
-               super(repr);
-           }
+        public StringChromosome(List<Character> repr) {
+            super(repr);
+        }
 
-           public StringChromosome(String str) {
-               this(asList(str));
-           }
+        public StringChromosome(String str) {
+            this(asList(str));
+        }
 
-           public double fitness() {
+        public double fitness() {
             String target = TARGET_STRING;
             int f = 0; // start at 0; the best fitness
             List<Character> chromosome = getRepresentation();
@@ -137,51 +137,51 @@ public class HelloWorldExample {
             return f;
         }
 
-           @Override
-           protected void checkValidity(List<Character> repr) throws 
InvalidRepresentationException {
-               for (char c : repr) {
-                   if (c < 32 || c > 126) {
-                       throw new 
InvalidRepresentationException(LocalizedFormats.INVALID_FIXED_LENGTH_CHROMOSOME);
-                   }
-               }
-           }
-
-           public List<Character> getStringRepresentation() {
-               return getRepresentation();
-           }
-
-           @Override
-           public StringChromosome newFixedLengthChromosome(List<Character> 
repr) {
-               return new StringChromosome(repr);
-           }
-
-           @Override
-           public String toString() {
-               StringBuffer sb = new StringBuffer();
-               for (Character i : getRepresentation()) {
-                   sb.append(i.charValue());
-               }
-               return String.format("(f=%s '%s')", getFitness(), 
sb.toString());
-           }
-
-       }
-
-       private static class RandomCharacterMutation implements MutationPolicy {
-               public Chromosome mutate(Chromosome original) {
-                       if (!(original instanceof StringChromosome)) {
-                               throw new IllegalArgumentException();
-                       }
-
-                       StringChromosome strChromosome = (StringChromosome) 
original;
-                       List<Character> characters = 
strChromosome.getStringRepresentation();
-                       
-                       int mutationIndex = 
GeneticAlgorithm.getRandomGenerator().nextInt(characters.size());
-
-                       List<Character> mutatedChromosome = new 
ArrayList<Character>(characters);
-                       char newValue = (char) (32 + 
GeneticAlgorithm.getRandomGenerator().nextInt(127 - 32));
-                       mutatedChromosome.set(mutationIndex, newValue);
-
-                       return 
strChromosome.newFixedLengthChromosome(mutatedChromosome);
-               }
-       }
+        @Override
+        protected void checkValidity(List<Character> repr) throws 
InvalidRepresentationException {
+            for (char c : repr) {
+                if (c < 32 || c > 126) {
+                    throw new 
InvalidRepresentationException(LocalizedFormats.INVALID_FIXED_LENGTH_CHROMOSOME);
+                }
+            }
+        }
+
+        public List<Character> getStringRepresentation() {
+            return getRepresentation();
+        }
+
+        @Override
+        public StringChromosome newFixedLengthChromosome(List<Character> repr) 
{
+            return new StringChromosome(repr);
+        }
+
+        @Override
+        public String toString() {
+            StringBuffer sb = new StringBuffer();
+            for (Character i : getRepresentation()) {
+                sb.append(i.charValue());
+            }
+            return String.format("(f=%s '%s')", getFitness(), sb.toString());
+        }
+
+    }
+
+    private static class RandomCharacterMutation implements MutationPolicy {
+        public Chromosome mutate(Chromosome original) {
+            if (!(original instanceof StringChromosome)) {
+                throw new IllegalArgumentException();
+            }
+
+            StringChromosome strChromosome = (StringChromosome) original;
+            List<Character> characters = 
strChromosome.getStringRepresentation();
+            
+            int mutationIndex = 
GeneticAlgorithm.getRandomGenerator().nextInt(characters.size());
+
+            List<Character> mutatedChromosome = new 
ArrayList<Character>(characters);
+            char newValue = (char) (32 + 
GeneticAlgorithm.getRandomGenerator().nextInt(127 - 32));
+            mutatedChromosome.set(mutationIndex, newValue);
+
+            return strChromosome.newFixedLengthChromosome(mutatedChromosome);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/c4768568/src/userguide/java/org/apache/commons/math3/userguide/sofm/ChineseRingsClassifier.java
----------------------------------------------------------------------
diff --git 
a/src/userguide/java/org/apache/commons/math3/userguide/sofm/ChineseRingsClassifier.java
 
b/src/userguide/java/org/apache/commons/math3/userguide/sofm/ChineseRingsClassifier.java
index d27d0d9..871d9d6 100644
--- 
a/src/userguide/java/org/apache/commons/math3/userguide/sofm/ChineseRingsClassifier.java
+++ 
b/src/userguide/java/org/apache/commons/math3/userguide/sofm/ChineseRingsClassifier.java
@@ -58,7 +58,7 @@ public class ChineseRingsClassifier {
     /** Distance function. */
     private final DistanceMeasure distance = new EuclideanDistance();
 
-       public static void main(String[] args) {
+    public static void main(String[] args) {
         final ChineseRings rings = new ChineseRings(new Vector3D(1, 2, 3),
                                                     25, 2,
                                                     20, 1,

Reply via email to