Github user da-steve101 commented on a diff in the pull request: https://github.com/apache/spark/pull/9020#discussion_r41593650 --- 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 -- problem is that toBreeze is private ( i don't think it should be but i felt i was overstepping to change that ). Also its just a bit annoying from programmers perspective. I can see what you are saying, I just think that extra step should be inside rather than outside. Really I think all the breeze operations should be defined for these vectors (or just use breeze vectors but I guess a single vector may need to be distributed).
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org