You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by sr...@apache.org on 2012/06/20 14:07:58 UTC

svn commit: r1352052 [6/7] - in /mahout/trunk: ./ buildtools/ buildtools/src/main/resources/ core/ core/src/main/java/org/apache/mahout/cf/taste/hadoop/ core/src/main/java/org/apache/mahout/cf/taste/hadoop/als/ core/src/main/java/org/apache/mahout/cf/t...

Modified: mahout/trunk/integration/src/main/java/org/apache/mahout/utils/SplitInputJob.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/main/java/org/apache/mahout/utils/SplitInputJob.java?rev=1352052&r1=1352051&r2=1352052&view=diff
==============================================================================
--- mahout/trunk/integration/src/main/java/org/apache/mahout/utils/SplitInputJob.java (original)
+++ mahout/trunk/integration/src/main/java/org/apache/mahout/utils/SplitInputJob.java Wed Jun 20 12:07:50 2012
@@ -151,10 +151,12 @@ public final class SplitInputJob {
     @Override
     public void run(Context context) throws IOException, InterruptedException {
       setup(context);
-      for (int i = 0; context.nextKeyValue(); i++) {
+      int i = 0;
+      while (context.nextKeyValue()) {
         if (i % downsamplingFactor == 0) {
           map(context.getCurrentKey(), context.getCurrentValue(), context);
         }
+        i++;
       }
       cleanup(context);
     }

Modified: mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/AbstractClusterWriter.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/AbstractClusterWriter.java?rev=1352052&r1=1352051&r2=1352052&view=diff
==============================================================================
--- mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/AbstractClusterWriter.java (original)
+++ mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/AbstractClusterWriter.java Wed Jun 20 12:07:50 2012
@@ -145,7 +145,7 @@ public abstract class AbstractClusterWri
 
     for (Pair<String, Double> item : topTerms) {
       String term = item.getFirst();
-      sb.append(term).append("_");
+      sb.append(term).append('_');
     }
     sb.deleteCharAt(sb.length() - 1);
     return sb.toString();

Modified: mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/ClusterDumper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/ClusterDumper.java?rev=1352052&r1=1352051&r2=1352052&view=diff
==============================================================================
--- mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/ClusterDumper.java (original)
+++ mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/ClusterDumper.java Wed Jun 20 12:07:50 2012
@@ -57,7 +57,7 @@ import com.google.common.io.Files;
 public final class ClusterDumper extends AbstractJob {
 
   public static final String SAMPLE_POINTS = "samplePoints";
-  protected DistanceMeasure measure;
+  DistanceMeasure measure;
 
   public enum OUTPUT_FORMAT {
     TEXT,

Modified: mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/ClusterWriter.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/ClusterWriter.java?rev=1352052&r1=1352051&r2=1352052&view=diff
==============================================================================
--- mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/ClusterWriter.java (original)
+++ mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/ClusterWriter.java Wed Jun 20 12:07:50 2012
@@ -26,6 +26,7 @@ import org.apache.mahout.clustering.iter
  * Writes out clusters
  */
 public interface ClusterWriter extends Closeable {
+
   /**
    * Write all values in the Iterable to the output
    *
@@ -37,9 +38,6 @@ public interface ClusterWriter extends C
 
   /**
    * Write out a Cluster
-   *
-   * @param cluster The {@link org.apache.mahout.clustering.Cluster} to write
-   * @throws IOException
    */
   void write(ClusterWritable clusterWritable) throws IOException;
 

Modified: mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/GraphMLClusterWriter.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/GraphMLClusterWriter.java?rev=1352052&r1=1352051&r2=1352052&view=diff
==============================================================================
--- mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/GraphMLClusterWriter.java (original)
+++ mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/GraphMLClusterWriter.java Wed Jun 20 12:07:50 2012
@@ -28,6 +28,7 @@ import java.util.regex.Pattern;
 import org.apache.mahout.clustering.Cluster;
 import org.apache.mahout.clustering.classify.WeightedVectorWritable;
 import org.apache.mahout.clustering.iterator.ClusterWritable;
+import org.apache.mahout.common.RandomUtils;
 import org.apache.mahout.common.StringUtils;
 import org.apache.mahout.common.distance.DistanceMeasure;
 import org.apache.mahout.math.NamedVector;
@@ -39,14 +40,15 @@ import org.apache.mahout.math.Vector;
 public class GraphMLClusterWriter extends AbstractClusterWriter {
 
   private static final Pattern VEC_PATTERN = Pattern.compile("\\{|\\:|\\,|\\}");
-  private Map<Integer, Color> colors = new HashMap<Integer, Color>();
+  private final Map<Integer, Color> colors = new HashMap<Integer, Color>();
   private Color lastClusterColor;
-  private float lastX, lastY;
+  private float lastX;
+  private float lastY;
   private Random random;
   private int posStep;
   private final String[] dictionary;
   private final int numTopFeatures;
-  private int subString;
+  private final int subString;
 
   public GraphMLClusterWriter(Writer writer, Map<Integer, List<WeightedVectorWritable>> clusterIdToPoints,
                               DistanceMeasure measure,
@@ -76,7 +78,7 @@ public class GraphMLClusterWriter extend
     writer.append("<graph edgedefault=\"undirected\">");
     lastClusterColor = new Color();
     posStep = (int) (0.1 * clusterIdToPoints.size()) + 100;
-    random = new Random();
+    random = RandomUtils.getRandom();
   }
 
   /*
@@ -103,7 +105,7 @@ public class GraphMLClusterWriter extend
     if (dictionary != null) {
       topTerms = getTopTerms(cluster.getCenter(), dictionary, numTopFeatures);
     }
-    String clusterLabel = String.valueOf(cluster.getId()) + "_" + topTerms;
+    String clusterLabel = String.valueOf(cluster.getId()) + '_' + topTerms;
     //do some positioning so that items are visible and grouped together
     //TODO: put in a real layout algorithm
     float x = lastX + 1000;
@@ -153,7 +155,9 @@ public class GraphMLClusterWriter extend
     if (result == null) {
       result = new Color();
       //there is probably some better way to color a graph
-      int incR = 0, incG = 0, incB = 0;
+      int incR = 0;
+      int incG = 0;
+      int incB = 0;
       if (lastClusterColor.r + 20 < 256 && lastClusterColor.g + 20 < 256 && lastClusterColor.b + 20 < 256) {
         incR = 20;
         incG = 0;
@@ -183,13 +187,6 @@ public class GraphMLClusterWriter extend
             + "<data key=\"weight\">" + distance + "</data></edge>";
   }
 
-  private static String createNode(String s) {
-    return "<node id=\"" + StringUtils.escapeXML(s) + "\"/>";
-  }
-
-
-
-
   private static String createNode(String s, Color rgb, float x, float y) {
     return "<node id=\"" + StringUtils.escapeXML(s) + "\"><data key=\"r\">" + rgb.r 
             + "</data>" +
@@ -210,7 +207,9 @@ public class GraphMLClusterWriter extend
     super.close();
   }
 
-  private class Color {
-    int r, g, b;
+  private static class Color {
+    int r;
+    int g;
+    int b;
   }
 }

Modified: mahout/trunk/integration/src/main/java/org/apache/mahout/utils/vectors/VectorDumper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/main/java/org/apache/mahout/utils/vectors/VectorDumper.java?rev=1352052&r1=1352051&r2=1352052&view=diff
==============================================================================
--- mahout/trunk/integration/src/main/java/org/apache/mahout/utils/vectors/VectorDumper.java (original)
+++ mahout/trunk/integration/src/main/java/org/apache/mahout/utils/vectors/VectorDumper.java Wed Jun 20 12:07:50 2012
@@ -20,9 +20,6 @@ package org.apache.mahout.utils.vectors;
 import com.google.common.base.Charsets;
 import com.google.common.io.Closeables;
 import com.google.common.io.Files;
-import org.apache.commons.cli2.Group;
-import org.apache.commons.cli2.OptionException;
-import org.apache.commons.cli2.util.HelpFormatter;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
@@ -64,7 +61,6 @@ public final class VectorDumper extends 
 
   @Override
   public int run(String[] args) throws Exception {
-    int result = 0;
     /**
      Option seqOpt = obuilder.withLongName("seqFile").withRequired(false).withArgument(
      abuilder.withName("seqFile").withMinimum(1).withMaximum(1).create()).withDescription(
@@ -96,7 +92,7 @@ public final class VectorDumper extends 
       return -1;
     }
 
-    Path[] pathArr = null;
+    Path[] pathArr;
     Configuration conf = new Configuration();
     FileSystem fs = FileSystem.get(conf);
     Path input = getInputPath();
@@ -117,7 +113,7 @@ public final class VectorDumper extends 
 
     boolean sortVectors = hasOption("sortVectors");
     boolean quiet = hasOption("quiet");
-    if (quiet == false) {
+    if (!quiet) {
       log.info("Sort? " + sortVectors);
     }
 
@@ -177,7 +173,7 @@ public final class VectorDumper extends 
         }
       }
       int maxIndexesPerVector = hasOption("numIndexesPerVector")
-              ? Integer.parseInt(getOption("numIndexesPerVector").toString())
+              ? Integer.parseInt(getOption("numIndexesPerVector"))
               : Integer.MAX_VALUE;
       long itemCount = 0;
       int fileCount = 0;
@@ -202,19 +198,19 @@ public final class VectorDumper extends 
             writer.write(notTheVectorWritable.toString());
             writer.write('\t');
           }
-          Vector vector = null;
+          Vector vector;
           try {
-            VectorWritable vectorWritable;
             vector = ((VectorWritable)
                     (transposeKeyValue ? keyWritable : valueWritable)).get();
           } catch (ClassCastException e) {
             if ((transposeKeyValue ? keyWritable : valueWritable)
-                    instanceof WeightedPropertyVectorWritable)
+                    instanceof WeightedPropertyVectorWritable) {
               vector =
-                      ((WeightedPropertyVectorWritable)
-                              (transposeKeyValue ? keyWritable : valueWritable)).getVector();
-            else
+                  ((WeightedPropertyVectorWritable)
+                      (transposeKeyValue ? keyWritable : valueWritable)).getVector();
+            } else {
               throw e;
+            }
           }
           if (filters != null
                   && vector instanceof NamedVector
@@ -258,17 +254,11 @@ public final class VectorDumper extends 
       }
     }
 
-    return result;
-
+    return 0;
   }
 
   public static void main(String[] args) throws Exception {
     ToolRunner.run(new Configuration(), new VectorDumper(), args);
   }
 
-  private static void printHelp(Group group) {
-    HelpFormatter formatter = new HelpFormatter();
-    formatter.setGroup(group);
-    formatter.print();
-  }
 }

Modified: mahout/trunk/integration/src/main/java/org/apache/mahout/utils/vectors/VectorHelper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/main/java/org/apache/mahout/utils/vectors/VectorHelper.java?rev=1352052&r1=1352051&r2=1352052&view=diff
==============================================================================
--- mahout/trunk/integration/src/main/java/org/apache/mahout/utils/vectors/VectorHelper.java (original)
+++ mahout/trunk/integration/src/main/java/org/apache/mahout/utils/vectors/VectorHelper.java Wed Jun 20 12:07:50 2012
@@ -111,22 +111,23 @@ public final class VectorHelper {
 
   public static List<Pair<String, Double>> toWeightedTerms(Collection<Pair<Integer, Double>> entries,
       final String[] dictionary) {
-    if (dictionary != null) 
+    if (dictionary != null) {
       return Lists.newArrayList(Collections2.transform(entries,
-            new Function<Pair<Integer, Double>, Pair<String, Double>>() {
-              @Override
-              public Pair<String, Double> apply(Pair<Integer, Double> p) {
-                return Pair.of(dictionary[p.getFirst()], p.getSecond());
-              }
-            }));
-    else 
+                                                       new Function<Pair<Integer, Double>, Pair<String, Double>>() {
+                                                         @Override
+                                                         public Pair<String, Double> apply(Pair<Integer, Double> p) {
+                                                           return Pair.of(dictionary[p.getFirst()], p.getSecond());
+                                                         }
+                                                       }));
+    } else {
       return Lists.newArrayList(Collections2.transform(entries,
-            new Function<Pair<Integer, Double>, Pair<String, Double>>() {
-              @Override
-              public Pair<String, Double> apply(Pair<Integer, Double> p) {
-                return Pair.of(Integer.toString(p.getFirst()), p.getSecond());
-              }
-            }));
+                                                       new Function<Pair<Integer, Double>, Pair<String, Double>>() {
+                                                         @Override
+                                                         public Pair<String, Double> apply(Pair<Integer, Double> p) {
+                                                           return Pair.of(Integer.toString(p.getFirst()), p.getSecond());
+                                                         }
+                                                       }));
+    }
   }
 
   public static String vectorToJson(Vector vector, String[] dictionary, int maxEntries, boolean sort) {

Modified: mahout/trunk/integration/src/test/java/org/apache/mahout/clustering/TestClusterEvaluator.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/test/java/org/apache/mahout/clustering/TestClusterEvaluator.java?rev=1352052&r1=1352051&r2=1352052&view=diff
==============================================================================
--- mahout/trunk/integration/src/test/java/org/apache/mahout/clustering/TestClusterEvaluator.java (original)
+++ mahout/trunk/integration/src/test/java/org/apache/mahout/clustering/TestClusterEvaluator.java Wed Jun 20 12:07:50 2012
@@ -114,7 +114,7 @@ public final class TestClusterEvaluator 
     generateSamples(300, 0, 2, 0.1);
   }
   
-  private void printRepPoints(int numIterations) throws IOException {
+  private void printRepPoints(int numIterations) {
     RepresentativePointsDriver.printRepresentativePoints(output, numIterations);
   }
   

Modified: mahout/trunk/integration/src/test/java/org/apache/mahout/clustering/dirichlet/TestL1ModelClustering.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/test/java/org/apache/mahout/clustering/dirichlet/TestL1ModelClustering.java?rev=1352052&r1=1352051&r2=1352052&view=diff
==============================================================================
--- mahout/trunk/integration/src/test/java/org/apache/mahout/clustering/dirichlet/TestL1ModelClustering.java (original)
+++ mahout/trunk/integration/src/test/java/org/apache/mahout/clustering/dirichlet/TestL1ModelClustering.java Wed Jun 20 12:07:50 2012
@@ -159,12 +159,12 @@ public final class TestL1ModelClustering
     for (Vector vector : iterable) {
       assertNotNull(vector);
       System.out.println(i + ". " + docs2[i++]);
-      System.out.println("\t" + formatVector(vector));
+      System.out.println('\t' + formatVector(vector));
       sampleData.add(vector);
     }
   }
   
-  private String formatVector(Vector v) {
+  private static String formatVector(Vector v) {
     StringBuilder buf = new StringBuilder();
     int nzero = 0;
     Iterator<Vector.Element> iterateNonZero = v.iterateNonZero();
@@ -211,10 +211,10 @@ public final class TestL1ModelClustering
         map[i] = new MapElement(pdf, docs[i]);
       }
       Arrays.sort(map);
-      for (int i = 0; i < map.length; i++) {
-        Double pdf = map[i].pdf;
+      for (MapElement aMap : map) {
+        Double pdf = aMap.pdf;
         double norm = pdf / maxPdf;
-        System.out.println(String.format(Locale.ENGLISH, "%.3f", norm) + " " + map[i].doc);
+        System.out.println(String.format(Locale.ENGLISH, "%.3f", norm) + ' ' + aMap.doc);
       }
     }
   }
@@ -231,9 +231,8 @@ public final class TestL1ModelClustering
       models.add((Cluster) cluster);
     }
     
-    ClusterIterator iterator = new ClusterIterator();
     ClusterClassifier classifier = new ClusterClassifier(models, new DirichletClusteringPolicy(15, 1.0));
-    ClusterClassifier posterior = iterator.iterate(sampleData, classifier, 10);
+    ClusterClassifier posterior = ClusterIterator.iterate(sampleData, classifier, 10);
     
     printClusters(posterior.getModels(), DOCS);
   }
@@ -252,9 +251,8 @@ public final class TestL1ModelClustering
       models.add((Cluster) cluster);
     }
     
-    ClusterIterator iterator = new ClusterIterator();
     ClusterClassifier classifier = new ClusterClassifier(models, new DirichletClusteringPolicy(15, 1.0));
-    ClusterClassifier posterior = iterator.iterate(sampleData, classifier, 10);
+    ClusterClassifier posterior = ClusterIterator.iterate(sampleData, classifier, 10);
     
     printClusters(posterior.getModels(), DOCS);
   }
@@ -271,9 +269,8 @@ public final class TestL1ModelClustering
       models.add((Cluster) cluster);
     }
     
-    ClusterIterator iterator = new ClusterIterator();
     ClusterClassifier classifier = new ClusterClassifier(models, new DirichletClusteringPolicy(15, 1.0));
-    ClusterClassifier posterior = iterator.iterate(sampleData, classifier, 10);
+    ClusterClassifier posterior = ClusterIterator.iterate(sampleData, classifier, 10);
     
     printClusters(posterior.getModels(), DOCS2);
   }
@@ -292,9 +289,8 @@ public final class TestL1ModelClustering
       models.add((Cluster) cluster);
     }
     
-    ClusterIterator iterator = new ClusterIterator();
     ClusterClassifier classifier = new ClusterClassifier(models, new DirichletClusteringPolicy(15, 1.0));
-    ClusterClassifier posterior = iterator.iterate(sampleData, classifier, 10);
+    ClusterClassifier posterior = ClusterIterator.iterate(sampleData, classifier, 10);
     
     printClusters(posterior.getModels(), DOCS2);
   }

Modified: mahout/trunk/math/pom.xml
URL: http://svn.apache.org/viewvc/mahout/trunk/math/pom.xml?rev=1352052&r1=1352051&r2=1352052&view=diff
==============================================================================
--- mahout/trunk/math/pom.xml (original)
+++ mahout/trunk/math/pom.xml Wed Jun 20 12:07:50 2012
@@ -43,6 +43,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.4</version>
         <configuration>
           <source>1.6</source>
           <target>1.6</target>
@@ -76,6 +77,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-jar-plugin</artifactId>
+        <version>2.4</version>
         <executions>
           <execution>
             <goals>
@@ -97,6 +99,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-remote-resources-plugin</artifactId>
+        <version>1.3</version>
         <configuration>
           <appendedResourcesDirectory>../src/main/appended-resources</appendedResourcesDirectory>
           <resourceBundles>

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/collections/Arithmetic.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/collections/Arithmetic.java?rev=1352052&r1=1352051&r2=1352052&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/collections/Arithmetic.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/collections/Arithmetic.java Wed Jun 20 12:07:50 2012
@@ -32,216 +32,216 @@ package org.apache.mahout.collections;
 public class Arithmetic extends Constants {
   // for method stirlingCorrection(...)
   private static final double[] stirlingCorrection = {
-      0.0,
-      8.106146679532726e-02, 4.134069595540929e-02,
-      2.767792568499834e-02, 2.079067210376509e-02,
-      1.664469118982119e-02, 1.387612882307075e-02,
-      1.189670994589177e-02, 1.041126526197209e-02,
-      9.255462182712733e-03, 8.330563433362871e-03,
-      7.573675487951841e-03, 6.942840107209530e-03,
-      6.408994188004207e-03, 5.951370112758848e-03,
-      5.554733551962801e-03, 5.207655919609640e-03,
-      4.901395948434738e-03, 4.629153749334029e-03,
-      4.385560249232324e-03, 4.166319691996922e-03,
-      3.967954218640860e-03, 3.787618068444430e-03,
-      3.622960224683090e-03, 3.472021382978770e-03,
-      3.333155636728090e-03, 3.204970228055040e-03,
-      3.086278682608780e-03, 2.976063983550410e-03,
-      2.873449362352470e-03, 2.777674929752690e-03,
+    0.0,
+    8.106146679532726e-02, 4.134069595540929e-02,
+    2.767792568499834e-02, 2.079067210376509e-02,
+    1.664469118982119e-02, 1.387612882307075e-02,
+    1.189670994589177e-02, 1.041126526197209e-02,
+    9.255462182712733e-03, 8.330563433362871e-03,
+    7.573675487951841e-03, 6.942840107209530e-03,
+    6.408994188004207e-03, 5.951370112758848e-03,
+    5.554733551962801e-03, 5.207655919609640e-03,
+    4.901395948434738e-03, 4.629153749334029e-03,
+    4.385560249232324e-03, 4.166319691996922e-03,
+    3.967954218640860e-03, 3.787618068444430e-03,
+    3.622960224683090e-03, 3.472021382978770e-03,
+    3.333155636728090e-03, 3.204970228055040e-03,
+    3.086278682608780e-03, 2.976063983550410e-03,
+    2.873449362352470e-03, 2.777674929752690e-03,
   };
 
   // for method logFactorial(...)
   // log(k!) for k = 0, ..., 29
   private static final double[] logFactorials = {
-      0.00000000000000000, 0.00000000000000000, 0.69314718055994531,
-      1.79175946922805500, 3.17805383034794562, 4.78749174278204599,
-      6.57925121201010100, 8.52516136106541430, 10.60460290274525023,
-      12.80182748008146961, 15.10441257307551530, 17.50230784587388584,
-      19.98721449566188615, 22.55216385312342289, 25.19122118273868150,
-      27.89927138384089157, 30.67186010608067280, 33.50507345013688888,
-      36.39544520803305358, 39.33988418719949404, 42.33561646075348503,
-      45.38013889847690803, 48.47118135183522388, 51.60667556776437357,
-      54.78472939811231919, 58.00360522298051994, 61.26170176100200198,
-      64.55753862700633106, 67.88974313718153498, 71.25703896716800901
+    0.00000000000000000, 0.00000000000000000, 0.69314718055994531,
+    1.79175946922805500, 3.17805383034794562, 4.78749174278204599,
+    6.57925121201010100, 8.52516136106541430, 10.60460290274525023,
+    12.80182748008146961, 15.10441257307551530, 17.50230784587388584,
+    19.98721449566188615, 22.55216385312342289, 25.19122118273868150,
+    27.89927138384089157, 30.67186010608067280, 33.50507345013688888,
+    36.39544520803305358, 39.33988418719949404, 42.33561646075348503,
+    45.38013889847690803, 48.47118135183522388, 51.60667556776437357,
+    54.78472939811231919, 58.00360522298051994, 61.26170176100200198,
+    64.55753862700633106, 67.88974313718153498, 71.25703896716800901
   };
 
   // k! for k = 0, ..., 20
   private static final long[] longFactorials = {
-      1L,
-      1L,
-      2L,
-      6L,
-      24L,
-      120L,
-      720L,
-      5040L,
-      40320L,
-      362880L,
-      3628800L,
-      39916800L,
-      479001600L,
-      6227020800L,
-      87178291200L,
-      1307674368000L,
-      20922789888000L,
-      355687428096000L,
-      6402373705728000L,
-      121645100408832000L,
-      2432902008176640000L
+    1L,
+    1L,
+    2L,
+    6L,
+    24L,
+    120L,
+    720L,
+    5040L,
+    40320L,
+    362880L,
+    3628800L,
+    39916800L,
+    479001600L,
+    6227020800L,
+    87178291200L,
+    1307674368000L,
+    20922789888000L,
+    355687428096000L,
+    6402373705728000L,
+    121645100408832000L,
+    2432902008176640000L
   };
 
   // k! for k = 21, ..., 170
   private static final double[] doubleFactorials = {
-      5.109094217170944E19,
-      1.1240007277776077E21,
-      2.585201673888498E22,
-      6.204484017332394E23,
-      1.5511210043330984E25,
-      4.032914611266057E26,
-      1.0888869450418352E28,
-      3.048883446117138E29,
-      8.841761993739701E30,
-      2.652528598121911E32,
-      8.222838654177924E33,
-      2.6313083693369355E35,
-      8.68331761881189E36,
-      2.952327990396041E38,
-      1.0333147966386144E40,
-      3.719933267899013E41,
-      1.3763753091226346E43,
-      5.23022617466601E44,
-      2.0397882081197447E46,
-      8.15915283247898E47,
-      3.34525266131638E49,
-      1.4050061177528801E51,
-      6.041526306337384E52,
-      2.6582715747884495E54,
-      1.196222208654802E56,
-      5.502622159812089E57,
-      2.5862324151116827E59,
-      1.2413915592536068E61,
-      6.082818640342679E62,
-      3.0414093201713376E64,
-      1.5511187532873816E66,
-      8.06581751709439E67,
-      4.274883284060024E69,
-      2.308436973392413E71,
-      1.2696403353658264E73,
-      7.109985878048632E74,
-      4.052691950487723E76,
-      2.350561331282879E78,
-      1.386831185456898E80,
-      8.32098711274139E81,
-      5.075802138772246E83,
-      3.146997326038794E85,
-      1.9826083154044396E87,
-      1.2688693218588414E89,
-      8.247650592082472E90,
-      5.443449390774432E92,
-      3.6471110918188705E94,
-      2.48003554243683E96,
-      1.7112245242814127E98,
-      1.1978571669969892E100,
-      8.504785885678624E101,
-      6.123445837688612E103,
-      4.470115461512686E105,
-      3.307885441519387E107,
-      2.4809140811395404E109,
-      1.8854947016660506E111,
-      1.451830920282859E113,
-      1.1324281178206295E115,
-      8.94618213078298E116,
-      7.15694570462638E118,
-      5.797126020747369E120,
-      4.7536433370128435E122,
-      3.94552396972066E124,
-      3.314240134565354E126,
-      2.8171041143805494E128,
-      2.4227095383672744E130,
-      2.107757298379527E132,
-      1.854826422573984E134,
-      1.6507955160908465E136,
-      1.4857159644817605E138,
-      1.3520015276784033E140,
-      1.2438414054641305E142,
-      1.156772507081641E144,
-      1.0873661566567426E146,
-      1.0329978488239061E148,
-      9.916779348709491E149,
-      9.619275968248216E151,
-      9.426890448883248E153,
-      9.332621544394415E155,
-      9.332621544394418E157,
-      9.42594775983836E159,
-      9.614466715035125E161,
-      9.902900716486178E163,
-      1.0299016745145631E166,
-      1.0813967582402912E168,
-      1.1462805637347086E170,
-      1.2265202031961373E172,
-      1.324641819451829E174,
-      1.4438595832024942E176,
-      1.5882455415227423E178,
-      1.7629525510902457E180,
-      1.974506857221075E182,
-      2.2311927486598138E184,
-      2.543559733472186E186,
-      2.925093693493014E188,
-      3.393108684451899E190,
-      3.96993716080872E192,
-      4.6845258497542896E194,
-      5.574585761207606E196,
-      6.689502913449135E198,
-      8.094298525273444E200,
-      9.875044200833601E202,
-      1.2146304367025332E205,
-      1.506141741511141E207,
-      1.882677176888926E209,
-      2.3721732428800483E211,
-      3.0126600184576624E213,
-      3.856204823625808E215,
-      4.974504222477287E217,
-      6.466855489220473E219,
-      8.471580690878813E221,
-      1.1182486511960037E224,
-      1.4872707060906847E226,
-      1.99294274616152E228,
-      2.690472707318049E230,
-      3.6590428819525483E232,
-      5.0128887482749884E234,
-      6.917786472619482E236,
-      9.615723196941089E238,
-      1.3462012475717523E241,
-      1.8981437590761713E243,
-      2.6953641378881633E245,
-      3.8543707171800694E247,
-      5.550293832739308E249,
-      8.047926057471989E251,
-      1.1749972043909107E254,
-      1.72724589045464E256,
-      2.5563239178728637E258,
-      3.8089226376305687E260,
-      5.7133839564458575E262,
-      8.627209774233244E264,
-      1.3113358856834527E267,
-      2.0063439050956838E269,
-      3.0897696138473515E271,
-      4.789142901463393E273,
-      7.471062926282892E275,
-      1.1729568794264134E278,
-      1.8532718694937346E280,
-      2.946702272495036E282,
-      4.714723635992061E284,
-      7.590705053947223E286,
-      1.2296942187394494E289,
-      2.0044015765453032E291,
-      3.287218585534299E293,
-      5.423910666131583E295,
-      9.003691705778434E297,
-      1.5036165148649983E300,
-      2.5260757449731988E302,
-      4.2690680090047056E304,
-      7.257415615308004E306
+    5.109094217170944E19,
+    1.1240007277776077E21,
+    2.585201673888498E22,
+    6.204484017332394E23,
+    1.5511210043330984E25,
+    4.032914611266057E26,
+    1.0888869450418352E28,
+    3.048883446117138E29,
+    8.841761993739701E30,
+    2.652528598121911E32,
+    8.222838654177924E33,
+    2.6313083693369355E35,
+    8.68331761881189E36,
+    2.952327990396041E38,
+    1.0333147966386144E40,
+    3.719933267899013E41,
+    1.3763753091226346E43,
+    5.23022617466601E44,
+    2.0397882081197447E46,
+    8.15915283247898E47,
+    3.34525266131638E49,
+    1.4050061177528801E51,
+    6.041526306337384E52,
+    2.6582715747884495E54,
+    1.196222208654802E56,
+    5.502622159812089E57,
+    2.5862324151116827E59,
+    1.2413915592536068E61,
+    6.082818640342679E62,
+    3.0414093201713376E64,
+    1.5511187532873816E66,
+    8.06581751709439E67,
+    4.274883284060024E69,
+    2.308436973392413E71,
+    1.2696403353658264E73,
+    7.109985878048632E74,
+    4.052691950487723E76,
+    2.350561331282879E78,
+    1.386831185456898E80,
+    8.32098711274139E81,
+    5.075802138772246E83,
+    3.146997326038794E85,
+    1.9826083154044396E87,
+    1.2688693218588414E89,
+    8.247650592082472E90,
+    5.443449390774432E92,
+    3.6471110918188705E94,
+    2.48003554243683E96,
+    1.7112245242814127E98,
+    1.1978571669969892E100,
+    8.504785885678624E101,
+    6.123445837688612E103,
+    4.470115461512686E105,
+    3.307885441519387E107,
+    2.4809140811395404E109,
+    1.8854947016660506E111,
+    1.451830920282859E113,
+    1.1324281178206295E115,
+    8.94618213078298E116,
+    7.15694570462638E118,
+    5.797126020747369E120,
+    4.7536433370128435E122,
+    3.94552396972066E124,
+    3.314240134565354E126,
+    2.8171041143805494E128,
+    2.4227095383672744E130,
+    2.107757298379527E132,
+    1.854826422573984E134,
+    1.6507955160908465E136,
+    1.4857159644817605E138,
+    1.3520015276784033E140,
+    1.2438414054641305E142,
+    1.156772507081641E144,
+    1.0873661566567426E146,
+    1.0329978488239061E148,
+    9.916779348709491E149,
+    9.619275968248216E151,
+    9.426890448883248E153,
+    9.332621544394415E155,
+    9.332621544394418E157,
+    9.42594775983836E159,
+    9.614466715035125E161,
+    9.902900716486178E163,
+    1.0299016745145631E166,
+    1.0813967582402912E168,
+    1.1462805637347086E170,
+    1.2265202031961373E172,
+    1.324641819451829E174,
+    1.4438595832024942E176,
+    1.5882455415227423E178,
+    1.7629525510902457E180,
+    1.974506857221075E182,
+    2.2311927486598138E184,
+    2.543559733472186E186,
+    2.925093693493014E188,
+    3.393108684451899E190,
+    3.96993716080872E192,
+    4.6845258497542896E194,
+    5.574585761207606E196,
+    6.689502913449135E198,
+    8.094298525273444E200,
+    9.875044200833601E202,
+    1.2146304367025332E205,
+    1.506141741511141E207,
+    1.882677176888926E209,
+    2.3721732428800483E211,
+    3.0126600184576624E213,
+    3.856204823625808E215,
+    4.974504222477287E217,
+    6.466855489220473E219,
+    8.471580690878813E221,
+    1.1182486511960037E224,
+    1.4872707060906847E226,
+    1.99294274616152E228,
+    2.690472707318049E230,
+    3.6590428819525483E232,
+    5.0128887482749884E234,
+    6.917786472619482E236,
+    9.615723196941089E238,
+    1.3462012475717523E241,
+    1.8981437590761713E243,
+    2.6953641378881633E245,
+    3.8543707171800694E247,
+    5.550293832739308E249,
+    8.047926057471989E251,
+    1.1749972043909107E254,
+    1.72724589045464E256,
+    2.5563239178728637E258,
+    3.8089226376305687E260,
+    5.7133839564458575E262,
+    8.627209774233244E264,
+    1.3113358856834527E267,
+    2.0063439050956838E269,
+    3.0897696138473515E271,
+    4.789142901463393E273,
+    7.471062926282892E275,
+    1.1729568794264134E278,
+    1.8532718694937346E280,
+    2.946702272495036E282,
+    4.714723635992061E284,
+    7.590705053947223E286,
+    1.2296942187394494E289,
+    2.0044015765453032E291,
+    3.287218585534299E293,
+    5.423910666131583E295,
+    9.003691705778434E297,
+    1.5036165148649983E300,
+    2.5260757449731988E302,
+    4.2690680090047056E304,
+    7.257415615308004E306
   };
 
   /** Makes this class non instantiable, but still let's others inherit from it. */
@@ -325,7 +325,7 @@ public class Arithmetic extends Constant
   }
 
   /**
-   * Returns the smallest <code>long &gt;= value</code>. <dt>Examples: <code>1.0 -> 1, 1.2 -> 2, 1.9 -> 2</code>. This
+   * Returns the smallest <code>long &gt;= value</code>. <dt>Examples: {@code 1.0 -> 1, 1.2 -> 2, 1.9 -> 2}. This
    * method is safer than using (long) Math.ceil(value), because of possible rounding error.
    */
   public static long ceil(double value) {
@@ -353,7 +353,7 @@ public class Arithmetic extends Constant
    * @param coef the coefficients of the polynomial.
    * @param N    the number of coefficients.
    */
-  public static double chbevl(double x, double[] coef, int N) throws ArithmeticException {
+  public static double chbevl(double x, double[] coef, int N) {
 
     int p = 0;
 
@@ -395,7 +395,7 @@ public class Arithmetic extends Constant
   }
 
   /**
-   * Returns the largest <code>long &lt;= value</code>. <dt>Examples: <code> 1.0 -> 1, 1.2 -> 1, 1.9 -> 1 <dt> 2.0 -> 2,
+   * Returns the largest <code>long &lt;= value</code>. <dt>Examples: {@code 1.0 -> 1, 1.2 -> 1, 1.9 -> 1 <dt> 2.0 -> 2,}
    * 2.2 -> 2, 2.9 -> 2 </code><dt> This method is safer than using (long) Math.floor(value), because of possible
    * rounding error.
    */
@@ -447,7 +447,7 @@ public class Arithmetic extends Constant
    *
    * @param k must hold <tt>k &gt;= 0 && k &lt; 21</tt>.
    */
-  public static long longFactorial(int k) throws IllegalArgumentException {
+  public static long longFactorial(int k) {
     if (k < 0) {
       throw new IllegalArgumentException("Negative k");
     }

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/Arrays.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/Arrays.java?rev=1352052&r1=1352051&r2=1352052&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/Arrays.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/Arrays.java Wed Jun 20 12:07:50 2012
@@ -601,62 +601,62 @@ public final class Arrays {
    * {@link java.util.Arrays#copyOf} compatibility with Java 1.5.
    */
   public static byte[] copyOf(byte[] src, int length) {
-      byte[] result = new byte [length];
-      System.arraycopy(src, 0, result, 0, Math.min(length, src.length));
-      return result;
+    byte[] result = new byte [length];
+    System.arraycopy(src, 0, result, 0, Math.min(length, src.length));
+    return result;
   }
   
   /**
    * {@link java.util.Arrays#copyOf} compatibility with Java 1.5.
    */
   public static char[] copyOf(char[] src, int length) {
-      char[] result = new char [length];
-      System.arraycopy(src, 0, result, 0, Math.min(length, src.length));
-      return result;
+    char[] result = new char [length];
+    System.arraycopy(src, 0, result, 0, Math.min(length, src.length));
+    return result;
   }
   
   /**
    * {@link java.util.Arrays#copyOf} compatibility with Java 1.5.
    */
   public static short[] copyOf(short[] src, int length) {
-      short[] result = new short [length];
-      System.arraycopy(src, 0, result, 0, Math.min(length, src.length));
-      return result;
+    short[] result = new short [length];
+    System.arraycopy(src, 0, result, 0, Math.min(length, src.length));
+    return result;
   }
   
   /**
    * {@link java.util.Arrays#copyOf} compatibility with Java 1.5. 
    */
   public static int[] copyOf(int[] src, int length) {
-      int[] result = new int [length];
-      System.arraycopy(src, 0, result, 0, Math.min(length, src.length));
-      return result;
+    int[] result = new int [length];
+    System.arraycopy(src, 0, result, 0, Math.min(length, src.length));
+    return result;
   }
   
   /**
    * {@link java.util.Arrays#copyOf} compatibility with Java 1.5.
    */
   public static float[] copyOf(float[] src, int length) {
-      float[] result = new float [length];
-      System.arraycopy(src, 0, result, 0, Math.min(length, src.length));
-      return result;
+    float[] result = new float [length];
+    System.arraycopy(src, 0, result, 0, Math.min(length, src.length));
+    return result;
   }
 
   /**
    * {@link java.util.Arrays#copyOf} compatibility with Java 1.5.
    */
   public static double[] copyOf(double[] src, int length) {
-      double[] result = new double [length];
-      System.arraycopy(src, 0, result, 0, Math.min(length, src.length));
-      return result;
+    double[] result = new double [length];
+    System.arraycopy(src, 0, result, 0, Math.min(length, src.length));
+    return result;
   }
   
   /**
    * {@link java.util.Arrays#copyOf} compatibility with Java 1.5.
    */
   public static long[] copyOf(long[] src, int length) {
-      long[] result = new long [length];
-      System.arraycopy(src, 0, result, 0, Math.min(length, src.length));
-      return result;
+    long[] result = new long [length];
+    System.arraycopy(src, 0, result, 0, Math.min(length, src.length));
+    return result;
   }
 }

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/PersistentObject.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/PersistentObject.java?rev=1352052&r1=1352051&r2=1352052&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/PersistentObject.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/PersistentObject.java Wed Jun 20 12:07:50 2012
@@ -28,9 +28,12 @@ package org.apache.mahout.math;
 
 /**
  * This empty class is the common root for all persistent capable classes.
- * If this class inherits from <tt>java.lang.Object</tt> then all subclasses are serializable with the standard Java serialization mechanism.
- * If this class inherits from <tt>com.objy.db.app.ooObj</tt> then all subclasses are <i>additionally</i> serializable with the Objectivity ODBMS persistance mechanism.
- * Thus, by modifying the inheritance of this class the entire tree of subclasses can be switched to Objectivity compatibility (and back) with minimum effort.
+ * If this class inherits from <tt>java.lang.Object</tt> then all subclasses are serializable with
+ * the standard Java serialization mechanism.
+ * If this class inherits from <tt>com.objy.db.app.ooObj</tt> then all subclasses are
+ * <i>additionally</i> serializable with the Objectivity ODBMS persistance mechanism.
+ * Thus, by modifying the inheritance of this class the entire tree of subclasses can
+ * be switched to Objectivity compatibility (and back) with minimum effort.
  */
 public abstract class PersistentObject implements java.io.Serializable, Cloneable {
 

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/SequentialAccessSparseVector.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/SequentialAccessSparseVector.java?rev=1352052&r1=1352051&r2=1352052&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/SequentialAccessSparseVector.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/SequentialAccessSparseVector.java Wed Jun 20 12:07:50 2012
@@ -88,7 +88,7 @@ public class SequentialAccessSparseVecto
     OrderedElement[] sortableElements = new OrderedElement[elementCount];
     Iterator<Element> it = other.iterateNonZero();
     Element e;
-    int s=0;
+    int s = 0;
     while (it.hasNext() && (e = it.next()) != null) {
       sortableElements[s++] = new OrderedElement(e.index(), e.get());
     }

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/SingularValueDecomposition.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/SingularValueDecomposition.java?rev=1352052&r1=1352051&r2=1352052&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/SingularValueDecomposition.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/SingularValueDecomposition.java Wed Jun 20 12:07:50 2012
@@ -37,7 +37,7 @@ public class SingularValueDecomposition 
   private final int n;
   
   /**To handle the case where numRows() < numCols() and to use the fact that SVD(A')=VSU'=> SVD(A')'=SVD(A)**/
-  private boolean transpositionNeeded = false;
+  private boolean transpositionNeeded;
   
   /**
    * Constructs and returns a new singular value decomposition object; The

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/Sorting.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/Sorting.java?rev=1352052&r1=1352051&r2=1352052&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/Sorting.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/Sorting.java Wed Jun 20 12:07:50 2012
@@ -19,6 +19,7 @@ package org.apache.mahout.math;
 
 import java.util.Comparator;
 
+import com.google.common.base.Preconditions;
 import org.apache.mahout.math.function.ByteComparator;
 import org.apache.mahout.math.function.CharComparator;
 import org.apache.mahout.math.function.DoubleComparator;
@@ -54,8 +55,7 @@ public final class Sorting {
    * @return the non-negative index of the element, or a negative index which is
    *         {@code -index - 1} where the element would be inserted.
    */
-  public static int binarySearchFromTo(byte[] array, byte value, int from,
-      int to) {
+  public static int binarySearchFromTo(byte[] array, byte value, int from, int to) {
     int mid = -1;
     while (from <= to) {
       mid = (from + to) >>> 1;
@@ -91,8 +91,7 @@ public final class Sorting {
    * @return the non-negative index of the element, or a negative index which is
    *         {@code -index - 1} where the element would be inserted.
    */
-  public static int binarySearchFromTo(char[] array, char value, int from,
-      int to) {
+  public static int binarySearchFromTo(char[] array, char value, int from, int to) {
     int mid = -1;
     while (from <= to) {
       mid = (from + to) >>> 1;
@@ -127,8 +126,7 @@ public final class Sorting {
    * @return the non-negative index of the element, or a negative index which is
    *         {@code -index - 1} where the element would be inserted.
    */
-  public static int binarySearchFromTo(double[] array, double value, int from,
-      int to) {
+  public static int binarySearchFromTo(double[] array, double value, int from, int to) {
     long longBits = Double.doubleToLongBits(value);
     int mid = -1;
     while (from <= to) {
@@ -164,8 +162,7 @@ public final class Sorting {
    * @return the non-negative index of the element, or a negative index which is
    *         {@code -index - 1} where the element would be inserted.
    */
-  public static int binarySearchFromTo(float[] array, float value, int from,
-      int to) {
+  public static int binarySearchFromTo(float[] array, float value, int from, int to) {
     int intBits = Float.floatToIntBits(value);
     int mid = -1;
     while (from <= to) {
@@ -272,13 +269,13 @@ public final class Sorting {
    *         {@code -index - 1} where the element would be inserted.
    * 
    */
-  public static <T extends Comparable<T>> int binarySearchFromTo(T[] array,
-      T object, int from, int to) {
+  public static <T extends Comparable<T>> int binarySearchFromTo(T[] array, T object, int from, int to) {
     if (array.length == 0) {
       return -1;
     }
     
-    int mid = 0, result = 0;
+    int mid = 0;
+    int result = 0;
     while (from <= to) {
       mid = (from + to) >>> 1;
       if ((result = array[mid].compareTo(object)) < 0) {
@@ -311,9 +308,9 @@ public final class Sorting {
    *          the {@code Comparator} used to compare the elements.
    * @return the non-negative index of the element, or a negative index which
    */
-  public static <T> int binarySearchFromTo(T[] array, T object, int from,
-      int to, Comparator<? super T> comparator) {
-    int mid = 0, result = 0;
+  public static <T> int binarySearchFromTo(T[] array, T object, int from, int to, Comparator<? super T> comparator) {
+    int mid = 0;
+    int result = 0;
     while (from <= to) {
       mid = (from + to) >>> 1;
       if ((result = comparator.compare(array[mid], object)) < 0) {
@@ -380,7 +377,8 @@ public final class Sorting {
     // NaNs are equal to other NaNs and larger than any other double.
     if (Double.isNaN(double1)) {
       return false;
-    } else if (Double.isNaN(double2)) {
+    }
+    if (Double.isNaN(double2)) {
       return true;
     }
     
@@ -407,7 +405,8 @@ public final class Sorting {
     // NaNs are equal to other NaNs and larger than any other float
     if (Float.isNaN(float1)) {
       return false;
-    } else if (Float.isNaN(float2)) {
+    }
+    if (Float.isNaN(float2)) {
       return true;
     }
     
@@ -418,7 +417,9 @@ public final class Sorting {
   }
   
   private static <T> int med3(T[] array, int a, int b, int c, Comparator<T> comp) {
-    T x = array[a], y = array[b], z = array[c];
+    T x = array[a];
+    T y = array[b];
+    T z = array[c];
     int comparisonxy = comp.compare(x, y);
     int comparisonxz = comp.compare(x, z);
     int comparisonyz = comp.compare(y, z);
@@ -428,7 +429,9 @@ public final class Sorting {
   }
   
   private static int med3(byte[] array, int a, int b, int c, ByteComparator comp) {
-    byte x = array[a], y = array[b], z = array[c];
+    byte x = array[a];
+    byte y = array[b];
+    byte z = array[c];
     int comparisonxy = comp.compare(x, y);
     int comparisonxz = comp.compare(x, z);
     int comparisonyz = comp.compare(y, z);
@@ -438,7 +441,9 @@ public final class Sorting {
   }
   
   private static int med3(char[] array, int a, int b, int c, CharComparator comp) {
-    char x = array[a], y = array[b], z = array[c];
+    char x = array[a];
+    char y = array[b];
+    char z = array[c];
     int comparisonxy = comp.compare(x, y);
     int comparisonxz = comp.compare(x, z);
     int comparisonyz = comp.compare(y, z);
@@ -449,7 +454,9 @@ public final class Sorting {
   
   private static int med3(double[] array, int a, int b, int c,
       DoubleComparator comp) {
-    double x = array[a], y = array[b], z = array[c];
+    double x = array[a];
+    double y = array[b];
+    double z = array[c];
     int comparisonxy = comp.compare(x, y);
     int comparisonxz = comp.compare(x, z);
     int comparisonyz = comp.compare(y, z);
@@ -460,7 +467,9 @@ public final class Sorting {
   
   private static int med3(float[] array, int a, int b, int c,
       FloatComparator comp) {
-    float x = array[a], y = array[b], z = array[c];
+    float x = array[a];
+    float y = array[b];
+    float z = array[c];
     int comparisonxy = comp.compare(x, y);
     int comparisonxz = comp.compare(x, z);
     int comparisonyz = comp.compare(y, z);
@@ -470,7 +479,9 @@ public final class Sorting {
   }
   
   private static int med3(int[] array, int a, int b, int c, IntComparator comp) {
-    int x = array[a], y = array[b], z = array[c];
+    int x = array[a];
+    int y = array[b];
+    int z = array[c];
     int comparisonxy = comp.compare(x, y);
     int comparisonxz = comp.compare(x, z);
     int comparisonyz = comp.compare(y, z);
@@ -498,7 +509,9 @@ public final class Sorting {
   }
   
   private static int med3(long[] array, int a, int b, int c, LongComparator comp) {
-    long x = array[a], y = array[b], z = array[c];
+    long x = array[a];
+    long y = array[b];
+    long z = array[c];
     int comparisonxy = comp.compare(x, y);
     int comparisonxz = comp.compare(x, z);
     int comparisonyz = comp.compare(y, z);
@@ -509,7 +522,9 @@ public final class Sorting {
   
   private static int med3(short[] array, int a, int b, int c,
       ShortComparator comp) {
-    short x = array[a], y = array[b], z = array[c];
+    short x = array[a];
+    short y = array[b];
+    short z = array[c];
     int comparisonxy = comp.compare(x, y);
     int comparisonxz = comp.compare(x, z);
     int comparisonyz = comp.compare(y, z);
@@ -536,9 +551,7 @@ public final class Sorting {
    */
   public static void quickSort(byte[] array, int start, int end,
       ByteComparator comp) {
-    if (array == null) {
-      throw new NullPointerException();
-    }
+    Preconditions.checkNotNull(array);
     checkBounds(array.length, start, end);
     quickSort0(start, end, array, comp);
   }
@@ -559,8 +572,7 @@ public final class Sorting {
     }
   }
   
-  private static void quickSort0(int start, int end, byte[] array,
-      ByteComparator comp) {
+  private static void quickSort0(int start, int end, byte[] array, ByteComparator comp) {
     byte temp;
     int length = end - start;
     if (length < 7) {
@@ -587,9 +599,10 @@ public final class Sorting {
       middle = med3(array, bottom, middle, top, comp);
     }
     byte partionValue = array[middle];
-    int a, b, c, d;
-    a = b = start;
-    c = d = end - 1;
+    int a = start;
+    int b = a;
+    int c = end - 1;
+    int d = c;
     while (true) {
       int comparison;
       while (b <= c && (comparison = comp.compare(array[b], partionValue)) <= 0) {
@@ -683,9 +696,10 @@ public final class Sorting {
     int partitionIndex = middle; // an index, not a value.
     
     // regions from a to b and from c to d are what we will recursively sort
-    int a, b, c, d;
-    a = b = start;
-    c = d = end - 1;
+    int a = start;
+    int b = a;
+    int c = end - 1;
+    int d = c;
     while (b <= c) {
       // copy all values equal to the partition value to before a..b.  In the process, advance b
       // as long as values less than the partition or equal are found, also stop when a..b collides with c..d
@@ -805,9 +819,7 @@ public final class Sorting {
    */
   public static void quickSort(char[] array, int start, int end,
       CharComparator comp) {
-    if (array == null) {
-      throw new NullPointerException();
-    }
+    Preconditions.checkNotNull(array);
     checkBounds(array.length, start, end);
     quickSort0(start, end, array, comp);
   }
@@ -840,9 +852,10 @@ public final class Sorting {
       middle = med3(array, bottom, middle, top, comp);
     }
     char partionValue = array[middle];
-    int a, b, c, d;
-    a = b = start;
-    c = d = end - 1;
+    int a = start;
+    int b = a;
+    int c = end - 1;
+    int d = c;
     while (true) {
       int comparison;
       while (b <= c && (comparison = comp.compare(array[b], partionValue)) <= 0) {
@@ -911,9 +924,7 @@ public final class Sorting {
    */
   public static void quickSort(double[] array, int start, int end,
       DoubleComparator comp) {
-    if (array == null) {
-      throw new NullPointerException();
-    }
+    Preconditions.checkNotNull(array);
     checkBounds(array.length, start, end);
     quickSort0(start, end, array, comp);
   }
@@ -946,9 +957,10 @@ public final class Sorting {
       middle = med3(array, bottom, middle, top, comp);
     }
     double partionValue = array[middle];
-    int a, b, c, d;
-    a = b = start;
-    c = d = end - 1;
+    int a = start;
+    int b = a;
+    int c = end - 1;
+    int d = c;
     while (true) {
       int comparison;
       while (b <= c && (comparison = comp.compare(partionValue, array[b])) >= 0) {
@@ -1016,9 +1028,7 @@ public final class Sorting {
    */
   public static void quickSort(float[] array, int start, int end,
       FloatComparator comp) {
-    if (array == null) {
-      throw new NullPointerException();
-    }
+    Preconditions.checkNotNull(array);
     checkBounds(array.length, start, end);
     quickSort0(start, end, array, comp);
   }
@@ -1051,9 +1061,10 @@ public final class Sorting {
       middle = med3(array, bottom, middle, top, comp);
     }
     float partionValue = array[middle];
-    int a, b, c, d;
-    a = b = start;
-    c = d = end - 1;
+    int a = start;
+    int b = a;
+    int c = end - 1;
+    int d = c;
     while (true) {
       int comparison;
       while (b <= c && (comparison = comp.compare(partionValue, array[b])) >= 0) {
@@ -1121,9 +1132,7 @@ public final class Sorting {
    */
   public static void quickSort(int[] array, int start, int end,
       IntComparator comp) {
-    if (array == null) {
-      throw new NullPointerException();
-    }
+    Preconditions.checkNotNull(array);
     checkBounds(array.length, start, end);
     quickSort0(start, end, array, comp);
   }
@@ -1156,9 +1165,10 @@ public final class Sorting {
       middle = med3(array, bottom, middle, top, comp);
     }
     int partionValue = array[middle];
-    int a, b, c, d;
-    a = b = start;
-    c = d = end - 1;
+    int a = start;
+    int b = a;
+    int c = end - 1;
+    int d = c;
     while (true) {
       int comparison;
       while (b <= c && (comparison = comp.compare(array[b], partionValue)) <= 0) {
@@ -1226,9 +1236,7 @@ public final class Sorting {
    */
   public static void quickSort(long[] array, int start, int end,
       LongComparator comp) {
-    if (array == null) {
-      throw new NullPointerException();
-    }
+    Preconditions.checkNotNull(array);
     checkBounds(array.length, start, end);
     quickSort0(start, end, array, comp);
   }
@@ -1261,9 +1269,10 @@ public final class Sorting {
       middle = med3(array, bottom, middle, top, comp);
     }
     long partionValue = array[middle];
-    int a, b, c, d;
-    a = b = start;
-    c = d = end - 1;
+    int a = start;
+    int b = a;
+    int c = end - 1;
+    int d = c;
     while (true) {
       int comparison;
       while (b <= c && (comparison = comp.compare(array[b], partionValue)) <= 0) {
@@ -1331,9 +1340,7 @@ public final class Sorting {
    */
   public static <T> void quickSort(T[] array, int start, int end,
       Comparator<T> comp) {
-    if (array == null) {
-      throw new NullPointerException();
-    }
+    Preconditions.checkNotNull(array);
     checkBounds(array.length, start, end);
     quickSort0(start, end, array, comp);
   }
@@ -1389,9 +1396,10 @@ public final class Sorting {
       middle = med3(array, bottom, middle, top, comp);
     }
     T partionValue = array[middle];
-    int a, b, c, d;
-    a = b = start;
-    c = d = end - 1;
+    int a = start;
+    int b = a;
+    int c = end - 1;
+    int d = c;
     while (true) {
       int comparison;
       while (b <= c && (comparison = comp.compare(array[b], partionValue)) <= 0) {
@@ -1457,9 +1465,7 @@ public final class Sorting {
    */
   public static void quickSort(short[] array, int start, int end,
       ShortComparator comp) {
-    if (array == null) {
-      throw new NullPointerException();
-    }
+    Preconditions.checkNotNull(array);
     checkBounds(array.length, start, end);
     quickSort0(start, end, array, comp);
   }
@@ -1492,9 +1498,10 @@ public final class Sorting {
       middle = med3(array, bottom, middle, top, comp);
     }
     short partionValue = array[middle];
-    int a, b, c, d;
-    a = b = start;
-    c = d = end - 1;
+    int a = start;
+    int b = a;
+    int c = end - 1;
+    int d = c;
     while (true) {
       int comparison;
       while (b <= c && (comparison = comp.compare(array[b], partionValue)) < 0) {
@@ -1626,8 +1633,9 @@ public final class Sorting {
       System.arraycopy(in, start, out, start, len);
       return;
     }
-    int r = med, i = start;
-    
+    int r = med;
+    int i = start;
+
     // use merging with exponential search
     do {
       T fromVal = in[start];
@@ -1762,8 +1770,9 @@ public final class Sorting {
       System.arraycopy(in, start, out, start, len);
       return;
     }
-    int r = med, i = start;
-    
+    int r = med;
+    int i = start;
+
     // use merging with exponential search
     do {
       byte fromVal = in[start];
@@ -1878,8 +1887,9 @@ public final class Sorting {
       System.arraycopy(in, start, out, start, len);
       return;
     }
-    int r = med, i = start;
-    
+    int r = med;
+    int i = start;
+
     // use merging with exponential search
     do {
       char fromVal = in[start];
@@ -1995,8 +2005,9 @@ public final class Sorting {
       System.arraycopy(in, start, out, start, len);
       return;
     }
-    int r = med, i = start;
-    
+    int r = med;
+    int i = start;
+
     // use merging with exponential search
     do {
       short fromVal = in[start];
@@ -2112,8 +2123,9 @@ public final class Sorting {
       System.arraycopy(in, start, out, start, len);
       return;
     }
-    int r = med, i = start;
-    
+    int r = med;
+    int i = start;
+
     // use merging with exponential search
     do {
       int fromVal = in[start];
@@ -2229,8 +2241,9 @@ public final class Sorting {
       System.arraycopy(in, start, out, start, len);
       return;
     }
-    int r = med, i = start;
-    
+    int r = med;
+    int i = start;
+
     // use merging with exponential search
     do {
       long fromVal = in[start];
@@ -2345,8 +2358,9 @@ public final class Sorting {
       System.arraycopy(in, start, out, start, len);
       return;
     }
-    int r = med, i = start;
-    
+    int r = med;
+    int i = start;
+
     // use merging with exponential search
     do {
       float fromVal = in[start];
@@ -2462,8 +2476,9 @@ public final class Sorting {
       System.arraycopy(in, start, out, start, len);
       return;
     }
-    int r = med, i = start;
-    
+    int r = med;
+    int i = start;
+
     // use merging with exponential search
     do {
       double fromVal = in[start];
@@ -2521,11 +2536,11 @@ public final class Sorting {
   }
 
   /**
-   * Transforms two consecutive sorted ranges into a single sorted range.  The initial ranges are <code>[first,
-   * middle)</code> and <code>[middle, last)</code>, and the resulting range is <code>[first, last)</code>. Elements in
+   * Transforms two consecutive sorted ranges into a single sorted range.  The initial ranges are {@code [first,}
+   * middle)</code> and {@code [middle, last)}, and the resulting range is {@code [first, last)}. Elements in
    * the first input range will precede equal elements in the second.
    */
-  static void inplace_merge(int first, int middle, int last, IntComparator comp, Swapper swapper) {
+  static void inplaceMerge(int first, int middle, int last, IntComparator comp, Swapper swapper) {
     if (first >= middle || middle >= last) {
       return;
     }
@@ -2539,10 +2554,10 @@ public final class Sorting {
     int secondCut;
     if (middle - first > last - middle) {
       firstCut = first + (middle - first) / 2;
-      secondCut = lower_bound(middle, last, firstCut, comp);
+      secondCut = lowerBound(middle, last, firstCut, comp);
     } else {
       secondCut = middle + (last - middle) / 2;
-      firstCut = upper_bound(first, middle, secondCut, comp);
+      firstCut = upperBound(first, middle, secondCut, comp);
     }
   
     // rotate(firstCut, middle, secondCut, swapper);
@@ -2572,8 +2587,8 @@ public final class Sorting {
     // end inline
   
     middle = firstCut + (secondCut - middle);
-    inplace_merge(first, firstCut, middle, comp, swapper);
-    inplace_merge(middle, secondCut, last, comp, swapper);
+    inplaceMerge(first, firstCut, middle, comp, swapper);
+    inplaceMerge(middle, secondCut, last, comp, swapper);
   }
 
   /**
@@ -2584,12 +2599,11 @@ public final class Sorting {
    * @param last  One past the end of the range.
    * @param x     Element to be searched for.
    * @param comp  Comparison function.
-   * @return The largest index i such that, for every j in the range <code>[first, i)</code>, <code>comp.apply(array[j],
-   *         x)</code> is <code>true</code>.
-   * @see Sorting#upper_bound
+   * @return The largest index i such that, for every j in the range <code>[first, i)</code>, {@code comp.apply(array[j],}
+   *         x)</code> is {@code true}.
+   * @see Sorting#upperBound
    */
-  static int lower_bound(int first, int last, int x, IntComparator comp) {
-    //if (comp==null) throw new NullPointerException();
+  static int lowerBound(int first, int last, int x, IntComparator comp) {
     int len = last - first;
     while (len > 0) {
       int half = len / 2;
@@ -2653,7 +2667,7 @@ public final class Sorting {
     }
   
     // Merge sorted halves
-    inplace_merge(fromIndex, mid, toIndex, c, swapper);
+    inplaceMerge(fromIndex, mid, toIndex, c, swapper);
   }
 
   /**
@@ -2664,12 +2678,11 @@ public final class Sorting {
    * @param last  One past the end of the range.
    * @param x     Element to be searched for.
    * @param comp  Comparison function.
-   * @return The largest index i such that, for every j in the range <code>[first, i)</code>, <code>comp.apply(x,
-   *         array[j])</code> is <code>false</code>.
-   * @see Sorting#lower_bound
+   * @return The largest index i such that, for every j in the range <code>[first, i)</code>, {@code comp.apply(x,}
+   *         array[j])</code> is {@code false}.
+   * @see Sorting#lowerBound
    */
-  static int upper_bound(int first, int last, int x, IntComparator comp) {
-    //if (comp==null) throw new NullPointerException();
+  static int upperBound(int first, int last, int x, IntComparator comp) {
     int len = last - first;
     while (len > 0) {
       int half = len / 2;

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/SparseColumnMatrix.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/SparseColumnMatrix.java?rev=1352052&r1=1352051&r2=1352052&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/SparseColumnMatrix.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/SparseColumnMatrix.java Wed Jun 20 12:07:50 2012
@@ -22,18 +22,18 @@ package org.apache.mahout.math;
  * SparseVectors.
  */
 public class SparseColumnMatrix extends AbstractMatrix {
+
   private Vector[] columnVectors;
 
   /**
    * Construct a matrix of the given cardinality with the given data columns
    *
-   * @param rows
    * @param columns     a RandomAccessSparseVector[] array of columns
    * @param columnVectors
    */
   public SparseColumnMatrix(int rows, int columns, RandomAccessSparseVector[] columnVectors) {
     super(rows, columns);
-    this.columnVectors = this.columnVectors.clone();
+    this.columnVectors = columnVectors.clone();
     for (int col = 0; col < columnSize(); col++) {
       this.columnVectors[col] = this.columnVectors[col].clone();
     }

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/als/AlternatingLeastSquaresSolver.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/als/AlternatingLeastSquaresSolver.java?rev=1352052&r1=1352051&r2=1352052&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/als/AlternatingLeastSquaresSolver.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/als/AlternatingLeastSquaresSolver.java Wed Jun 20 12:07:50 2012
@@ -32,7 +32,10 @@ import java.util.Iterator;
  */
 public final class AlternatingLeastSquaresSolver {
 
-  public Vector solve(Iterable<Vector> featureVectors, Vector ratingVector, double lambda, int numFeatures) {
+  private AlternatingLeastSquaresSolver() {
+  }
+
+  public static Vector solve(Iterable<Vector> featureVectors, Vector ratingVector, double lambda, int numFeatures) {
 
     Preconditions.checkNotNull(featureVectors, "Feature vectors cannot be null");
     Preconditions.checkArgument(!Iterables.isEmpty(featureVectors));
@@ -53,11 +56,11 @@ public final class AlternatingLeastSquar
     return solve(Ai, Vi);
   }
 
-  Vector solve(Matrix Ai, Matrix Vi) {
+  static Vector solve(Matrix Ai, Matrix Vi) {
     return new QRDecomposition(Ai).solve(Vi).viewColumn(0);
   }
 
-  Matrix addLambdaTimesNuiTimesE(Matrix matrix, double lambda, int nui) {
+  static Matrix addLambdaTimesNuiTimesE(Matrix matrix, double lambda, int nui) {
     Preconditions.checkArgument(matrix.numCols() == matrix.numRows());
     for (int n = 0; n < matrix.numCols(); n++) {
       matrix.setQuick(n, n, matrix.getQuick(n, n) + lambda * nui);
@@ -65,7 +68,7 @@ public final class AlternatingLeastSquar
     return matrix;
   }
 
-  Matrix createMiIi(Iterable<Vector> featureVectors, int numFeatures) {
+  static Matrix createMiIi(Iterable<Vector> featureVectors, int numFeatures) {
     Matrix MiIi = new DenseMatrix(numFeatures, Iterables.size(featureVectors));
     int n = 0;
     for (Vector featureVector : featureVectors) {
@@ -77,7 +80,7 @@ public final class AlternatingLeastSquar
     return MiIi;
   }
 
-  Matrix createRiIiMaybeTransposed(Vector ratingVector) {
+  static Matrix createRiIiMaybeTransposed(Vector ratingVector) {
     Preconditions.checkArgument(ratingVector.isSequentialAccess());
     Matrix RiIiMaybeTransposed = new DenseMatrix(ratingVector.getNumNondefaultElements(), 1);
     Iterator<Vector.Element> ratingsIterator = ratingVector.iterateNonZero();

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/als/ImplicitFeedbackAlternatingLeastSquaresSolver.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/als/ImplicitFeedbackAlternatingLeastSquaresSolver.java?rev=1352052&r1=1352051&r2=1352052&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/als/ImplicitFeedbackAlternatingLeastSquaresSolver.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/als/ImplicitFeedbackAlternatingLeastSquaresSolver.java Wed Jun 20 12:07:50 2012
@@ -45,11 +45,11 @@ public class ImplicitFeedbackAlternating
     this.lambda = lambda;
     this.alpha = alpha;
     this.Y = Y;
-    YtransposeY = YtransposeY(Y);
+    YtransposeY = getYtransposeY(Y);
   }
 
   public Vector solve(Vector ratings) {
-    return solve(YtransposeY.plus(YtransponseCuMinusIYPlusLambdaI(ratings)), YtransponseCuPu(ratings));
+    return solve(YtransposeY.plus(getYtransponseCuMinusIYPlusLambdaI(ratings)), getYtransponseCuPu(ratings));
   }
 
   private static Vector solve(Matrix A, Matrix y) {
@@ -61,7 +61,7 @@ public class ImplicitFeedbackAlternating
   }
 
   /* Y' Y */
-  private Matrix YtransposeY(OpenIntObjectHashMap<Vector> Y) {
+  private Matrix getYtransposeY(OpenIntObjectHashMap<Vector> Y) {
 
     Matrix compactedY = new DenseMatrix(Y.size(), numFeatures);
     IntArrayList indexes = Y.keys();
@@ -76,7 +76,7 @@ public class ImplicitFeedbackAlternating
   }
 
   /** Y' (Cu - I) Y + λ I */
-  private Matrix YtransponseCuMinusIYPlusLambdaI(Vector userRatings) {
+  private Matrix getYtransponseCuMinusIYPlusLambdaI(Vector userRatings) {
     Preconditions.checkArgument(userRatings.isSequentialAccess(), "need sequential access to ratings!");
 
     /* (Cu -I) Y */
@@ -108,7 +108,7 @@ public class ImplicitFeedbackAlternating
   }
 
   /** Y' Cu p(u) */
-  private Matrix YtransponseCuPu(Vector userRatings) {
+  private Matrix getYtransponseCuPu(Vector userRatings) {
     Preconditions.checkArgument(userRatings.isSequentialAccess(), "need sequential access to ratings!");
 
     Vector YtransponseCuPu = new DenseVector(numFeatures);

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/decomposer/lanczos/LanczosSolver.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/decomposer/lanczos/LanczosSolver.java?rev=1352052&r1=1352051&r2=1352052&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/decomposer/lanczos/LanczosSolver.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/decomposer/lanczos/LanczosSolver.java Wed Jun 20 12:07:50 2012
@@ -170,7 +170,7 @@ public class LanczosSolver {
     endTime(TimingSection.FINAL_EIGEN_CREATE);
   }
 
-  protected double calculateScaleFactor(Vector nextVector) {
+  protected static double calculateScaleFactor(Vector nextVector) {
     return nextVector.norm(2);
   }
 
@@ -178,7 +178,7 @@ public class LanczosSolver {
     return Double.isNaN(d) || d > SAFE_MAX || -d > SAFE_MAX;
   }
 
-  protected void orthoganalizeAgainstAllButLast(Vector nextVector, LanczosState state) {
+  protected static void orthoganalizeAgainstAllButLast(Vector nextVector, LanczosState state) {
     for (int i = 0; i < state.getIterationNumber(); i++) {
       Vector basisVector = state.getBasisVector(i);
       double alpha;

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/list/AbstractList.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/list/AbstractList.java?rev=1352052&r1=1352051&r2=1352052&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/list/AbstractList.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/list/AbstractList.java Wed Jun 20 12:07:50 2012
@@ -37,16 +37,18 @@ package org.apache.mahout.math.list;
 import org.apache.mahout.math.PersistentObject;
 
 /**
- Abstract base class for resizable lists holding objects or primitive data types such as <code>int</code>, <code>float</code>, etc.
- First see the <a href="package-summary.html">package summary</a> and javadoc <a href="package-tree.html">tree view</a> to get the broad picture.
- <p>
- <b>Note that this implementation is not synchronized.</b>
-
- @author wolfgang.hoschek@cern.ch
- @version 1.0, 09/24/99
- @see     java.util.ArrayList
- @see      java.util.Vector
- @see      java.util.Arrays
+ * Abstract base class for resizable lists holding objects or primitive data types such as
+ * {@code int}, {@code float}, etc.
+ * First see the <a href="package-summary.html">package summary</a> and javadoc
+ * <a href="package-tree.html">tree view</a> to get the broad picture.
+ * <p>
+ * <b>Note that this implementation is not synchronized.</b>
+ *
+ * @author wolfgang.hoschek@cern.ch
+ * @version 1.0, 09/24/99
+ * @see     java.util.ArrayList
+ * @see      java.util.Vector
+ * @see      java.util.Arrays
  */
 public abstract class AbstractList extends PersistentObject {
   

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/list/ObjectArrayList.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/list/ObjectArrayList.java?rev=1352052&r1=1352051&r2=1352052&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/list/ObjectArrayList.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/list/ObjectArrayList.java Wed Jun 20 12:07:50 2012
@@ -177,6 +177,7 @@ public class ObjectArrayList<T> extends 
    * @param otherObj the Object to be compared for equality with the receiver.
    * @return true if the specified Object is equal to the receiver.
    */
+  @Override
   @SuppressWarnings("unchecked")
   public boolean equals(Object otherObj) { //delta
     // overridden for performance only.

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/list/SimpleLongArrayList.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/list/SimpleLongArrayList.java?rev=1352052&r1=1352051&r2=1352052&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/list/SimpleLongArrayList.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/list/SimpleLongArrayList.java Wed Jun 20 12:07:50 2012
@@ -44,7 +44,6 @@ public class SimpleLongArrayList extends
    *                        internal memory.
    */
   private SimpleLongArrayList(int initialCapacity) {
-    super();
     if (initialCapacity < 0) {
       throw new IllegalArgumentException("Illegal Capacity: " + initialCapacity);
     }

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/map/PrimeFinder.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/map/PrimeFinder.java?rev=1352052&r1=1352051&r2=1352052&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/map/PrimeFinder.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/map/PrimeFinder.java Wed Jun 20 12:07:50 2012
@@ -62,56 +62,56 @@ public class PrimeFinder {
    */
 
   private static final int[] primeCapacities = {
-      //chunk #0
-      largestPrime,
+    //chunk #0
+    largestPrime,
 
-      //chunk #1
-      5, 11, 23, 47, 97, 197, 397, 797, 1597, 3203, 6421, 12853, 25717, 51437, 102877, 205759,
-      411527, 823117, 1646237, 3292489, 6584983, 13169977, 26339969, 52679969, 105359939,
-      210719881, 421439783, 842879579, 1685759167,
-
-      //chunk #2
-      433, 877, 1759, 3527, 7057, 14143, 28289, 56591, 113189, 226379, 452759, 905551, 1811107,
-      3622219, 7244441, 14488931, 28977863, 57955739, 115911563, 231823147, 463646329, 927292699,
-      1854585413,
-
-      //chunk #3
-      953, 1907, 3821, 7643, 15287, 30577, 61169, 122347, 244703, 489407, 978821, 1957651, 3915341,
-      7830701, 15661423, 31322867, 62645741, 125291483, 250582987, 501165979, 1002331963,
-      2004663929,
-
-      //chunk #4
-      1039, 2081, 4177, 8363, 16729, 33461, 66923, 133853, 267713, 535481, 1070981, 2141977, 4283963,
-      8567929, 17135863, 34271747, 68543509, 137087021, 274174111, 548348231, 1096696463,
-
-      //chunk #5
-      31, 67, 137, 277, 557, 1117, 2237, 4481, 8963, 17929, 35863, 71741, 143483, 286973, 573953,
-      1147921, 2295859, 4591721, 9183457, 18366923, 36733847, 73467739, 146935499, 293871013,
-      587742049, 1175484103,
-
-      //chunk #6
-      599, 1201, 2411, 4831, 9677, 19373, 38747, 77509, 155027, 310081, 620171, 1240361, 2480729,
-      4961459, 9922933, 19845871, 39691759, 79383533, 158767069, 317534141, 635068283, 1270136683,
-
-      //chunk #7
-      311, 631, 1277, 2557, 5119, 10243, 20507, 41017, 82037, 164089, 328213, 656429, 1312867,
-      2625761, 5251529, 10503061, 21006137, 42012281, 84024581, 168049163, 336098327, 672196673,
-      1344393353,
-
-      //chunk #8
-      3, 7, 17, 37, 79, 163, 331, 673, 1361, 2729, 5471, 10949, 21911, 43853, 87719, 175447, 350899,
-      701819, 1403641, 2807303, 5614657, 11229331, 22458671, 44917381, 89834777, 179669557,
-      359339171, 718678369, 1437356741,
-
-      //chunk #9
-      43, 89, 179, 359, 719, 1439, 2879, 5779, 11579, 23159, 46327, 92657, 185323, 370661, 741337,
-      1482707, 2965421, 5930887, 11861791, 23723597, 47447201, 94894427, 189788857, 379577741,
-      759155483, 1518310967,
-
-      //chunk #10
-      379, 761, 1523, 3049, 6101, 12203, 24407, 48817, 97649, 195311, 390647, 781301, 1562611,
-      3125257, 6250537, 12501169, 25002389, 50004791, 100009607, 200019221, 400038451, 800076929,
-      1600153859
+    //chunk #1
+    5, 11, 23, 47, 97, 197, 397, 797, 1597, 3203, 6421, 12853, 25717, 51437, 102877, 205759,
+    411527, 823117, 1646237, 3292489, 6584983, 13169977, 26339969, 52679969, 105359939,
+    210719881, 421439783, 842879579, 1685759167,
+
+    //chunk #2
+    433, 877, 1759, 3527, 7057, 14143, 28289, 56591, 113189, 226379, 452759, 905551, 1811107,
+    3622219, 7244441, 14488931, 28977863, 57955739, 115911563, 231823147, 463646329, 927292699,
+    1854585413,
+
+    //chunk #3
+    953, 1907, 3821, 7643, 15287, 30577, 61169, 122347, 244703, 489407, 978821, 1957651, 3915341,
+    7830701, 15661423, 31322867, 62645741, 125291483, 250582987, 501165979, 1002331963,
+    2004663929,
+
+    //chunk #4
+    1039, 2081, 4177, 8363, 16729, 33461, 66923, 133853, 267713, 535481, 1070981, 2141977, 4283963,
+    8567929, 17135863, 34271747, 68543509, 137087021, 274174111, 548348231, 1096696463,
+
+    //chunk #5
+    31, 67, 137, 277, 557, 1117, 2237, 4481, 8963, 17929, 35863, 71741, 143483, 286973, 573953,
+    1147921, 2295859, 4591721, 9183457, 18366923, 36733847, 73467739, 146935499, 293871013,
+    587742049, 1175484103,
+
+    //chunk #6
+    599, 1201, 2411, 4831, 9677, 19373, 38747, 77509, 155027, 310081, 620171, 1240361, 2480729,
+    4961459, 9922933, 19845871, 39691759, 79383533, 158767069, 317534141, 635068283, 1270136683,
+
+    //chunk #7
+    311, 631, 1277, 2557, 5119, 10243, 20507, 41017, 82037, 164089, 328213, 656429, 1312867,
+    2625761, 5251529, 10503061, 21006137, 42012281, 84024581, 168049163, 336098327, 672196673,
+    1344393353,
+
+    //chunk #8
+    3, 7, 17, 37, 79, 163, 331, 673, 1361, 2729, 5471, 10949, 21911, 43853, 87719, 175447, 350899,
+    701819, 1403641, 2807303, 5614657, 11229331, 22458671, 44917381, 89834777, 179669557,
+    359339171, 718678369, 1437356741,
+
+    //chunk #9
+    43, 89, 179, 359, 719, 1439, 2879, 5779, 11579, 23159, 46327, 92657, 185323, 370661, 741337,
+    1482707, 2965421, 5930887, 11861791, 23723597, 47447201, 94894427, 189788857, 379577741,
+    759155483, 1518310967,
+
+    //chunk #10
+    379, 761, 1523, 3049, 6101, 12203, 24407, 48817, 97649, 195311, 390647, 781301, 1562611,
+    3125257, 6250537, 12501169, 25002389, 50004791, 100009607, 200019221, 400038451, 800076929,
+    1600153859
   };
 
 
@@ -127,8 +127,8 @@ public class PrimeFinder {
   }
 
   /**
-   * Returns a prime number which is <code>&gt;= desiredCapacity</code> and very close to <code>desiredCapacity</code>
-   * (within 11% if <code>desiredCapacity &gt;= 1000</code>).
+   * Returns a prime number which is {@code <= desiredCapacity} and very close to {@code desiredCapacity}
+   * (within 11% if {@code desiredCapacity <= 1000}).
    *
    * @param desiredCapacity the capacity desired by the user.
    * @return the capacity which should be used for a hashtable.
@@ -142,32 +142,4 @@ public class PrimeFinder {
     return primeCapacities[i];
   }
 
-  /** Tests correctness. */
-  private static void statistics(int from, int to) {
-    // check that primes contain no accidental errors
-    for (int i = 0; i < primeCapacities.length - 1; i++) {
-      if (primeCapacities[i] >= primeCapacities[i + 1]) {
-        throw new IllegalStateException(
-            "primes are unsorted or contain duplicates; detected at " + i + '@' + primeCapacities[i]);
-      }
-    }
-
-    double accDeviation = 0.0;
-    double maxDeviation = -1.0;
-
-    for (int i = from; i <= to; i++) {
-      int primeCapacity = nextPrime(i);
-      //log.info(primeCapacity);
-      double deviation = (primeCapacity - i) / (double) i;
-
-      if (deviation > maxDeviation) {
-        maxDeviation = deviation;
-      }
-
-      accDeviation += deviation;
-    }
-    long width = 1 + (long) to - (long) from;
-
-    double meanDeviation = accDeviation / width;
-  }
 }

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/set/OpenHashSet.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/set/OpenHashSet.java?rev=1352052&r1=1352051&r2=1352052&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/set/OpenHashSet.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/set/OpenHashSet.java Wed Jun 20 12:07:50 2012
@@ -432,6 +432,7 @@ public class OpenHashSet<T> extends Abst
    * any other collection. Hypothetically, we should check for and permit
    * equals on other Sets.
    */
+  @Override
   @SuppressWarnings("unchecked")
   public boolean equals(Object obj) {
     if (obj == this) {
@@ -524,10 +525,8 @@ public class OpenHashSet<T> extends Abst
   }
 
   @Override
-  public <T2> T2[] toArray(T2[] a) {
-    List<T> keys = new ArrayList<T>();
-    keys(keys);
-    return keys.toArray(a);
+  public <T> T[] toArray(T[] a) {
+    return keys().toArray(a);
   }
 
   public List<T> keys() {