aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiang-Chi Hsieh <viirya@gmail.com>2015-05-15 10:03:29 -0700
committerXiangrui Meng <meng@databricks.com>2015-05-15 10:03:29 -0700
commitf96b85ab44b82736363764ea39ee62884007f4a3 (patch)
treefcf698a3933aea1d68f7671ac4d245649a057da2
parentc64ff8036cc6bc7c87743f4c751d7fe91c2e366a (diff)
downloadspark-f96b85ab44b82736363764ea39ee62884007f4a3.tar.gz
spark-f96b85ab44b82736363764ea39ee62884007f4a3.tar.bz2
spark-f96b85ab44b82736363764ea39ee62884007f4a3.zip
[SPARK-7668] [MLLIB] Preserve isTransposed property for Matrix after calling map function
JIRA: https://issues.apache.org/jira/browse/SPARK-7668 Author: Liang-Chi Hsieh <viirya@gmail.com> Closes #6188 from viirya/fix_matrix_map and squashes the following commits: 2a7cc97 [Liang-Chi Hsieh] Preserve isTransposed property for Matrix after calling map function.
-rw-r--r--mllib/src/main/scala/org/apache/spark/mllib/linalg/Matrices.scala5
1 files changed, 3 insertions, 2 deletions
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 3fa5e068d1..a609674df6 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
@@ -273,7 +273,8 @@ class DenseMatrix(
override def copy: DenseMatrix = new DenseMatrix(numRows, numCols, values.clone())
- private[mllib] def map(f: Double => Double) = new DenseMatrix(numRows, numCols, values.map(f))
+ private[mllib] def map(f: Double => Double) = new DenseMatrix(numRows, numCols, values.map(f),
+ isTransposed)
private[mllib] def update(f: Double => Double): DenseMatrix = {
val len = values.length
@@ -535,7 +536,7 @@ class SparseMatrix(
}
private[mllib] def map(f: Double => Double) =
- new SparseMatrix(numRows, numCols, colPtrs, rowIndices, values.map(f))
+ new SparseMatrix(numRows, numCols, colPtrs, rowIndices, values.map(f), isTransposed)
private[mllib] def update(f: Double => Double): SparseMatrix = {
val len = values.length