srowen commented on a change in pull request #25818: [SPARK-29121][ML][MLLIB]
Support for dot product operation on Vector(s)
URL: https://github.com/apache/spark/pull/25818#discussion_r325734099
##########
File path: mllib-local/src/main/scala/org/apache/spark/ml/linalg/Vectors.scala
##########
@@ -178,6 +178,13 @@ sealed trait Vector extends Serializable {
*/
@Since("2.0.0")
def argmax: Int
+
+ /**
+ * Calculate the dot product of this vector with another.
+ *
+ * If `size` does not match an [IllegalArgumentException] is thrown.
+ */
+ def dot(v: Vector): Double = BLAS.dot(this, v)
Review comment:
Oh, interesting, it already exists in Pyspark. It uses numpy directly.
This is a good change just for parity.
I don't think this exists in the same way in SparkR, so can be ignored.
I think this is fine then.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]