Github user brkyvz commented on a diff in the pull request: https://github.com/apache/spark/pull/4109#discussion_r23278231 --- Diff: mllib/src/main/scala/org/apache/spark/mllib/linalg/Matrices.scala --- @@ -114,21 +106,47 @@ 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] = { --- End diff -- We promise the users a dense array in column-major ordering. If a user calls `A.transpose.toArray`, that's what we must return. Unfortunately it won't be cheap if it's called on a transposed matrix. Since none of the previous code had `transpose` in it, it won't cause regressions. Do you think it would make sense to `materialize` the array and reset `isTransposed` if toArray is called, so that if toArray is called again, it won't continuously do the same loop?
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org