diff options
Diffstat (limited to 'examples/src')
-rw-r--r-- | examples/src/main/scala/org/apache/spark/examples/SparkSVD.scala | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/examples/src/main/scala/org/apache/spark/examples/SparkSVD.scala b/examples/src/main/scala/org/apache/spark/examples/SparkSVD.scala index 5590ee728a..4b9e674c68 100644 --- a/examples/src/main/scala/org/apache/spark/examples/SparkSVD.scala +++ b/examples/src/main/scala/org/apache/spark/examples/SparkSVD.scala @@ -20,6 +20,7 @@ package org.apache.spark.examples import org.apache.spark.SparkContext import org.apache.spark.mllib.linalg.SVD import org.apache.spark.mllib.linalg.MatrixEntry +import org.apache.spark.mllib.linalg.SparseMatrix /** * Compute SVD of an example matrix @@ -48,10 +49,10 @@ object SparkSVD { val n = 4 // recover largest singular vector - val decomposed = SVD.sparseSVD(data, m, n, 1) - val u = decomposed.U - val s = decomposed.S - val v = decomposed.V + val decomposed = SVD.sparseSVD(SparseMatrix(data, m, n), 1) + val u = decomposed.U.data + val s = decomposed.S.data + val v = decomposed.V.data println("singular values = " + s.toArray.mkString) } |