Github user brkyvz commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4109#discussion_r23573354
  
    --- Diff: mllib/src/main/scala/org/apache/spark/mllib/linalg/Matrices.scala 
---
    @@ -92,6 +84,16 @@ sealed trait Matrix extends Serializable {
         * backing array. For example, an operation such as addition or 
subtraction will only be
         * performed on the non-zero values in a `SparseMatrix`. */
       private[mllib] def update(f: Double => Double): Matrix
    +
    +  /**
    +   * Applies a function `f` to all the active elements of dense and sparse 
matrix.
    +   *
    +   * @param f the function takes three parameters where the first two 
parameters are the row
    +   *          and column indices respectively with the type `Int`, the 
third parameter is
    +   *          the corresponding array index, and the final parameter is 
the corresponding
    --- End diff --
    
    It is used especially for sparse matrices. For example in `horzcat` and 
`vertcat`, we already know how long the COO representation should be and we 
allocate an `Array` instead of an `ArrayBuffer`. There, to index `Array` 
correctly, we need `index`. It's not a bad thing that we can supply the `index` 
of the underlying storage.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to