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

    https://github.com/apache/spark/pull/15628#discussion_r107556503
  
    --- Diff: 
mllib-local/src/main/scala/org/apache/spark/ml/linalg/Matrices.scala ---
    @@ -587,18 +722,69 @@ class SparseMatrix @Since("2.0.0") (
         }
       }
     
    +  override def numNonzeros: Int = values.count(_ != 0)
    +
    +  override def numActives: Int = values.length
    +
       /**
    -   * Generate a `DenseMatrix` from the given `SparseMatrix`. The new 
matrix will have isTransposed
    -   * set to false.
    +   * Generate a `SparseMatrix` from this `SparseMatrix`, removing explicit 
zero values if they
    +   * exist.
    +   *
    +   * @param colMajor Whether or not the resulting `SparseMatrix` values 
are in column major
    +   *                    order.
        */
    -  @Since("2.0.0")
    -  def toDense: DenseMatrix = {
    -    new DenseMatrix(numRows, numCols, toArray)
    +  private[ml] override def toSparseMatrix(colMajor: Boolean): SparseMatrix 
= {
    +    if (!(colMajor ^ isTransposed)) {
    +      // breeze transpose rearranges values in column major and removes 
explicit zeros
    --- End diff --
    
    This is not a blocker.


---
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