Skip to content
Snippets Groups Projects
Commit 1b001b52 authored by Yanbo Liang's avatar Yanbo Liang
Browse files

[MINOR][ML][MLLIB] Remove work around for breeze sparse matrix.

## 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 <ybliang8@gmail.com>

Closes #14953 from yanboliang/matrices.
parent cdeb97a8
No related branches found
No related tags found
No related merge requests found
...@@ -846,16 +846,8 @@ object Matrices { ...@@ -846,16 +846,8 @@ object Matrices {
case dm: BDM[Double] => case dm: BDM[Double] =>
new DenseMatrix(dm.rows, dm.cols, dm.data, dm.isTranspose) new DenseMatrix(dm.rows, dm.cols, dm.data, dm.isTranspose)
case sm: BSM[Double] => 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 // 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 _ => case _ =>
throw new UnsupportedOperationException( throw new UnsupportedOperationException(
s"Do not support conversion from type ${breeze.getClass.getName}.") s"Do not support conversion from type ${breeze.getClass.getName}.")
......
...@@ -983,16 +983,8 @@ object Matrices { ...@@ -983,16 +983,8 @@ object Matrices {
case dm: BDM[Double] => case dm: BDM[Double] =>
new DenseMatrix(dm.rows, dm.cols, dm.data, dm.isTranspose) new DenseMatrix(dm.rows, dm.cols, dm.data, dm.isTranspose)
case sm: BSM[Double] => 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 // 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 _ => case _ =>
throw new UnsupportedOperationException( throw new UnsupportedOperationException(
s"Do not support conversion from type ${breeze.getClass.getName}.") s"Do not support conversion from type ${breeze.getClass.getName}.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment