Github user mengxr commented on a diff in the pull request:
https://github.com/apache/spark/pull/4109#discussion_r23589785
--- Diff: mllib/src/main/scala/org/apache/spark/mllib/linalg/Matrices.scala
---
@@ -114,7 +118,24 @@ class DenseMatrix(val numRows: Int, val numCols: Int,
val values: Array[Double])
require(values.length == numRows * numCols, "The number of values
supplied doesn't match the " +
s"size of the matrix! values.length: ${values.length}, numRows *
numCols: ${numRows * numCols}")
- override def toArray: Array[Double] = values
+ override def toArray: Array[Double] = {
+ if (!isTransposed) {
+ values
+ } else {
+ val transposedValues = new Array[Double](values.length)
--- End diff --
Use `foreachActive` and move this implementation to `Matrix`.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]