Github user jmabuin commented on a diff in the pull request:
https://github.com/apache/spark/pull/13468#discussion_r65574364
--- Diff:
mllib-local/src/main/scala/org/apache/spark/ml/linalg/Vectors.scala ---
@@ -537,6 +537,22 @@ class DenseVector @Since("2.0.0") ( @Since("2.0.0")
val values: Array[Double]) e
maxIdx
}
}
+
+ /**
+ * Function that returns the result of multiply this DenseVector by
another DenseVector.
+ *
+ * @param other The second DenseVector
+ * @return The resulting Double value
+ */
+ def dot(other: DenseVector): Double = {
+ require(this.size == other.size, "DenseVectors dimmensions must be the
same." +
--- End diff --
Yes, it is a call to an existing method. But the BLAS class is private and
you can only call it from the linalg package. If a normal user wants to do a
dot product in the spark-shell or in a Spark program, he/she can not do it. The
same thing happens with the rest of the BLAS functions.
An example:
```
scala> import org.apache.spark.mllib.linalg.BLAS
import org.apache.spark.mllib.linalg.BLAS
scala> import org.apache.spark.mllib.linalg.DenseVector
import org.apache.spark.mllib.linalg.DenseVector
scala> val a = new DenseVector(Array[Double](1,2,3,4))
a: org.apache.spark.mllib.linalg.DenseVector = [1.0,2.0,3.0,4.0]
scala> val b = new DenseVector(Array[Double](1,2,3,4))
b: org.apache.spark.mllib.linalg.DenseVector = [1.0,2.0,3.0,4.0]
scala> BLAS.dot(a,b)
<console>:30: error: object BLAS in package linalg cannot be accessed in
package org.apache.spark.mllib.linalg
BLAS.dot(a,b)
^
scala>
```
Also, as I said, this is my first contribution and I wanted to start with
something simple ;)
PS: Sorry for the typo and indentation.
---
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]