Github user mengxr commented on a diff in the pull request:
https://github.com/apache/spark/pull/3462#discussion_r20915769
--- Diff: mllib/src/main/scala/org/apache/spark/mllib/linalg/Vectors.scala
---
@@ -85,6 +85,52 @@ sealed trait Vector extends Serializable {
* with type `Double`.
*/
private[spark] def foreachActive(f: (Int, Double) => Unit)
+
+ /**
+ * Returns the p-norm of this vector.
+ * @param p norm.
+ * @return norm in L^p^ space.
+ */
+ private[spark] def norm(p: Double): Double
+
+ protected def norm(p: Double, values: Array[Double]): Double = {
--- End diff --
I think we should move this method to `Vectors` because it is a static
method, like the following:
~~~
object Vectors {
private def norm(values: Array[Double], p: Double): Double = {
...
}
private[mllib] def norm(v: Vector, p: Double): Double = {
norm(v.values, p)
}
}
~~~
---
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]