aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mllib/src/main/scala/org/apache/spark/mllib/linalg/distributed/RowMatrix.scala8
1 files changed, 7 insertions, 1 deletions
diff --git a/mllib/src/main/scala/org/apache/spark/mllib/linalg/distributed/RowMatrix.scala b/mllib/src/main/scala/org/apache/spark/mllib/linalg/distributed/RowMatrix.scala
index 711e32a330..f4c403bc78 100644
--- a/mllib/src/main/scala/org/apache/spark/mllib/linalg/distributed/RowMatrix.scala
+++ b/mllib/src/main/scala/org/apache/spark/mllib/linalg/distributed/RowMatrix.scala
@@ -83,7 +83,13 @@ class RowMatrix(
seqOp = (U, r) => {
val rBrz = r.toBreeze
val a = rBrz.dot(vbr.value)
- brzAxpy(a, rBrz, U.asInstanceOf[BV[Double]])
+ rBrz match {
+ // use specialized axpy for better performance
+ case _: BDV[_] => brzAxpy(a, rBrz.asInstanceOf[BDV[Double]], U)
+ case _: BSV[_] => brzAxpy(a, rBrz.asInstanceOf[BSV[Double]], U)
+ case _ => throw new UnsupportedOperationException(
+ s"Do not support vector operation from type ${rBrz.getClass.getName}.")
+ }
U
},
combOp = (U1, U2) => U1 += U2