Github user vrilleup commented on a diff in the pull request:
https://github.com/apache/spark/pull/964#discussion_r13896272
--- Diff:
mllib/src/main/scala/org/apache/spark/mllib/linalg/distributed/RowMatrix.scala
---
@@ -201,6 +202,31 @@ class RowMatrix(
}
/**
+ * Multiply the Gramian matrix `A^T A` by a DenseVector on the right.
+ *
+ * @param v a local DenseVector whose length must match the number of
columns of this matrix.
+ * @return a local DenseVector representing the product.
+ */
+ private[mllib] def multiplyGramianMatrix(v: DenseVector): DenseVector = {
+ val n = numCols().toInt
+
+ val bv = rows.aggregate(BDV.zeros[Double](n))(
+ seqOp = (U, r) => {
+ val rBrz = r.toBreeze
+ val a = rBrz.dot(v.toBreeze)
+ rBrz match {
+ case _: BDV[_] => brzAxpy(a, rBrz.asInstanceOf[BDV[Double]], U)
--- End diff --
breeze uses UFunc with implicit matching. Here we need to explicitly
specify the type, otherwise the compiler complains, e.g. "Could not find an
inplace implicit implementation for this UFunc with arguments
breeze.linalg.DenseVector[Double], Double, breeze.linalg.Vector[Double]"
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---