aboutsummaryrefslogtreecommitdiff
path: root/mllib
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:44 -0700
commitd1f5651004449dad5fc4bf5d4ba3b2888f6b900a (patch)
tree063b0dd08677e03db5a3711d806de7fcb5a188f9 /mllib
parenta17a0ee776921e53b4477f15d8c5101d02afc9d1 (diff)
downloadspark-d1f5651004449dad5fc4bf5d4ba3b2888f6b900a.tar.gz
spark-d1f5651004449dad5fc4bf5d4ba3b2888f6b900a.tar.bz2
spark-d1f5651004449dad5fc4bf5d4ba3b2888f6b900a.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. (cherry picked from commit f96b85ab44b82736363764ea39ee62884007f4a3) Signed-off-by: Xiangrui Meng <meng@databricks.com>
Diffstat (limited to 'mllib')
-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