mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sro...@apache.org
Subject svn commit: r1489707 [2/2] - in /mahout/trunk: core/src/main/java/org/apache/mahout/cf/taste/hadoop/als/ core/src/main/java/org/apache/mahout/cf/taste/hadoop/slopeone/ core/src/main/java/org/apache/mahout/cf/taste/impl/similarity/precompute/ core/src/m...
Date Wed, 05 Jun 2013 05:20:36 GMT
Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/kddcup/track1/svd/ParallelArraysSGDFactorizer.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/kddcup/track1/svd/ParallelArraysSGDFactorizer.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/kddcup/track1/svd/ParallelArraysSGDFactorizer.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/kddcup/track1/svd/ParallelArraysSGDFactorizer.java Wed Jun  5 05:20:34 2013
@@ -199,12 +199,12 @@ public class ParallelArraysSGDFactorizer
   }
 
   private double trainingIterationWithRmse(int feature) {
-    double rmse = 0;
+    double rmse = 0.0;
     for (int index = 0; index < userIndexes.length; index++) {
       double error = train(userIndexes[index], itemIndexes[index], feature, values[index], cachedEstimates[index]);
       rmse += error * error;
     }
-    return Math.sqrt(rmse / (double) userIndexes.length);
+    return Math.sqrt(rmse / userIndexes.length);
   }
 
   private double estimate(int userIndex, int itemIndex, int feature, double cachedEstimate, boolean trailing) {

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/kddcup/track2/TrackItemSimilarity.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/kddcup/track2/TrackItemSimilarity.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/kddcup/track2/TrackItemSimilarity.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/kddcup/track2/TrackItemSimilarity.java Wed Jun  5 05:20:34 2013
@@ -72,7 +72,7 @@ final class TrackItemSimilarity implemen
       return 0.0;
     }
     int unionSize = genres1.size() + genres2.size() - intersectionSize;
-    return (double) intersectionSize / (4.0 * unionSize);
+    return intersectionSize / (4.0 * unionSize);
   }
 
   @Override

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sequencelearning/hmm/PosTagger.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sequencelearning/hmm/PosTagger.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sequencelearning/hmm/PosTagger.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sequencelearning/hmm/PosTagger.java Wed Jun  5 05:20:34 2013
@@ -193,7 +193,7 @@ public final class PosTagger {
     // than anything else
     Matrix emissions = taggingModel.getEmissionMatrix();
     for (int i = 0; i < taggingModel.getNrOfHiddenStates(); ++i) {
-      emissions.setQuick(i, 0, 0.1 / (double) taggingModel.getNrOfHiddenStates());
+      emissions.setQuick(i, 0, 0.1 / taggingModel.getNrOfHiddenStates());
     }
     int nnptag = tagIDs.get("NNP");
     emissions.setQuick(nnptag, 0, 1 / (double) taggingModel.getNrOfHiddenStates());
@@ -234,7 +234,7 @@ public final class PosTagger {
     end = System.currentTimeMillis();
     duration = (end - start) / 1000.0;
     log.info("POS tagged test file in {} seconds!", duration);
-    double errorRate = (double) errorCount / (double) totalCount;
+    double errorRate = (double) errorCount / totalCount;
     log.info("Tagged the test file with an error rate of: {}", errorRate);
   }
 

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/fuzzykmeans/Job.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/fuzzykmeans/Job.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/fuzzykmeans/Job.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/fuzzykmeans/Job.java Wed Jun  5 05:20:34 2013
@@ -59,7 +59,7 @@ public final class Job extends AbstractJ
       Path output = new Path("output");
       Configuration conf = new Configuration();
       HadoopUtil.delete(conf, output);
-      run(conf, new Path("testdata"), output, new EuclideanDistanceMeasure(), 80, 55, 10, (float) 2, 0.5);
+      run(conf, new Path("testdata"), output, new EuclideanDistanceMeasure(), 80, 55, 10, 2.0f, 0.5);
     }
   }
   

Modified: mahout/trunk/integration/src/main/java/org/apache/mahout/benchmark/BenchmarkRunner.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/main/java/org/apache/mahout/benchmark/BenchmarkRunner.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/integration/src/main/java/org/apache/mahout/benchmark/BenchmarkRunner.java (original)
+++ mahout/trunk/integration/src/main/java/org/apache/mahout/benchmark/BenchmarkRunner.java Wed Jun  5 05:20:34 2013
@@ -20,7 +20,7 @@ public final class BenchmarkRunner {
     leadTimeUsec = TimeUnit.MILLISECONDS.toNanos(leadTimeMs);
   }
 
-  public static abstract class BenchmarkFn implements Function<Integer, Boolean> {
+  public abstract static class BenchmarkFn implements Function<Integer, Boolean> {
     protected int randIndex() {
       return BenchmarkRunner.randIndex();
     }
@@ -37,7 +37,7 @@ public final class BenchmarkRunner {
     }
   }
 
-  public static abstract class BenchmarkFnD implements Function<Integer, Double> {
+  public abstract static class BenchmarkFnD implements Function<Integer, Double> {
     protected int randIndex() {
       return BenchmarkRunner.randIndex();
     }

Modified: mahout/trunk/integration/src/main/java/org/apache/mahout/benchmark/DotBenchmark.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/main/java/org/apache/mahout/benchmark/DotBenchmark.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/integration/src/main/java/org/apache/mahout/benchmark/DotBenchmark.java (original)
+++ mahout/trunk/integration/src/main/java/org/apache/mahout/benchmark/DotBenchmark.java Wed Jun  5 05:20:34 2013
@@ -10,8 +10,6 @@ import static org.apache.mahout.benchmar
 import static org.apache.mahout.benchmark.VectorBenchmarks.SEQ_FN_RAND;
 import static org.apache.mahout.benchmark.VectorBenchmarks.SEQ_SPARSE_VECTOR;
 
-import java.io.IOException;
-
 import org.apache.mahout.benchmark.BenchmarkRunner.BenchmarkFn;
 import org.apache.mahout.benchmark.BenchmarkRunner.BenchmarkFnD;
 
@@ -167,7 +165,7 @@ public class DotBenchmark {
     }), DOT_PRODUCT, SEQ_FN_RAND);
   }
 
-  public static void main(String[] args) throws IOException {
+  public static void main(String[] args) {
     VectorBenchmarks mark = new VectorBenchmarks(1000000, 100, 1000, 10, 1);
     mark.createData();
     new DotBenchmark(mark).benchmarkNorm2();

Modified: mahout/trunk/integration/src/main/java/org/apache/mahout/benchmark/VectorBenchmarks.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/main/java/org/apache/mahout/benchmark/VectorBenchmarks.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/integration/src/main/java/org/apache/mahout/benchmark/VectorBenchmarks.java (original)
+++ mahout/trunk/integration/src/main/java/org/apache/mahout/benchmark/VectorBenchmarks.java Wed Jun  5 05:20:34 2013
@@ -420,7 +420,6 @@ public class VectorBenchmarks {
   }
 
   private String asCsvString() {
-    StringBuilder sb = new StringBuilder(1000);
     List<String> keys = Lists.newArrayList(statsMap.keySet());
     Collections.sort(keys);
     Map<Integer,String> implMap = Maps.newHashMap();
@@ -428,14 +427,15 @@ public class VectorBenchmarks {
       implMap.put(e.getValue(), e.getKey());
     }
 
+    StringBuilder sb = new StringBuilder(1000);
     for (String benchmarkName : keys) {
       int i = 0;
       for (String[] stats : statsMap.get(benchmarkName)) {
         if (stats.length < 8) {
           continue;
         }
-        sb.append(benchmarkName + ",");
-        sb.append(implMap.get(i++) + ",");
+        sb.append(benchmarkName).append(',');
+        sb.append(implMap.get(i++)).append(',');
         sb.append(stats[7].trim().split("=|/")[1].trim());
         sb.append('\n');
       }

Modified: mahout/trunk/integration/src/main/java/org/apache/mahout/cf/taste/impl/model/mongodb/MongoDBDataModel.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/main/java/org/apache/mahout/cf/taste/impl/model/mongodb/MongoDBDataModel.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/integration/src/main/java/org/apache/mahout/cf/taste/impl/model/mongodb/MongoDBDataModel.java (original)
+++ mahout/trunk/integration/src/main/java/org/apache/mahout/cf/taste/impl/model/mongodb/MongoDBDataModel.java Wed Jun  5 05:20:34 2013
@@ -55,7 +55,6 @@ import com.mongodb.Mongo;
 import com.mongodb.DB;
 import com.mongodb.DBCollection;
 import com.mongodb.DBCursor;
-import com.mongodb.MongoException;
 
 /**
  * <p>A {@link DataModel} backed by a MongoDB database. This class expects a
@@ -207,7 +206,7 @@ public final class MongoDBDataModel impl
   /**
    * Creates a new MongoDBDataModel
    */
-  public MongoDBDataModel() throws UnknownHostException, MongoException {
+  public MongoDBDataModel() throws UnknownHostException {
     this.reloadLock = new ReentrantLock();
     buildModel();
   }
@@ -234,7 +233,7 @@ public final class MongoDBDataModel impl
                           String collection,
                           boolean manage,
                           boolean finalRemove,
-                          DateFormat format) throws UnknownHostException, MongoException {
+                          DateFormat format) throws UnknownHostException {
     mongoHost = host;
     mongoPort = port;
     mongoDB = database;
@@ -266,7 +265,7 @@ public final class MongoDBDataModel impl
                           String userIDField,
                           String itemIDField,
                           String preferenceField,
-                          String mappingCollection) throws UnknownHostException, MongoException {
+                          String mappingCollection) throws UnknownHostException {
     mongoHost = host;
     mongoPort = port;
     mongoDB = database;
@@ -299,7 +298,7 @@ public final class MongoDBDataModel impl
                           boolean finalRemove,
                           DateFormat format,
                           String user,
-                          String password) throws UnknownHostException, MongoException {
+                          String password) throws UnknownHostException {
     mongoHost = host;
     mongoPort = port;
     mongoDB = database;
@@ -333,7 +332,7 @@ public final class MongoDBDataModel impl
                           String userIDField,
                           String itemIDField,
                           String preferenceField,
-                          String mappingCollection) throws UnknownHostException, MongoException {
+                          String mappingCollection) throws UnknownHostException {
     mongoHost = host;
     mongoPort = port;
     mongoDB = database;
@@ -402,10 +401,10 @@ public final class MongoDBDataModel impl
    */
   @Override
   public void refresh(Collection<Refreshable> alreadyRefreshed) {
-    Date ts = new Date(0);
     BasicDBObject query = new BasicDBObject();
     query.put("deleted_at", new BasicDBObject("$gt", mongoTimestamp));
     DBCursor cursor = collection.find(query);
+    Date ts = new Date(0);
     while (cursor.hasNext()) {
       Map<String,Object> user = (Map<String,Object>) cursor.next().toMap();
       String userID = getID(user.get(mongoUserID), true);
@@ -545,7 +544,7 @@ public final class MongoDBDataModel impl
     return mongoTimestamp;
   }
 
-  private void buildModel() throws UnknownHostException, MongoException {
+  private void buildModel() throws UnknownHostException {
     userIsObject = false;
     itemIsObject = false;
     idCounter = 0;

Modified: mahout/trunk/integration/src/main/java/org/apache/mahout/text/WikipediaToSequenceFile.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/main/java/org/apache/mahout/text/WikipediaToSequenceFile.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/integration/src/main/java/org/apache/mahout/text/WikipediaToSequenceFile.java (original)
+++ mahout/trunk/integration/src/main/java/org/apache/mahout/text/WikipediaToSequenceFile.java Wed Jun  5 05:20:34 2013
@@ -34,6 +34,7 @@ import org.apache.commons.cli2.commandli
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.DefaultStringifier;
+import org.apache.hadoop.io.Stringifier;
 import org.apache.hadoop.io.Text;
 import org.apache.hadoop.mapreduce.Job;
 import org.apache.hadoop.mapreduce.Reducer;
@@ -185,7 +186,7 @@ public final class WikipediaToSequenceFi
       }
     }
     
-    DefaultStringifier<Set<String>> setStringifier =
+    Stringifier<Set<String>> setStringifier =
         new DefaultStringifier<Set<String>>(conf, GenericsUtil.getClass(categories));
     
     String categoriesStr = setStringifier.toString(categories);

Modified: mahout/trunk/integration/src/main/java/org/apache/mahout/text/wikipedia/WikipediaDatasetCreatorDriver.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/main/java/org/apache/mahout/text/wikipedia/WikipediaDatasetCreatorDriver.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/integration/src/main/java/org/apache/mahout/text/wikipedia/WikipediaDatasetCreatorDriver.java (original)
+++ mahout/trunk/integration/src/main/java/org/apache/mahout/text/wikipedia/WikipediaDatasetCreatorDriver.java Wed Jun  5 05:20:34 2013
@@ -34,6 +34,7 @@ import org.apache.commons.cli2.commandli
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.DefaultStringifier;
+import org.apache.hadoop.io.Stringifier;
 import org.apache.hadoop.io.Text;
 import org.apache.hadoop.mapreduce.Job;
 import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
@@ -158,7 +159,7 @@ public final class WikipediaDatasetCreat
       categories.add(line.trim().toLowerCase(Locale.ENGLISH));
     }
     
-    DefaultStringifier<Set<String>> setStringifier =
+    Stringifier<Set<String>> setStringifier =
         new DefaultStringifier<Set<String>>(conf, GenericsUtil.getClass(categories));
     
     String categoriesStr = setStringifier.toString(categories);

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=1489707&r1=1489706&r2=1489707&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  5 05:20:34 2013
@@ -87,8 +87,9 @@ public final class VectorHelper {
     // If the sizeOfNonZeroElementsInVector < maxEntries then set maxEntries = sizeOfNonZeroElementsInVector
     // otherwise the call to queue.pop() returns a Pair(null, null) and the subsequent call
     // to pair.getFirst() throws a NullPointerException
-    if (sizeOfNonZeroElementsInVector < maxEntries)
+    if (sizeOfNonZeroElementsInVector < maxEntries) {
       maxEntries = sizeOfNonZeroElementsInVector;
+    }
 
     PriorityQueue<Pair<Integer, Double>> queue = new TDoublePQ<Integer>(-1, maxEntries);
     for (Element e : vector.nonZeroes()) {
@@ -176,7 +177,12 @@ public final class VectorHelper {
    * </pre>
    */
   public static String[] loadTermDictionary(File dictFile) throws IOException {
-    return loadTermDictionary(new FileInputStream(dictFile));
+    InputStream in = new FileInputStream(dictFile);
+    try {
+      return loadTermDictionary(in);
+    } finally {
+      in.close();
+    }
   }
 
   /**

Modified: mahout/trunk/integration/src/test/java/org/apache/mahout/clustering/TestClusterDumper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/test/java/org/apache/mahout/clustering/TestClusterDumper.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/integration/src/test/java/org/apache/mahout/clustering/TestClusterDumper.java (original)
+++ mahout/trunk/integration/src/test/java/org/apache/mahout/clustering/TestClusterDumper.java Wed Jun  5 05:20:34 2013
@@ -24,7 +24,6 @@ import java.util.List;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.util.ToolRunner;
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;

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=1489707&r1=1489706&r2=1489707&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  5 05:20:34 2013
@@ -348,7 +348,7 @@ public final class TestClusterEvaluator 
     ClusteringTestUtils.writePointsToFile(sampleData, new Path(testdata, "file1"), fs, conf);
     DistributionDescription description = new DistributionDescription(GaussianClusterDistribution.class.getName(),
         DenseVector.class.getName(), null, 2);
-    DirichletDriver.run(new Configuration(), testdata, output, description, 15, 5, 1.0, true, true, (double) 0, true);
+    DirichletDriver.run(new Configuration(), testdata, output, description, 15, 5, 1.0, true, true, 0.0, true);
     int numIterations = 10;
     Configuration conf = new Configuration();
     Path clustersIn = new Path(output, "clusters-5-final");

Modified: mahout/trunk/integration/src/test/java/org/apache/mahout/clustering/cdbw/TestCDbwEvaluator.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/test/java/org/apache/mahout/clustering/cdbw/TestCDbwEvaluator.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/integration/src/test/java/org/apache/mahout/clustering/cdbw/TestCDbwEvaluator.java (original)
+++ mahout/trunk/integration/src/test/java/org/apache/mahout/clustering/cdbw/TestCDbwEvaluator.java Wed Jun  5 05:20:34 2013
@@ -355,7 +355,7 @@ public final class TestCDbwEvaluator ext
     ClusteringTestUtils.writePointsToFile(sampleData, getTestTempFilePath("testdata/file1"), fs, conf);
     DistributionDescription description = new DistributionDescription(GaussianClusterDistribution.class.getName(),
         DenseVector.class.getName(), null, 2);
-    DirichletDriver.run(new Configuration(), testdata, output, description, 15, 5, 1.0, true, true, (double) 0, true);
+    DirichletDriver.run(new Configuration(), testdata, output, description, 15, 5, 1.0, true, true, 0.0, true);
     int numIterations = 10;
     Path clustersIn = new Path(output, "clusters-0");
     RepresentativePointsDriver.run(conf, clustersIn, new Path(output, "clusteredPoints"), output,

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=1489707&r1=1489706&r2=1489707&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  5 05:20:34 2013
@@ -19,7 +19,6 @@ package org.apache.mahout.clustering.dir
 
 import java.io.IOException;
 import java.util.Arrays;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
 

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=1489707&r1=1489706&r2=1489707&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  5 05:20:34 2013
@@ -429,7 +429,7 @@ public final class Arithmetic extends Co
   public static double logFactorial(int k) {
     if (k >= 30) {
 
-      double r = 1.0 / (double) k;
+      double r = 1.0 / k;
       double rr = r * r;
       double C7 = -5.95238095238095238e-04;
       double C5 = 7.93650793650793651e-04;
@@ -467,7 +467,7 @@ public final class Arithmetic extends Co
   public static double stirlingCorrection(int k) {
 
     if (k > 30) {
-      double r = 1.0 / (double) k;
+      double r = 1.0 / k;
       double rr = r * r;
       double C7 = -5.95238095238095238e-04;     //  -1/1680
       double C5 = 7.93650793650793651e-04;     //  +1/1260

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/AbstractMatrix.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/AbstractMatrix.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/AbstractMatrix.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/AbstractMatrix.java Wed Jun  5 05:20:34 2013
@@ -763,7 +763,7 @@ public abstract class AbstractMatrix imp
     Iterator<MatrixSlice> it = iterator();
     while (it.hasNext()) {
       MatrixSlice next = it.next();
-      s += "  " + next.index() + "  =>\t" + next.vector() + "\n";
+      s += "  " + next.index() + "  =>\t" + next.vector() + '\n';
     }
     s += "}";
     return s;

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/AbstractVector.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/AbstractVector.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/AbstractVector.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/AbstractVector.java Wed Jun  5 05:20:34 2013
@@ -284,7 +284,7 @@ public abstract class AbstractVector imp
     double thatLength = that.getLengthSquared();
     double dot = dot(that);
     double distanceEstimate = thisLength + thatLength - 2 * dot;
-    if (distanceEstimate > 1e-3 * (thisLength + thatLength)) {
+    if (distanceEstimate > 1.0e-3 * (thisLength + thatLength)) {
       // The vectors are far enough from each other that the formula is accurate.
       return Math.max(distanceEstimate, 0);
     } else {
@@ -471,10 +471,10 @@ public abstract class AbstractVector imp
       }
     } else {
       if (isSequentialAccess() && !isAddConstantTime()) {
-        OrderedIntDoubleMapping updates = new OrderedIntDoubleMapping();
         // Update all the non-zero values and queue the updates for the zero vaues.
         // The vector will become dense.
         it = iterator();
+        OrderedIntDoubleMapping updates = new OrderedIntDoubleMapping();
         while (it.hasNext()) {
           Element element = it.next();
           if (element.get() == 0.0) {

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/BinarySearch.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/BinarySearch.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/BinarySearch.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/BinarySearch.java Wed Jun  5 05:20:34 2013
@@ -19,7 +19,7 @@ package org.apache.mahout.math;
 
 import java.util.Comparator;
 
-public class BinarySearch {
+public final class BinarySearch {
 
   private BinarySearch() {}
 

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/DenseVector.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/DenseVector.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/DenseVector.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/DenseVector.java Wed Jun  5 05:20:34 2013
@@ -165,10 +165,11 @@ public class DenseVector extends Abstrac
     return this;
   }
 
+  @Override
   public void mergeUpdates(OrderedIntDoubleMapping updates) {
     int numUpdates = updates.getNumMappings();
-    int indices[] = updates.getIndices();
-    double values[] = updates.getValues();
+    int[] indices = updates.getIndices();
+    double[] values = updates.getValues();
     for (int i = 0; i < numUpdates; ++i) {
       this.values[indices[i]] = values[i];
     }

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/FileBasedMatrix.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/FileBasedMatrix.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/FileBasedMatrix.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/FileBasedMatrix.java Wed Jun  5 05:20:34 2013
@@ -60,10 +60,10 @@ public final class FileBasedMatrix exten
   }
 
   public void setData(File f, boolean loadNow) throws IOException {
-    Preconditions.checkArgument(f.length() == (long) rows * columns * 8L, "File " + f + " is wrong length");
+    Preconditions.checkArgument(f.length() == rows * columns * 8L, "File " + f + " is wrong length");
 
     for (int i = 0; i < (rows + rowsPerBlock - 1) / rowsPerBlock; i++) {
-      long start = (long) i * rowsPerBlock * columns * 8L;
+      long start = i * rowsPerBlock * columns * 8L;
       long size = rowsPerBlock * columns * 8L;
       MappedByteBuffer buf = new FileInputStream(f).getChannel().map(FileChannel.MapMode.READ_ONLY, start,
                                                                      Math.min(f.length() - start, size));
@@ -77,17 +77,19 @@ public final class FileBasedMatrix exten
   public static void writeMatrix(File f, Matrix m) throws IOException {
     Preconditions.checkArgument(f.canWrite(), "Can't write to output file");
     FileOutputStream fos = new FileOutputStream(f);
-
-    ByteBuffer buf = ByteBuffer.allocate(m.columnSize() * 8);
-    for (MatrixSlice row : m) {
-      buf.clear();
-      for (Vector.Element element : row.vector().all()) {
-        buf.putDouble(element.get());
+    try {
+      ByteBuffer buf = ByteBuffer.allocate(m.columnSize() * 8);
+      for (MatrixSlice row : m) {
+        buf.clear();
+        for (Vector.Element element : row.vector().all()) {
+          buf.putDouble(element.get());
+        }
+        buf.flip();
+        fos.write(buf.array());
       }
-      buf.flip();
-      fos.write(buf.array());
+    } finally {
+      fos.close();
     }
-    fos.close();
   }
 
   /**

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/MatrixVectorView.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/MatrixVectorView.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/MatrixVectorView.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/MatrixVectorView.java Wed Jun  5 05:20:34 2013
@@ -215,8 +215,8 @@ public class MatrixVectorView extends Ab
    */
   @Override
   public void mergeUpdates(OrderedIntDoubleMapping updates) {
-    int indices[] = updates.getIndices();
-    double values[] = updates.getValues();
+    int[] indices = updates.getIndices();
+    double[] values = updates.getValues();
     for (int i = 0; i < updates.getNumMappings(); ++i) {
       matrix.setQuick(row + rowStride * indices[i], column + columnStride * indices[i], values[i]);
     }

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/OrderedIntDoubleMapping.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/OrderedIntDoubleMapping.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/OrderedIntDoubleMapping.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/OrderedIntDoubleMapping.java Wed Jun  5 05:20:34 2013
@@ -137,13 +137,13 @@ public final class OrderedIntDoubleMappi
    * @param updates another list of mappings to be merged in.
    */
   public void merge(OrderedIntDoubleMapping updates) {
-    int updateIndices[] = updates.getIndices();
-    double updateValues[] = updates.getValues();
+    int[] updateIndices = updates.getIndices();
+    double[] updateValues = updates.getValues();
 
     int newNumMappings = numMappings + updates.getNumMappings();
     int newCapacity = Math.max((int) (1.2 * newNumMappings), newNumMappings + 1);
-    int newIndices[] = new int[newCapacity];
-    double newValues[] = new double[newCapacity];
+    int[] newIndices = new int[newCapacity];
+    double[] newValues = new double[newCapacity];
 
     int k = 0;
     int i = 0, j = 0;

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/RandomAccessSparseVector.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/RandomAccessSparseVector.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/RandomAccessSparseVector.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/RandomAccessSparseVector.java Wed Jun  5 05:20:34 2013
@@ -179,11 +179,13 @@ public class RandomAccessSparseVector ex
     return true;
   }
 
+  /*
   @Override
   public Element getElement(int index) {
     // TODO: this should return a MapElement so as to avoid hashing for both getQuick and setQuick.
     return super.getElement(index);
   }
+   */
 
   /**
    * NOTE: this implementation reuses the Vector.Element instance for each call of next(). If you need to preserve the

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/VectorBinaryAggregate.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/VectorBinaryAggregate.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/VectorBinaryAggregate.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/VectorBinaryAggregate.java Wed Jun  5 05:20:34 2013
@@ -39,7 +39,7 @@ import java.util.Iterator;
  * explanation.
  */
 public abstract class VectorBinaryAggregate {
-  public static final VectorBinaryAggregate[] operations = new VectorBinaryAggregate[] {
+  public static final VectorBinaryAggregate[] operations = {
       new AggregateNonzerosIterateThisLookupThat(),
       new AggregateNonzerosIterateThatLookupThis(),
 
@@ -176,7 +176,6 @@ public abstract class VectorBinaryAggreg
       boolean advanceThat = true;
       boolean validResult = false;
       double result = 0;
-      double thisResult;
       while (true) {
         if (advanceThis) {
           if (xi.hasNext()) {
@@ -193,7 +192,7 @@ public abstract class VectorBinaryAggreg
           }
         }
         if (xe.index() == ye.index()) {
-          thisResult = fc.apply(xe.get(), ye.get());
+          double thisResult = fc.apply(xe.get(), ye.get());
           if (validResult) {
             result = fa.apply(result, thisResult);
           } else {
@@ -240,7 +239,6 @@ public abstract class VectorBinaryAggreg
       boolean advanceThat = true;
       boolean validResult = false;
       double result = 0;
-      double thisResult;
       while (true) {
         if (advanceThis) {
           if (xi.hasNext()) {
@@ -256,6 +254,7 @@ public abstract class VectorBinaryAggreg
             ye = null;
           }
         }
+        double thisResult;
         if (xe != null && ye != null) { // both vectors have nonzero elements
           if (xe.index() == ye.index()) {
             thisResult = fc.apply(xe.get(), ye.get());
@@ -312,12 +311,11 @@ public abstract class VectorBinaryAggreg
     public double aggregate(Vector x, Vector y, DoubleDoubleFunction fa, DoubleDoubleFunction fc) {
       OpenIntHashSet visited = new OpenIntHashSet();
       Iterator<Vector.Element> xi = x.nonZeroes().iterator();
-      Vector.Element xe;
       boolean validResult = false;
       double result = 0;
       double thisResult;
       while (xi.hasNext()) {
-        xe = xi.next();
+        Vector.Element xe = xi.next();
         thisResult = fc.apply(xe.get(), y.getQuick(xe.index()));
         if (validResult) {
           result = fa.apply(result, thisResult);
@@ -328,9 +326,8 @@ public abstract class VectorBinaryAggreg
         visited.add(xe.index());
       }
       Iterator<Vector.Element> yi = y.nonZeroes().iterator();
-      Vector.Element ye;
       while (yi.hasNext()) {
-        ye = yi.next();
+        Vector.Element ye = yi.next();
         if (!visited.contains(ye.index())) {
           thisResult = fc.apply(x.getQuick(ye.index()), ye.get());
           if (validResult) {
@@ -361,13 +358,11 @@ public abstract class VectorBinaryAggreg
     public double aggregate(Vector x, Vector y, DoubleDoubleFunction fa, DoubleDoubleFunction fc) {
       Iterator<Vector.Element> xi = x.all().iterator();
       Iterator<Vector.Element> yi = y.all().iterator();
-      Vector.Element xe;
       boolean validResult = false;
       double result = 0;
-      double thisResult;
       while (xi.hasNext() && yi.hasNext()) {
-        xe = xi.next();
-        thisResult = fc.apply(xe.get(), yi.next().get());
+        Vector.Element xe = xi.next();
+        double thisResult = fc.apply(xe.get(), yi.next().get());
         if (validResult) {
           result = fa.apply(result, thisResult);
         } else {
@@ -395,13 +390,11 @@ public abstract class VectorBinaryAggreg
     @Override
     public double aggregate(Vector x, Vector y, DoubleDoubleFunction fa, DoubleDoubleFunction fc) {
       Iterator<Vector.Element> xi = x.all().iterator();
-      Vector.Element xe;
       boolean validResult = false;
       double result = 0;
-      double thisResult;
       while (xi.hasNext()) {
-        xe = xi.next();
-        thisResult = fc.apply(xe.get(), y.getQuick(xe.index()));
+        Vector.Element xe = xi.next();
+        double thisResult = fc.apply(xe.get(), y.getQuick(xe.index()));
         if (validResult) {
           result = fa.apply(result, thisResult);
         } else {
@@ -429,13 +422,11 @@ public abstract class VectorBinaryAggreg
     @Override
     public double aggregate(Vector x, Vector y, DoubleDoubleFunction fa, DoubleDoubleFunction fc) {
       Iterator<Vector.Element> yi = y.all().iterator();
-      Vector.Element ye;
       boolean validResult = false;
       double result = 0;
-      double thisResult;
       while (yi.hasNext()) {
-        ye = yi.next();
-        thisResult = fc.apply(x.getQuick(ye.index()), ye.get());
+        Vector.Element ye = yi.next();
+        double thisResult = fc.apply(x.getQuick(ye.index()), ye.get());
         if (validResult) {
           result = fa.apply(result, thisResult);
         } else {

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/VectorBinaryAssign.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/VectorBinaryAssign.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/VectorBinaryAssign.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/VectorBinaryAssign.java Wed Jun  5 05:20:34 2013
@@ -43,7 +43,7 @@ import java.util.Iterator;
  * explanation.
  */
 public abstract class VectorBinaryAssign {
-  public static final VectorBinaryAssign[] operations = new VectorBinaryAssign[] {
+  public static final VectorBinaryAssign[] operations = {
       new AssignNonzerosIterateThisLookupThat(),
       new AssignNonzerosIterateThatLookupThisMergeUpdates(),
       new AssignNonzerosIterateThatLookupThisInplaceUpdates(),
@@ -481,10 +481,9 @@ public abstract class VectorBinaryAssign
     public Vector assign(Vector x, Vector y, DoubleDoubleFunction f) {
       Iterator<Vector.Element> xi = x.all().iterator();
       Iterator<Vector.Element> yi = y.all().iterator();
-      Vector.Element xe;
       OrderedIntDoubleMapping updates = new OrderedIntDoubleMapping(false);
       while (xi.hasNext() && yi.hasNext()) {
-        xe = xi.next();
+        Element xe = xi.next();
         updates.set(xe.index(), f.apply(xe.get(), yi.next().get()));
       }
       x.mergeUpdates(updates);
@@ -509,9 +508,8 @@ public abstract class VectorBinaryAssign
     public Vector assign(Vector x, Vector y, DoubleDoubleFunction f) {
       Iterator<Vector.Element> xi = x.all().iterator();
       Iterator<Vector.Element> yi = y.all().iterator();
-      Vector.Element xe;
       while (xi.hasNext() && yi.hasNext()) {
-        xe = xi.next();
+        Element xe = xi.next();
         x.setQuick(xe.index(), f.apply(xe.get(), yi.next().get()));
       }
       return x;

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/math/Arithmetic.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/math/Arithmetic.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/math/Arithmetic.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/math/Arithmetic.java Wed Jun  5 05:20:34 2013
@@ -307,7 +307,7 @@ public final class Arithmetic {
   public static double logFactorial(int k) {
     if (k >= 30) {
 
-      double r = 1.0 / (double) k;
+      double r = 1.0 / k;
       double rr = r * r;
       double c7 = -5.95238095238095238e-04;
       double c5 = 7.93650793650793651e-04;

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/math/Constants.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/math/Constants.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/math/Constants.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/math/Constants.java Wed Jun  5 05:20:34 2013
@@ -42,7 +42,7 @@ public final class Constants {
   public static final double BIG = 4.503599627370496e15;
   public static final double BIG_INVERSE = 2.22044604925031308085e-16;
 
-  public static final double EPSILON = 1E-6;
+  public static final double EPSILON = 1.0E-6;
 
   private Constants() {
   }

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/AbstractDiscreteDistribution.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/AbstractDiscreteDistribution.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/AbstractDiscreteDistribution.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/AbstractDiscreteDistribution.java Wed Jun  5 05:20:34 2013
@@ -21,7 +21,7 @@ public abstract class AbstractDiscreteDi
   /** Returns a random number from the distribution; returns <tt>(double) nextInt()</tt>. */
   @Override
   public double nextDouble() {
-    return (double) nextInt();
+    return nextInt();
   }
 
 }

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Poisson.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Poisson.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Poisson.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Poisson.java Wed Jun  5 05:20:34 2013
@@ -133,7 +133,7 @@ public final class Poisson extends Abstr
           }
         }
         for (k = llll + 1; k <= 35; k++) { // Step C. Creation of new prob.
-          p *= theMean / (double) k;
+          p *= theMean / k;
           q += p;
           pp[k] = q;
           if (u <= q) {
@@ -165,14 +165,14 @@ public final class Poisson extends Abstr
         k5 = k4 + k4 - m;
 
         // range width of the critical left and right centre region
-        dl = (double) (k2 - k1);
-        dr = (double) (k5 - k4);
+        dl = k2 - k1;
+        dr = k5 - k4;
 
         // recurrence constants r(k) = p(k)/p(k-1) at k = k1, k2, k4+1, k5+1
-        r1 = theMean / (double) k1;
-        r2 = theMean / (double) k2;
-        r4 = theMean / (double) (k4 + 1);
-        r5 = theMean / (double) (k5 + 1);
+        r1 = theMean / k1;
+        r2 = theMean / k2;
+        r4 = theMean / (k4 + 1);
+        r5 = theMean / (k5 + 1);
 
         // reciprocal values of the scale parameters of expon. tail envelopes
         ll = Math.log(r1);                     // expon. tail left

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Uniform.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Uniform.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Uniform.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Uniform.java Wed Jun  5 05:20:34 2013
@@ -84,7 +84,7 @@ public class Uniform extends AbstractCon
    * and <tt>to</tt>). Pre conditions: <tt>from &lt;= to</tt>.
    */
   public int nextIntFromTo(int from, int to) {
-    return (int) ((long) from + (long) ((1L + (long) to - (long) from) * randomDouble()));
+    return (int) (from + (long) ((1L + to - from) * randomDouble()));
   }
 
   /**

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/engine/RandomEngine.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/engine/RandomEngine.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/engine/RandomEngine.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/engine/RandomEngine.java Wed Jun  5 05:20:34 2013
@@ -84,7 +84,7 @@ public abstract class RandomEngine exten
     do {
       // -9.223372036854776E18 == (double) Long.MIN_VALUE
       // 5.421010862427522E-20 == 1 / Math.pow(2,64) == 1 / ((double) Long.MAX_VALUE - (double) Long.MIN_VALUE);
-      nextDouble = ((double) nextLong() - -9.223372036854776E18) * 5.421010862427522E-20;
+      nextDouble = (nextLong() - -9.223372036854776E18) * 5.421010862427522E-20;
     }
     // catch loss of precision of long --> double conversion
     while (!(nextDouble > 0.0 && nextDouble < 1.0));
@@ -153,7 +153,7 @@ public abstract class RandomEngine exten
 
     // transform to (0.0,1.0)-interval
     // 2.3283064365386963E-10 == 1.0 / Math.pow(2,32)
-    return (double) (nextInt & 0xFFFFFFFFL) * 2.3283064365386963E-10;
+    return (nextInt & 0xFFFFFFFFL) * 2.3283064365386963E-10;
 
     /*
       nextInt == Integer.MAX_VALUE   --> 0.49999999976716936

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/Probability.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/Probability.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/Probability.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/Probability.java Wed Jun  5 05:20:34 2013
@@ -197,7 +197,7 @@ public final class Probability {
     if (k < 0) {
       return 0.0;
     }
-    return Gamma.incompleteGammaComplement((double) (k + 1), mean);
+    return Gamma.incompleteGammaComplement(k + 1, mean);
   }
 
 }

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/map/HashFunctions.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/map/HashFunctions.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/map/HashFunctions.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/map/HashFunctions.java Wed Jun  5 05:20:34 2013
@@ -26,7 +26,7 @@ public final class HashFunctions {
    * @return a hash code value for the specified value.
    */
   public static int hash(char value) {
-    return (int) value;
+    return value;
   }
 
   /**
@@ -104,7 +104,7 @@ public final class HashFunctions {
    * @return a hash code value for the specified value.
    */
   public static int hash(short value) {
-    return (int) value;
+    return value;
   }
 
   /**

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/random/IndianBuffet.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/random/IndianBuffet.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/random/IndianBuffet.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/random/IndianBuffet.java Wed Jun  5 05:20:34 2013
@@ -121,17 +121,17 @@ public final class IndianBuffet<T> imple
       try {
         words = Resources.readLines(Resources.getResource("words.txt"), Charsets.UTF_8,
                                     new LineProcessor<List<String>>() {
-            final List<String> words = Lists.newArrayList();
+            private final List<String> theWords = Lists.newArrayList();
 
             @Override
             public boolean processLine(String line) {
-              Iterables.addAll(words, onSpace.split(line));
+              Iterables.addAll(theWords, onSpace.split(line));
               return true;
             }
 
             @Override
             public List<String> getResult() {
-              return words;
+              return theWords;
             }
           });
       } catch (IOException e) {

Modified: mahout/trunk/math/src/test/java/org/apache/mahout/math/QRDecompositionTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/test/java/org/apache/mahout/math/QRDecompositionTest.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/math/src/test/java/org/apache/mahout/math/QRDecompositionTest.java (original)
+++ mahout/trunk/math/src/test/java/org/apache/mahout/math/QRDecompositionTest.java Wed Jun  5 05:20:34 2013
@@ -163,7 +163,6 @@ public final class QRDecompositionTest e
 
   // TODO: the speedup constant should be checked and oddly, the times don't increase as the counts increase
   @Ignore
-  @Test
   public void fasterThanBefore() {
 
     OnlineSummarizer s1 = new OnlineSummarizer();

Modified: mahout/trunk/math/src/test/java/org/apache/mahout/math/VectorBinaryAggregateCostTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/test/java/org/apache/mahout/math/VectorBinaryAggregateCostTest.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/math/src/test/java/org/apache/mahout/math/VectorBinaryAggregateCostTest.java (original)
+++ mahout/trunk/math/src/test/java/org/apache/mahout/math/VectorBinaryAggregateCostTest.java Wed Jun  5 05:20:34 2013
@@ -37,7 +37,7 @@ public final class VectorBinaryAggregate
   Vector sasv = EasyMock.createMock(Vector.class);
   Vector dense = EasyMock.createMock(Vector.class);
 
-  private void createStubs(Vector v, Vector realV) {
+  private static void createStubs(Vector v, Vector realV) {
     expect(v.getLookupCost())
         .andStubReturn(realV instanceof SequentialAccessSparseVector
             ? Math.round(Math.log(1000)) : realV.getLookupCost());

Modified: mahout/trunk/math/src/test/java/org/apache/mahout/math/VectorBinaryAssignCostTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/test/java/org/apache/mahout/math/VectorBinaryAssignCostTest.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/math/src/test/java/org/apache/mahout/math/VectorBinaryAssignCostTest.java (original)
+++ mahout/trunk/math/src/test/java/org/apache/mahout/math/VectorBinaryAssignCostTest.java Wed Jun  5 05:20:34 2013
@@ -37,7 +37,7 @@ public final class VectorBinaryAssignCos
   Vector sasv = EasyMock.createMock(Vector.class);
   Vector dense = EasyMock.createMock(Vector.class);
 
-  private void createStubs(Vector v, Vector realV) {
+  private static void createStubs(Vector v, Vector realV) {
     expect(v.getLookupCost())
         .andStubReturn(realV instanceof SequentialAccessSparseVector
             ? Math.round(Math.log(1000)) : realV.getLookupCost());

Modified: mahout/trunk/math/src/test/java/org/apache/mahout/math/VectorTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/test/java/org/apache/mahout/math/VectorTest.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/math/src/test/java/org/apache/mahout/math/VectorTest.java (original)
+++ mahout/trunk/math/src/test/java/org/apache/mahout/math/VectorTest.java Wed Jun  5 05:20:34 2013
@@ -379,9 +379,7 @@ public final class VectorTest extends Ma
       index++;
     }
 
-    Iterator<Element> nonZeroIterator = vector.nonZeroes().iterator();
-    while (nonZeroIterator.hasNext()) {
-      Element element = nonZeroIterator.next();
+    for (Element element : vector.nonZeroes()) {
       index = element.index();
       assertTrue(expectedIndices.contains(index));
       assertEquals((double) index * 2, element.get(), EPSILON);
@@ -904,14 +902,14 @@ public final class VectorTest extends Ma
     testExample1NonZeroIterator(new DenseVector(13));
   }
 
-  private void testIterator(Vector vector) {
+  private static void testIterator(Vector vector) {
     testSkips(vector.like());
     testSkipsLast(vector.like());
     testEmptyNonZeroIterator(vector.like());
     testSingleNonZeroIterator(vector.like());
   }
 
-  private void testSkips(Vector vector) {
+  private static void testSkips(Vector vector) {
     vector.set(0, 1);
     vector.set(2, 2);
     vector.set(4, 3);
@@ -948,7 +946,7 @@ public final class VectorTest extends Ma
     assertEquals(197, i);  // Last element is print only once.
   }
 
-  private void testSkipsLast(Vector vector) {
+  private static void testSkipsLast(Vector vector) {
     vector.set(1, 6);
     vector.set(98, 6);
 
@@ -975,7 +973,7 @@ public final class VectorTest extends Ma
   }
 
   // Test NonZeroIterator on an list with 0 elements
-  private void testEmptyNonZeroIterator(Vector vector) {
+  private static void testEmptyNonZeroIterator(Vector vector) {
     // Test non zero iterator.
     Iterator<Element> it = vector.nonZeroes().iterator();
     int i = 0;
@@ -995,7 +993,7 @@ public final class VectorTest extends Ma
   }
 
   // Test AllIterator on an list with 0 cardinality
-  private void testEmptyAllIterator(Vector vector) {
+  private static void testEmptyAllIterator(Vector vector) {
     // Test non zero iterator.
     Iterator<Element> it = vector.all().iterator();
     int i = 0;
@@ -1024,7 +1022,7 @@ public final class VectorTest extends Ma
   }
 
   // Test NonZeroIterator on an list with 1 elements
-  private void testSingleNonZeroIterator(Vector vector) {
+  private static void testSingleNonZeroIterator(Vector vector) {
     vector.set(1, 6);
     // Test non zero iterator.
     Iterator<Element> it = vector.nonZeroes().iterator();
@@ -1046,8 +1044,8 @@ public final class VectorTest extends Ma
   }
 
   // Test NonZeroIterator on double[] { 0, 2, 0, 0, 8, 3, 0, 6, 0, 1, 1, 2, 1 }
-  private void testExample1NonZeroIterator(Vector vector) {
-    double[] val = new double[] { 0, 2, 0, 0, 8, 3, 0, 6, 0, 1, 1, 2, 1 };
+  private static void testExample1NonZeroIterator(Vector vector) {
+    double[] val = { 0, 2, 0, 0, 8, 3, 0, 6, 0, 1, 1, 2, 1 };
     for (int i = 0; i < val.length; ++i) {
       vector.set(i, val[i]);
     }

Modified: mahout/trunk/math/src/test/java/org/apache/mahout/math/WeightedVectorTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/test/java/org/apache/mahout/math/WeightedVectorTest.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/math/src/test/java/org/apache/mahout/math/WeightedVectorTest.java (original)
+++ mahout/trunk/math/src/test/java/org/apache/mahout/math/WeightedVectorTest.java Wed Jun  5 05:20:34 2013
@@ -43,7 +43,7 @@ public class WeightedVectorTest extends 
     WeightedVector v1 = new WeightedVector(new DenseVector(new double[]{1, 2, 3}), 5.41, 31);
     WeightedVector v2 = new WeightedVector(new DenseVector(new double[]{1, 2, 3}), 5.00, 31);
     WeightedVector v3 = new WeightedVector(new DenseVector(new double[]{1, 3, 3}), 5.00, 31);
-    WeightedVector v4 = (WeightedVector) v1.clone();
+    WeightedVector v4 = v1.clone();
     WeightedVectorComparator comparator = new WeightedVectorComparator();
 
     assertTrue(comparator.compare(v1, v2) > 0);

Modified: mahout/trunk/math/src/test/java/org/apache/mahout/math/jet/random/engine/MersenneTwisterTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/test/java/org/apache/mahout/math/jet/random/engine/MersenneTwisterTest.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/math/src/test/java/org/apache/mahout/math/jet/random/engine/MersenneTwisterTest.java (original)
+++ mahout/trunk/math/src/test/java/org/apache/mahout/math/jet/random/engine/MersenneTwisterTest.java Wed Jun  5 05:20:34 2013
@@ -44,7 +44,7 @@ public final class MersenneTwisterTest e
    * @return A double in the range [0..1)
    */
   private static double toDouble(long y) {
-    return (double) (y & 0xffffffffL) * 2.3283064365386963e-10;
+    return (y & 0xffffffffL) * 2.3283064365386963e-10;
   }
 
   @Test

Modified: mahout/trunk/math/src/test/java/org/apache/mahout/math/randomized/RandomBlasting.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/test/java/org/apache/mahout/math/randomized/RandomBlasting.java?rev=1489707&r1=1489706&r2=1489707&view=diff
==============================================================================
--- mahout/trunk/math/src/test/java/org/apache/mahout/math/randomized/RandomBlasting.java (original)
+++ mahout/trunk/math/src/test/java/org/apache/mahout/math/randomized/RandomBlasting.java Wed Jun  5 05:20:34 2013
@@ -6,6 +6,7 @@ import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 import org.apache.mahout.math.map.OpenIntIntHashMap;
@@ -32,7 +33,7 @@ public class RandomBlasting extends Rand
   @Repeat(iterations = 20)
   public void testAgainstReference_OpenObjectIntHashMap() {
     OpenObjectIntHashMap<Integer> base = new OpenObjectIntHashMap<Integer>();
-    HashMap<Integer, Integer> reference = new HashMap<Integer, Integer>();
+    Map<Integer, Integer> reference = new HashMap<Integer, Integer>();
 
     List<Operation> ops = new ArrayList<Operation>();
     addOp(ops, Operation.ADD, 60);
@@ -83,7 +84,7 @@ public class RandomBlasting extends Rand
   @Repeat(iterations = 20)
   public void testAgainstReference_OpenIntObjectHashMap() {
     OpenIntObjectHashMap<Integer> base = new OpenIntObjectHashMap<Integer>();
-    HashMap<Integer, Integer> reference = new HashMap<Integer, Integer>();
+    Map<Integer, Integer> reference = new HashMap<Integer, Integer>();
 
     List<Operation> ops = new ArrayList<Operation>();
     addOp(ops, Operation.ADD, 60);



Mime
View raw message