Skip to content

Commit 75181e4

Browse files
committed
update comments
1 parent 1588e56 commit 75181e4

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

mllib/src/main/scala/org/apache/spark/mllib/linalg/Matrices.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -940,11 +940,14 @@ object Matrices {
940940
case dm: BDM[Double] =>
941941
new DenseMatrix(dm.rows, dm.cols, dm.data, dm.isTranspose)
942942
case sm: BSM[Double] =>
943-
val mat = if(sm.colPtrs.last != sm.data.length) {
943+
// Spark-11507. work around breeze issue 479.
944+
val mat = if (sm.colPtrs.last != sm.data.length) {
944945
val matCopy = sm.copy
945946
matCopy.compact()
946947
matCopy
947-
} else sm
948+
} else {
949+
sm
950+
}
948951
// There is no isTranspose flag for sparse matrices in Breeze
949952
new SparseMatrix(mat.rows, mat.cols, mat.colPtrs, mat.rowIndices, mat.data)
950953
case _ =>

mllib/src/test/scala/org/apache/spark/mllib/linalg/MatricesSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ class MatricesSuite extends SparkFunSuite {
498498

499499
test("fromBreeze with sparse matrix") {
500500
// colPtr.last does NOT always equal to values.length in breeze SCSMatrix and
501-
// invocation of compact() is necessary. Refer to SPARK-11507
501+
// invocation of compact() may be necessary. Refer to SPARK-11507
502502
val bm1: BM[Double] = new CSCMatrix[Double](
503503
Array(1.0, 1, 1), 3, 3, Array(0, 1, 2, 3), Array(0, 1, 2))
504504
val bm2: BM[Double] = new CSCMatrix[Double](

0 commit comments

Comments
 (0)