diff options
author | Yanbo Liang <ybliang8@gmail.com> | 2016-09-04 05:38:47 -0700 |
---|---|---|
committer | Yanbo Liang <ybliang8@gmail.com> | 2016-09-04 05:38:47 -0700 |
commit | 1b001b5203444cc8d5c4887a30e03e8fb298d17d (patch) | |
tree | c46d3e52bbba448c2fb84f47e866c56041c7cb14 | |
parent | cdeb97a8cd26e3282cc2a4f126242ed2199f3898 (diff) | |
download | spark-1b001b5203444cc8d5c4887a30e03e8fb298d17d.tar.gz spark-1b001b5203444cc8d5c4887a30e03e8fb298d17d.tar.bz2 spark-1b001b5203444cc8d5c4887a30e03e8fb298d17d.zip |
[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.
-rw-r--r-- | mllib-local/src/main/scala/org/apache/spark/ml/linalg/Matrices.scala | 10 | ||||
-rw-r--r-- | mllib/src/main/scala/org/apache/spark/mllib/linalg/Matrices.scala | 10 |
2 files changed, 2 insertions, 18 deletions
diff --git a/mllib-local/src/main/scala/org/apache/spark/ml/linalg/Matrices.scala b/mllib-local/src/main/scala/org/apache/spark/ml/linalg/Matrices.scala index 98080bb71a..207f662e33 100644 --- a/mllib-local/src/main/scala/org/apache/spark/ml/linalg/Matrices.scala +++ b/mllib-local/src/main/scala/org/apache/spark/ml/linalg/Matrices.scala @@ -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}.") diff --git a/mllib/src/main/scala/org/apache/spark/mllib/linalg/Matrices.scala b/mllib/src/main/scala/org/apache/spark/mllib/linalg/Matrices.scala index ad882c969a..8659cea4b8 100644 --- a/mllib/src/main/scala/org/apache/spark/mllib/linalg/Matrices.scala +++ b/mllib/src/main/scala/org/apache/spark/mllib/linalg/Matrices.scala @@ -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}.") |