Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/9362#discussion_r43456378
--- Diff: mllib/src/main/scala/org/apache/spark/mllib/linalg/Vectors.scala
---
@@ -712,6 +722,9 @@ class SparseVector @Since("1.0.0") (
}
}
+ @Since("1.6.0")
+ private[spark] def foreach(f: (Double) => Unit) = { indices.foreach { i:
Int => f(values(i)) } }
--- End diff --
Does it? this is just iterating over the indices defined in the sparse
vector. Hm, but i'm confused now.. the entries in `indices` are not indexes
into the array `values`, but indexes into the sparse vector. This will fail if
say indices=[3] and values=[0] when values[3] is dereferenced.
---
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]