Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/9020#discussion_r41539167
--- Diff: mllib/src/main/scala/org/apache/spark/mllib/linalg/Vectors.scala
---
@@ -512,6 +513,92 @@ object Vectors {
squaredDistance
}
+ private def dot(a : DenseVector, b : DenseVector) : Double = {
+ (a.toArray zip b.toArray).map(x => (x._1 * x._2)).sum
+ }
+
+ private def dot(a : SparseVector, b : DenseVector) : Double = {
+ (a.indices zip a.values).map(x => { b(x._1)*x._2 }).sum
--- End diff --
What I mean is that you can already just call Breeze for this without any
code change in Spark, using `toBreeze`. It's easy; I get that it sometimes
involves a copy. Do we have a compelling case for needing this enough and
needing it to be fast in Spark that it should be added to `Vector`? I ask just
because I don't see anything changed to call it.
---
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.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]