Skip to content

Commit 19c17e8

Browse files
author
Burak Yavuz
committed
[SPARK-3974] Changed blockIdRow and blockIdCol
1 parent 589fbb6 commit 19c17e8

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

mllib/src/main/scala/org/apache/spark/mllib/linalg/distributed/BlockMatrix.scala

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,27 @@ import org.apache.spark.util.Utils
2828
/**
2929
* Represents a local matrix that makes up one block of a distributed BlockMatrix
3030
*
31-
* @param blockIdRow The row index of this block
32-
* @param blockIdCol The column index of this block
31+
* @param blockRowIndex The row index of this block
32+
* @param blockColIndex The column index of this block
3333
* @param mat The underlying local matrix
3434
*/
35-
case class SubMatrix(blockIdRow: Int, blockIdCol: Int, mat: DenseMatrix) extends Serializable
35+
case class SubMatrix(blockRowIndex: Int, blockColIndex: Int, mat: DenseMatrix) extends Serializable
3636

3737
/**
3838
* Information of the submatrices of the BlockMatrix maintained on the driver
3939
*
4040
* @param partitionId The id of the partition the block is found in
41-
* @param blockIdRow The row index of this block
42-
* @param blockIdCol The column index of this block
41+
* @param blockRowIndex The row index of this block
42+
* @param blockColIndex The column index of this block
4343
* @param startRow The starting row index with respect to the distributed BlockMatrix
4444
* @param numRows The number of rows in this block
4545
* @param startCol The starting column index with respect to the distributed BlockMatrix
4646
* @param numCols The number of columns in this block
4747
*/
4848
case class SubMatrixInfo(
4949
partitionId: Int,
50-
blockIdRow: Int,
51-
blockIdCol: Int,
50+
blockRowIndex: Int,
51+
blockColIndex: Int,
5252
startRow: Long,
5353
numRows: Int,
5454
startCol: Long,
@@ -228,7 +228,7 @@ class BlockMatrix(
228228
// collect may cause akka frameSize errors
229229
val blockStartRowColsParts = matrixRDD.mapPartitionsWithIndex { case (partId, iter) =>
230230
iter.map { case (id, block) =>
231-
((block.blockIdRow, block.blockIdCol), (partId, block.mat.numRows, block.mat.numCols))
231+
((block.blockRowIndex, block.blockColIndex), (partId, block.mat.numRows, block.mat.numCols))
232232
}
233233
}.collect()
234234
val blockStartRowCols = blockStartRowColsParts.sortBy(_._1)
@@ -283,9 +283,9 @@ class BlockMatrix(
283283
private def keyBy(part: BlockMatrixPartitioner = partitioner): RDD[(Int, SubMatrix)] = {
284284
rdd.map { block =>
285285
part match {
286-
case r: RowBasedPartitioner => (block.blockIdRow, block)
287-
case c: ColumnBasedPartitioner => (block.blockIdCol, block)
288-
case g: GridPartitioner => (block.blockIdRow + numRowBlocks * block.blockIdCol, block)
286+
case r: RowBasedPartitioner => (block.blockRowIndex, block)
287+
case c: ColumnBasedPartitioner => (block.blockColIndex, block)
288+
case g: GridPartitioner => (block.blockRowIndex + numRowBlocks * block.blockColIndex, block)
289289
case _ => throw new IllegalArgumentException("Unrecognized partitioner")
290290
}
291291
}
@@ -304,7 +304,7 @@ class BlockMatrix(
304304

305305
/** Collect the distributed matrix on the driver. */
306306
def collect(): DenseMatrix = {
307-
val parts = rdd.map(x => ((x.blockIdRow, x.blockIdCol), x.mat)).
307+
val parts = rdd.map(x => ((x.blockRowIndex, x.blockColIndex), x.mat)).
308308
collect().sortBy(x => (x._1._2, x._1._1))
309309
val nRows = numRows().toInt
310310
val nCols = numCols().toInt

0 commit comments

Comments
 (0)