This works for me

import org.apache.spark.mllib.linalg._
import org.apache.spark.mllib.linalg.distributed.RowMatrix

val v1=Vectors.dense(Array(1d,2d))

val v2=Vectors.dense(Array(3d,4d))

val rows=sc.parallelize(List(v1,v2))

val mat=new RowMatrix(rows)

val svd: SingularValueDecomposition[RowMatrix, Matrix] =
mat.computeSVD(2, computeU = true)

​

On Wed, Oct 22, 2014 at 1:55 AM, viola <viola.wiersc...@siemens.com> wrote:

> Thanks for the quick response. However, I still only get error messages. I
> am
> able to load a .txt file with entries in it and use it in sparks, but I am
> not able to create a simple matrix, for instance a 2x2 row matrix
> [1 2
> 3 4]
> I tried variations such as
> val RowMatrix = Matrix(2,2,array(1,3,2,4))
> but it doesn't work..
>
>
>
>
>
> --
> View this message in context:
> http://apache-spark-user-list.1001560.n3.nabble.com/create-a-Row-Matrix-tp16913p16993.html
> Sent from the Apache Spark User List mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@spark.apache.org
> For additional commands, e-mail: user-h...@spark.apache.org
>
>

Reply via email to