Github user jkbradley commented on a diff in the pull request:
https://github.com/apache/spark/pull/5756#discussion_r29301001
--- Diff: mllib/src/main/scala/org/apache/spark/mllib/linalg/Vectors.scala
---
@@ -525,6 +558,34 @@ class DenseVector(val values: Array[Double]) extends
Vector {
}
result
}
+
+ override def numActives: Int = size
+
+ override def numNonzeros: Int = {
+ // same as values.count(_ != 0.0) but faster
+ var nnz = 0
+ values.foreach { v =>
--- End diff --
Is foreach as fast as a while loop?
---
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]