Github user mengxr commented on a diff in the pull request:
https://github.com/apache/spark/pull/4256#discussion_r23739809
--- Diff:
mllib/src/main/scala/org/apache/spark/mllib/linalg/distributed/IndexedRowMatrix.scala
---
@@ -75,6 +77,23 @@ class IndexedRowMatrix(
new RowMatrix(rows.map(_.vector), 0L, nCols)
}
+ /** Converts to BlockMatrix. Creates blocks of size 1024 x 1024. */
+ def toBlockMatrix(): BlockMatrix = {
+ toBlockMatrix(1024, 1024)
+ }
+
+ /**
+ * Converts to BlockMatrix.
+ * @param rowsPerBlock The number of rows of each block. The blocks at
the bottom edge may have
+ * a smaller value. Must be an integer value greater
than 0.
+ * @param colsPerBlock The number of columns of each block. The blocks
at the right edge may have
+ * a smaller value. Must be an integer value greater
than 0.
+ * @return a `BlockMatrix`
+ */
+ def toBlockMatrix(rowsPerBlock: Int, colsPerBlock: Int): BlockMatrix = {
+ toCoordinateMatrix().toBlockMatrix(rowsPerBlock, colsPerBlock)
--- End diff --
Add a TODO here as well. This could be improved.
---
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]