Skip to content

Commit

Permalink
[MINOR][ML][MLLIB] Remove work around for breeze sparse matrix.
Browse files Browse the repository at this point in the history
## What changes were proposed in this pull request?
Since we have updated breeze version to 0.12, we should remove work around for bug of breeze sparse matrix in v0.11.
I checked all mllib code and found this is the only work around for breeze 0.11.

## How was this patch tested?
Existing tests.

Author: Yanbo Liang <[email protected]>

Closes apache#14953 from yanboliang/matrices.
  • Loading branch information
yanboliang committed Sep 4, 2016
1 parent cdeb97a commit 1b001b5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -846,16 +846,8 @@ object Matrices {
case dm: BDM[Double] =>
new DenseMatrix(dm.rows, dm.cols, dm.data, dm.isTranspose)
case sm: BSM[Double] =>
// Spark-11507. work around breeze issue 479.
val mat = if (sm.colPtrs.last != sm.data.length) {
val matCopy = sm.copy
matCopy.compact()
matCopy
} else {
sm
}
// There is no isTranspose flag for sparse matrices in Breeze
new SparseMatrix(mat.rows, mat.cols, mat.colPtrs, mat.rowIndices, mat.data)
new SparseMatrix(sm.rows, sm.cols, sm.colPtrs, sm.rowIndices, sm.data)
case _ =>
throw new UnsupportedOperationException(
s"Do not support conversion from type ${breeze.getClass.getName}.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -983,16 +983,8 @@ object Matrices {
case dm: BDM[Double] =>
new DenseMatrix(dm.rows, dm.cols, dm.data, dm.isTranspose)
case sm: BSM[Double] =>
// Spark-11507. work around breeze issue 479.
val mat = if (sm.colPtrs.last != sm.data.length) {
val matCopy = sm.copy
matCopy.compact()
matCopy
} else {
sm
}
// There is no isTranspose flag for sparse matrices in Breeze
new SparseMatrix(mat.rows, mat.cols, mat.colPtrs, mat.rowIndices, mat.data)
new SparseMatrix(sm.rows, sm.cols, sm.colPtrs, sm.rowIndices, sm.data)
case _ =>
throw new UnsupportedOperationException(
s"Do not support conversion from type ${breeze.getClass.getName}.")
Expand Down

0 comments on commit 1b001b5

Please sign in to comment.