mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smar...@apache.org
Subject mahout git commit: NoJira: cleanup IntelliJ warnings from last few commits
Date Sun, 01 May 2016 22:33:18 GMT
Repository: mahout
Updated Branches:
  refs/heads/master b0cede1e2 -> aa3277198


NoJira: cleanup IntelliJ warnings from last few commits


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

Branch: refs/heads/master
Commit: aa327719837e3996e0018c0d1d221e9561d47152
Parents: b0cede1
Author: smarthi <smarthi@apache.org>
Authored: Sun May 1 18:33:03 2016 -0400
Committer: smarthi <smarthi@apache.org>
Committed: Sun May 1 18:33:03 2016 -0400

----------------------------------------------------------------------
 .../org/apache/mahout/visualization/MGrid.scala |  9 +++----
 .../apache/mahout/visualization/MHisto.scala    |  8 +++---
 .../apache/mahout/visualization/MHisto3d.scala  |  8 +++---
 .../apache/mahout/visualization/MPlot2d.scala   |  4 +--
 .../apache/mahout/visualization/MPlot3d.scala   | 13 +++------
 .../org/apache/mahout/visualization/MSurf.scala | 12 ++++-----
 .../java/org/apache/mahout/math/Matrices.java   | 28 +++++++++-----------
 7 files changed, 33 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mahout/blob/aa327719/math-scala/src/main/scala/org/apache/mahout/visualization/MGrid.scala
----------------------------------------------------------------------
diff --git a/math-scala/src/main/scala/org/apache/mahout/visualization/MGrid.scala b/math-scala/src/main/scala/org/apache/mahout/visualization/MGrid.scala
index 3f6e654..4b452e0 100644
--- a/math-scala/src/main/scala/org/apache/mahout/visualization/MGrid.scala
+++ b/math-scala/src/main/scala/org/apache/mahout/visualization/MGrid.scala
@@ -17,13 +17,10 @@
 
 package org.apache.mahout.visualization
 
-import java.awt.{BorderLayout, Color}
+import java.awt.BorderLayout
 import javax.swing.JFrame
 
-import org.apache.mahout.math._
 import org.apache.mahout.math.drm._
-import org.apache.mahout.math.scalabindings.RLikeOps._
-import org.apache.mahout.math.scalabindings._
 import smile.plot._
 
 
@@ -38,10 +35,10 @@ import smile.plot._
 class MGrid[K](drmXYZ: DrmLike[K], samplePercent: Double = 1, setVisible: Boolean = true)
extends MahoutPlot{
 
   val drmSize = drmXYZ.checkpoint().numRows()
-  val sampleDec: Double = (samplePercent / 100.toDouble)
+  val sampleDec: Double = samplePercent / 100.toDouble
   val numSamples: Int = (drmSize * sampleDec).toInt
 
-   mPlotMatrix = drmSampleKRows(drmXYZ, numSamples, false)
+   mPlotMatrix = drmSampleKRows(drmXYZ, numSamples, replacement = false)
 
   // matrix rows
   val m = mPlotMatrix.numRows()

http://git-wip-us.apache.org/repos/asf/mahout/blob/aa327719/math-scala/src/main/scala/org/apache/mahout/visualization/MHisto.scala
----------------------------------------------------------------------
diff --git a/math-scala/src/main/scala/org/apache/mahout/visualization/MHisto.scala b/math-scala/src/main/scala/org/apache/mahout/visualization/MHisto.scala
index 201bdeb..30138e9 100644
--- a/math-scala/src/main/scala/org/apache/mahout/visualization/MHisto.scala
+++ b/math-scala/src/main/scala/org/apache/mahout/visualization/MHisto.scala
@@ -17,13 +17,11 @@
 
 package org.apache.mahout.visualization
 
-import java.awt.{BorderLayout, Color}
+import java.awt.BorderLayout
 import javax.swing.JFrame
 
-import org.apache.mahout.math._
 import org.apache.mahout.math.drm._
 import org.apache.mahout.math.scalabindings.RLikeOps._
-import org.apache.mahout.math.scalabindings._
 import smile.plot._
 
 
@@ -38,11 +36,11 @@ import smile.plot._
   */
 class MHisto[K](drmXY: DrmLike[K], numBins: Int, samplePercent: Double = 1, setVisible: Boolean
= true)  extends MahoutPlot {
   val drmSize = drmXY.checkpoint().numRows()
-  val sampleDec: Double = (samplePercent / 100.toDouble)
+  val sampleDec: Double = samplePercent / 100.toDouble
 
   val numSamples: Int = (drmSize * sampleDec).toInt
 
-  mPlotMatrix = drmSampleKRows(drmXY, numSamples, false)
+  mPlotMatrix = drmSampleKRows(drmXY, numSamples, replacement = false)
   val arrays = Array.ofDim[Double](mPlotMatrix.numRows())
   for (i <- 0 until mPlotMatrix.numRows()) {
        arrays(i) = mPlotMatrix(i, 0)

http://git-wip-us.apache.org/repos/asf/mahout/blob/aa327719/math-scala/src/main/scala/org/apache/mahout/visualization/MHisto3d.scala
----------------------------------------------------------------------
diff --git a/math-scala/src/main/scala/org/apache/mahout/visualization/MHisto3d.scala b/math-scala/src/main/scala/org/apache/mahout/visualization/MHisto3d.scala
index 2c871f5..952f97e 100644
--- a/math-scala/src/main/scala/org/apache/mahout/visualization/MHisto3d.scala
+++ b/math-scala/src/main/scala/org/apache/mahout/visualization/MHisto3d.scala
@@ -17,13 +17,11 @@
 
 package org.apache.mahout.visualization
 
-import java.awt.{BorderLayout, Color}
+import java.awt.BorderLayout
 import javax.swing.JFrame
 
-import org.apache.mahout.math._
 import org.apache.mahout.math.drm._
 import org.apache.mahout.math.scalabindings.RLikeOps._
-import org.apache.mahout.math.scalabindings._
 import smile.plot._
 
 
@@ -38,11 +36,11 @@ import smile.plot._
   */
 class MHisto3d[K](drmXY: DrmLike[K],numBins: Int, samplePercent: Double = 1, setVisible:
Boolean = true) extends MahoutPlot {
   val drmSize = drmXY.checkpoint().numRows()
-  val sampleDec: Double = (samplePercent / 100.toDouble)
+  val sampleDec: Double = samplePercent / 100.toDouble
 
   val numSamples: Int = (drmSize * sampleDec).toInt
 
-  mPlotMatrix = drmSampleKRows(drmXY, numSamples, false)
+  mPlotMatrix = drmSampleKRows(drmXY, numSamples, replacement = false)
   val arrays: Array[Array[Double]] = Array.ofDim[Double](mPlotMatrix.numRows(), 2)
   for (i <- 0 until mPlotMatrix.numRows()) {
     arrays(i)(0) = mPlotMatrix(i, 0)

http://git-wip-us.apache.org/repos/asf/mahout/blob/aa327719/math-scala/src/main/scala/org/apache/mahout/visualization/MPlot2d.scala
----------------------------------------------------------------------
diff --git a/math-scala/src/main/scala/org/apache/mahout/visualization/MPlot2d.scala b/math-scala/src/main/scala/org/apache/mahout/visualization/MPlot2d.scala
index 5b77a2c..9810af1 100644
--- a/math-scala/src/main/scala/org/apache/mahout/visualization/MPlot2d.scala
+++ b/math-scala/src/main/scala/org/apache/mahout/visualization/MPlot2d.scala
@@ -37,11 +37,11 @@ import smile.plot._
   */
 class MPlot2d[K](drmXY: DrmLike[K], samplePercent: Double  = 1, setVisible: Boolean = true)
 extends MahoutPlot {
    val drmSize = drmXY.checkpoint().numRows()
-   val sampleDec: Double = (samplePercent / 100.toDouble)
+   val sampleDec: Double = samplePercent / 100.toDouble
 
    val numSamples: Int = (drmSize * sampleDec).toInt
 
-   mPlotMatrix = drmSampleKRows(drmXY, numSamples, false)
+   mPlotMatrix = drmSampleKRows(drmXY, numSamples, replacement = false)
    val arrays: Array[Array[Double]]  = Array.ofDim[Double](mPlotMatrix.numRows(), 2)
    for (i <- 0 until mPlotMatrix.numRows()) {
         arrays(i)(0) = mPlotMatrix(i, 0)

http://git-wip-us.apache.org/repos/asf/mahout/blob/aa327719/math-scala/src/main/scala/org/apache/mahout/visualization/MPlot3d.scala
----------------------------------------------------------------------
diff --git a/math-scala/src/main/scala/org/apache/mahout/visualization/MPlot3d.scala b/math-scala/src/main/scala/org/apache/mahout/visualization/MPlot3d.scala
index c7e023d..ba2ba59 100644
--- a/math-scala/src/main/scala/org/apache/mahout/visualization/MPlot3d.scala
+++ b/math-scala/src/main/scala/org/apache/mahout/visualization/MPlot3d.scala
@@ -18,17 +18,12 @@
 package org.apache.mahout.visualization
 
 import java.awt.{BorderLayout, Color}
-import java.io.File
 import javax.swing.JFrame
 
-import org.apache.mahout.math._
-import scalabindings._
-import RLikeOps._
-import drm._
+import org.apache.mahout.math.drm._
+import org.apache.mahout.math.scalabindings.RLikeOps._
 import smile.plot._
 
-import scala.collection.JavaConversions._
-
 
 /**
   * Create a scatter plot of a DRM by sampling a given percentage
@@ -40,11 +35,11 @@ import scala.collection.JavaConversions._
   */
 class MPlot3d[K](drmXYZ: DrmLike[K], samplePercent: Double = 1, setVisible: Boolean = true)
extends MahoutPlot {
   val drmSize = drmXYZ.checkpoint().numRows()
-  val sampleDec: Double = (samplePercent / 100.toDouble)
+  val sampleDec: Double = samplePercent / 100.toDouble
 
   val numSamples: Int = (drmSize * sampleDec).toInt
 
-  mPlotMatrix = drmSampleKRows(drmXYZ, numSamples, false)
+  mPlotMatrix = drmSampleKRows(drmXYZ, numSamples, replacement = false)
   val arrays: Array[Array[Double]] = Array.ofDim[Double](mPlotMatrix.numRows(), 3)
   for (i <- 0 until mPlotMatrix.numRows()) {
     arrays(i)(0) = mPlotMatrix(i, 0)

http://git-wip-us.apache.org/repos/asf/mahout/blob/aa327719/math-scala/src/main/scala/org/apache/mahout/visualization/MSurf.scala
----------------------------------------------------------------------
diff --git a/math-scala/src/main/scala/org/apache/mahout/visualization/MSurf.scala b/math-scala/src/main/scala/org/apache/mahout/visualization/MSurf.scala
index d07f01f..c7593ec 100644
--- a/math-scala/src/main/scala/org/apache/mahout/visualization/MSurf.scala
+++ b/math-scala/src/main/scala/org/apache/mahout/visualization/MSurf.scala
@@ -17,13 +17,11 @@
 
 package org.apache.mahout.visualization
 
-import java.awt.{BorderLayout, Color}
+import java.awt.BorderLayout
 import javax.swing.JFrame
 
-import org.apache.mahout.math._
-import scalabindings._
-import RLikeOps._
-import drm._
+import org.apache.mahout.math.drm._
+import org.apache.mahout.math.scalabindings.RLikeOps._
 import smile.plot._
 
 
@@ -38,11 +36,11 @@ import smile.plot._
   */
 class MSurf[K](drmXYZ: DrmLike[K], samplePercent: Double = 1, setVisible: Boolean = true)
extends MahoutPlot {
   val drmSize = drmXYZ.checkpoint().numRows()
-  val sampleDec: Double = (samplePercent / 100.toDouble)
+  val sampleDec: Double = samplePercent / 100.toDouble
 
   val numSamples: Int = (drmSize * sampleDec).toInt
 
-  mPlotMatrix = drmSampleKRows(drmXYZ, numSamples, false)
+  mPlotMatrix = drmSampleKRows(drmXYZ, numSamples, replacement = false)
 
   val arrays: Array[Array[Double]]  = Array.ofDim[Double](mPlotMatrix.numRows(), 3)
   for (i <- 0 until mPlotMatrix.numRows()) {

http://git-wip-us.apache.org/repos/asf/mahout/blob/aa327719/math/src/main/java/org/apache/mahout/math/Matrices.java
----------------------------------------------------------------------
diff --git a/math/src/main/java/org/apache/mahout/math/Matrices.java b/math/src/main/java/org/apache/mahout/math/Matrices.java
index fc45a16..09aac17 100644
--- a/math/src/main/java/org/apache/mahout/math/Matrices.java
+++ b/math/src/main/java/org/apache/mahout/math/Matrices.java
@@ -19,7 +19,6 @@ package org.apache.mahout.math;
 
 import com.google.common.base.Preconditions;
 import org.apache.mahout.common.RandomUtils;
-import org.apache.mahout.math.flavor.TraversingStructureEnum;
 import org.apache.mahout.math.function.DoubleFunction;
 import org.apache.mahout.math.function.Functions;
 import org.apache.mahout.math.function.IntIntFunction;
@@ -41,7 +40,7 @@ public final class Matrices {
    * @param denseLike type of matrix returne dby {@link org.apache.mahout.math.Matrix#like()}.
    * @return new matrix view.
    */
-  public static final Matrix functionalMatrixView(final int rows,
+  public static Matrix functionalMatrixView(final int rows,
                                                   final int columns,
                                                   final IntIntFunction gf,
                                                   final boolean denseLike) {
@@ -52,7 +51,7 @@ public final class Matrices {
    * Shorter form of {@link Matrices#functionalMatrixView(int, int,
    * org.apache.mahout.math.function.IntIntFunction, boolean)}.
    */
-  public static final Matrix functionalMatrixView(final int rows,
+  public static Matrix functionalMatrixView(final int rows,
                                                   final int columns,
                                                   final IntIntFunction gf) {
     return new FunctionalMatrixView(rows, columns, gf);
@@ -64,7 +63,7 @@ public final class Matrices {
    * @param m original matrix
    * @return transposed view of original matrix
    */
-  public static final Matrix transposedView(final Matrix m) {
+  public static Matrix transposedView(final Matrix m) {
 
     Preconditions.checkArgument(!(m instanceof SparseColumnMatrix));
 
@@ -80,7 +79,7 @@ public final class Matrices {
    *
    * @param seed generator seed
    */
-  public static final Matrix gaussianView(final int rows,
+  public static Matrix gaussianView(final int rows,
                                           final int columns,
                                           long seed) {
     return functionalMatrixView(rows, columns, gaussianGenerator(seed), true);
@@ -92,7 +91,7 @@ public final class Matrices {
    *
    * @param seed generator seed
    */
-  public static final Matrix symmetricUniformView(final int rows,
+  public static Matrix symmetricUniformView(final int rows,
                                                   final int columns,
                                                   int seed) {
     return functionalMatrixView(rows, columns, uniformSymmetricGenerator(seed), true);
@@ -103,7 +102,7 @@ public final class Matrices {
    *
    * @param seed generator seed
    */
-  public static final Matrix uniformView(final int rows,
+  public static Matrix uniformView(final int rows,
                                          final int columns,
                                          int seed) {
     return functionalMatrixView(rows, columns, uniformGenerator(seed), true);
@@ -115,16 +114,15 @@ public final class Matrices {
    * @param seed The seed for the matrix.
    * @return Gaussian {@link IntIntFunction} generating matrix view with normal values
    */
-  public static final IntIntFunction gaussianGenerator(final long seed) {
+  public static IntIntFunction gaussianGenerator(final long seed) {
     final Random rnd = RandomUtils.getRandom(seed);
-    IntIntFunction gaussianGF = new IntIntFunction() {
+    return new IntIntFunction() {
       @Override
       public double apply(int first, int second) {
-        rnd.setSeed(seed ^ (((long) first << 32) | (second & 0xffffffffl)));
+        rnd.setSeed(seed ^ (((long) first << 32) | (second & 0xffffffffL)));
         return rnd.nextGaussian();
       }
     };
-    return gaussianGF;
   }
 
   private static final double UNIFORM_DIVISOR = Math.pow(2.0, 64);
@@ -135,16 +133,16 @@ public final class Matrices {
    * WARNING: to keep things performant, it is stateful and so not thread-safe.
    * You'd need to create a copy per thread (with same seed) if shared between threads.
    *
-   * @param seed
+   * @param seed - random seed initializer
    * @return Uniform {@link IntIntFunction} generator
    */
-  public static final IntIntFunction uniformSymmetricGenerator(final int seed) {
+  public static IntIntFunction uniformSymmetricGenerator(final int seed) {
     return new IntIntFunction() {
       private byte[] data = new byte[8];
 
       @Override
       public double apply(int row, int column) {
-        long d = ((long) row << Integer.SIZE) | (column & 0xffffffffl);
+        long d = ((long) row << Integer.SIZE) | (column & 0xffffffffL);
         for (int i = 0; i < 8; i++, d >>>= 8) data[i] = (byte) d;
         long hash = MurmurHash.hash64A(data, seed);
         return hash / UNIFORM_DIVISOR;
@@ -157,7 +155,7 @@ public final class Matrices {
    *
    * @param seed generator seed
    */
-  public static final IntIntFunction uniformGenerator(final int seed) {
+  public static IntIntFunction uniformGenerator(final int seed) {
     return Functions.chain(new DoubleFunction() {
       @Override
       public double apply(double x) {


Mime
View raw message