spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From feynmanliang <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-3976][MLlib] Added repartitioning for B...
Date Mon, 31 Aug 2015 22:50:41 GMT
Github user feynmanliang commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4286#discussion_r38369158
  
    --- Diff: mllib/src/main/scala/org/apache/spark/mllib/linalg/distributed/BlockMatrix.scala
---
    @@ -246,4 +246,135 @@ class BlockMatrix(
         val localMat = toLocalMatrix()
         new BDM[Double](localMat.numRows, localMat.numCols, localMat.toArray)
       }
    +
    +  /**
    +   * Forms [[MatrixBlock]]s using `rowsPerBlock` and `colsPerBlock`, which were provided
in
    +   * the constructor. Even if all [[MatrixBlock]]s (except the ones on the right and
bottom edge)
    +   * have dimensions `rowsPerBlock`x`colsPerBlock`, a new [[BlockMatrix]] will be returned.
    +   */
    +  def repartition(): BlockMatrix = {
    +    repartition(rowsPerBlock, colsPerBlock)
    +  }
    +
    +  /**
    +   * Forms [[MatrixBlock]]s using the provided dimensions `newRowsPerBlock`x`newColsPerBlock`
    +   * Even if all [[MatrixBlock]]s (except the ones on the right and bottom edge)
    +   * have dimensions `newRowsPerBlock`x`newColsPerBlock`, a new [[BlockMatrix]] will
be returned.
    +   * The resulting number of partitions may be different than the current number of partitions.
    +   *
    +   * @param newRowsPerBlock Number of rows that make up each MatrixBlock.
    +   * @param newColsPerBlock Number of columns that make up each MatrixBlock.
    +   * @return The repartitioned BlockMatrix
    +   */
    +  def repartition(newRowsPerBlock: Int, newColsPerBlock: Int): BlockMatrix = {
    +    repartition(newRowsPerBlock, newColsPerBlock, blocks.partitions.length)
    +  }
    +
    +  /**
    +   * Forms [[MatrixBlock]]s using the provided dimensions `newRowsPerBlock`x`newColsPerBlock`
    +   * Even if all [[MatrixBlock]]s (except the ones on the right and bottom edge)
    +   * have dimensions `newRowsPerBlock`x`newColsPerBlock`, a new [[BlockMatrix]] will
be returned.
    +   * The resulting number of partitions may be different than `suggestedNumPartitions`.
Assumes
    +   * that the offsets of each block is
    +   * (`blockRowIndex`x`rowsPerBlock`, `blockColIndex`x`colsPerBlock`).
    --- End diff --
    
    Instead of repeating the docs, I think it would suffice to just specify they delegate
to `repartition` with certain arguments set. Alternatively, instead of providing overloads
we could just provide default argumetns.


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

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


Mime
View raw message