zhengruifeng commented on a change in pull request #26982: [SPARK-30329][ML]
add iterator/foreach methods for Vectors
URL: https://github.com/apache/spark/pull/26982#discussion_r361585635
##########
File path: mllib-local/src/main/scala/org/apache/spark/ml/linalg/Vectors.scala
##########
@@ -109,6 +109,16 @@ sealed trait Vector extends Serializable {
throw new UnsupportedOperationException(s"copy is not implemented for
${this.getClass}.")
}
+ /**
+ * Applies a function `f` to all the elements of dense and sparse vector.
+ *
+ * @param f the function takes two parameters where the first parameter is
the index of
+ * the vector with type `Int`, and the second parameter is the
corresponding value
+ * with type `Double`.
+ */
+ private[spark] def foreach(f: (Int, Double) => Unit): Unit =
Review comment:
Seem not needed, I will remove `foreach` and `foreachNonZero`
----------------------------------------------------------------
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]