You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by sm...@apache.org on 2015/11/08 03:02:35 UTC
mahout git commit: NOJIRA: minor fixes
Repository: mahout
Updated Branches:
refs/heads/master 115ae609a -> c2b077f0a
NOJIRA: minor fixes
Project: http://git-wip-us.apache.org/repos/asf/mahout/repo
Commit: http://git-wip-us.apache.org/repos/asf/mahout/commit/c2b077f0
Tree: http://git-wip-us.apache.org/repos/asf/mahout/tree/c2b077f0
Diff: http://git-wip-us.apache.org/repos/asf/mahout/diff/c2b077f0
Branch: refs/heads/master
Commit: c2b077f0a22ffbf1ca6c74d694bfadda06d6db44
Parents: 115ae60
Author: smarthi <sm...@apache.org>
Authored: Sat Nov 7 21:01:55 2015 -0500
Committer: smarthi <sm...@apache.org>
Committed: Sat Nov 7 21:01:55 2015 -0500
----------------------------------------------------------------------
.../mahout/math/scalabindings/package.scala | 3 +--
.../mahout/math/scalabindings/MathSuite.scala | 20 +++++++++-----------
.../org/apache/mahout/math/SparseMatrix.java | 1 -
.../mahout/sparkbindings/io/IOSuite.scala | 6 +++---
4 files changed, 13 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mahout/blob/c2b077f0/math-scala/src/main/scala/org/apache/mahout/math/scalabindings/package.scala
----------------------------------------------------------------------
diff --git a/math-scala/src/main/scala/org/apache/mahout/math/scalabindings/package.scala b/math-scala/src/main/scala/org/apache/mahout/math/scalabindings/package.scala
index 7ff09bf..426996b 100644
--- a/math-scala/src/main/scala/org/apache/mahout/math/scalabindings/package.scala
+++ b/math-scala/src/main/scala/org/apache/mahout/math/scalabindings/package.scala
@@ -19,7 +19,6 @@ package org.apache.mahout.math
import org.apache.mahout.math.solver.EigenDecomposition
import collection._
-import JavaConversions._
/**
* Mahout matrices and vectors' scala syntactic sugar
@@ -197,7 +196,7 @@ package object scalabindings {
* @return
*/
def svec(sdata: TraversableOnce[(Int, AnyVal)]) = {
- val cardinality = if (sdata.size > 0) sdata.map(_._1).max + 1 else 0
+ val cardinality = if (sdata.nonEmpty) sdata.map(_._1).max + 1 else 0
val initialCapacity = sdata.size
val sv = new RandomAccessSparseVector(cardinality, initialCapacity)
sdata.foreach(t ⇒ sv.setQuick(t._1, t._2.asInstanceOf[Number].doubleValue()))
http://git-wip-us.apache.org/repos/asf/mahout/blob/c2b077f0/math-scala/src/test/scala/org/apache/mahout/math/scalabindings/MathSuite.scala
----------------------------------------------------------------------
diff --git a/math-scala/src/test/scala/org/apache/mahout/math/scalabindings/MathSuite.scala b/math-scala/src/test/scala/org/apache/mahout/math/scalabindings/MathSuite.scala
index bcfe109..0503e49 100644
--- a/math-scala/src/test/scala/org/apache/mahout/math/scalabindings/MathSuite.scala
+++ b/math-scala/src/test/scala/org/apache/mahout/math/scalabindings/MathSuite.scala
@@ -18,14 +18,12 @@
package org.apache.mahout.math.scalabindings
import org.apache.mahout.logging._
-import org.scalatest.{Matchers, FunSuite}
import org.apache.mahout.math._
-import scala.math._
-import RLikeOps._
-import scala._
-import scala.util.Random
+import org.apache.mahout.math.scalabindings.RLikeOps._
import org.apache.mahout.test.MahoutSuite
-import org.apache.mahout.common.RandomUtils
+import org.scalatest.FunSuite
+
+import scala.math._
class MathSuite extends FunSuite with MahoutSuite {
@@ -91,9 +89,9 @@ class MathSuite extends FunSuite with MahoutSuite {
val b = dense(
- (0.36378319648203084),
- (0.3627384439613304),
- (0.2996934112658234))
+ 0.36378319648203084,
+ 0.3627384439613304,
+ 0.2996934112658234)
printf("B=\n%s\n", b)
@@ -141,10 +139,10 @@ class MathSuite extends FunSuite with MahoutSuite {
test("solve matrix-matrix") {
val a = dense((1, 3), (4, 2))
- val b = dense((11), (14))
+ val b = dense(11, 14)
val x = solve(a, b)
- val control = dense((2), (3))
+ val control = dense(2, 3)
(control - x).norm should be < 1e-10
}
http://git-wip-us.apache.org/repos/asf/mahout/blob/c2b077f0/math/src/main/java/org/apache/mahout/math/SparseMatrix.java
----------------------------------------------------------------------
diff --git a/math/src/main/java/org/apache/mahout/math/SparseMatrix.java b/math/src/main/java/org/apache/mahout/math/SparseMatrix.java
index bf4f1a0..520778c 100644
--- a/math/src/main/java/org/apache/mahout/math/SparseMatrix.java
+++ b/math/src/main/java/org/apache/mahout/math/SparseMatrix.java
@@ -19,7 +19,6 @@ package org.apache.mahout.math;
import com.google.common.collect.AbstractIterator;
import org.apache.mahout.math.flavor.MatrixFlavor;
-import org.apache.mahout.math.flavor.TraversingStructureEnum;
import org.apache.mahout.math.function.DoubleDoubleFunction;
import org.apache.mahout.math.function.Functions;
import org.apache.mahout.math.function.IntObjectProcedure;
http://git-wip-us.apache.org/repos/asf/mahout/blob/c2b077f0/spark/src/test/scala/org/apache/mahout/sparkbindings/io/IOSuite.scala
----------------------------------------------------------------------
diff --git a/spark/src/test/scala/org/apache/mahout/sparkbindings/io/IOSuite.scala b/spark/src/test/scala/org/apache/mahout/sparkbindings/io/IOSuite.scala
index f3a9721..1814f17 100644
--- a/spark/src/test/scala/org/apache/mahout/sparkbindings/io/IOSuite.scala
+++ b/spark/src/test/scala/org/apache/mahout/sparkbindings/io/IOSuite.scala
@@ -116,11 +116,11 @@ class IOSuite extends FunSuite with MahoutSuite {
mxC(i, ::) := { _ => if (rnd.nextDouble() < .3) rnd.nextDouble() else 0.0}
val cnsl = mxC.numSlices()
- println(s"Number of slices in mxC: ${cnsl}")
+ println(s"Number of slices in mxC: $cnsl")
val ret = kryoClone(mxA, mxA.t, mxB, mxB.t, mxC, mxC.t, mxA)
- val (mxAA, mxAAt, mxBB, mxBBt, mxCC, mxCCt, mxAAA) = (ret(0), ret(1), ret(2), ret(3), ret(4), ret(5), ret(6))
+ val (mxAA, mxAAt, mxBB, mxBBt, mxCC, mxCCt, mxAAA) = (ret.head, ret(1), ret(2), ret(3), ret(4), ret(5), ret(6))
// ret.size shouldBe 7
@@ -163,7 +163,7 @@ class IOSuite extends FunSuite with MahoutSuite {
test("diag matrix") {
val mxD = diagv(dvec(1, 2, 3, 5))
- val mxDD = kryoClone(mxD)(0)
+ val mxDD = kryoClone(mxD).head
mxD === mxDD shouldBe true
mxDD.isInstanceOf[DiagonalMatrix] shouldBe true