@@ -22,7 +22,6 @@ import breeze.linalg.{DenseMatrix => BDM}
2222import org .apache .spark ._
2323import org .apache .spark .mllib .linalg .DenseMatrix
2424import org .apache .spark .rdd .RDD
25- import org .apache .spark .SparkContext ._
2625import org .apache .spark .storage .StorageLevel
2726import org .apache .spark .util .Utils
2827
@@ -218,8 +217,8 @@ class BlockMatrix(
218217 (xDim, yDim)
219218 }
220219
220+ /* Calculates the information for each block and collects it on the driver */
221221 private def calculateBlockInfo (): Unit = {
222-
223222 // collect may cause akka frameSize errors
224223 val blockStartRowColsParts = matrixRDD.mapPartitionsWithIndex { case (partId, iter) =>
225224 iter.map { case (id, block) =>
@@ -274,6 +273,7 @@ class BlockMatrix(
274273 this
275274 }
276275
276+ /* Add a key to the underlying rdd for partitioning and joins. */
277277 private def keyBy (part : BlockMatrixPartitioner = partitioner): RDD [(Int , BlockPartition )] = {
278278 rdd.map { block =>
279279 part match {
@@ -285,6 +285,12 @@ class BlockMatrix(
285285 }
286286 }
287287
288+ /**
289+ * Repartition the BlockMatrix using a different partitioner.
290+ *
291+ * @param part The partitioner to partition by
292+ * @return The repartitioned BlockMatrix
293+ */
288294 def repartition (part : BlockMatrixPartitioner = partitioner): DistributedMatrix = {
289295 matrixRDD = keyBy(part)
290296 this
0 commit comments