
CodePudding user response:
import org. Apache. Spark. Mllib. Linalg. Vectors
The import org. Apache. Spark. Mllib. Linalg. Distributed. RowMatrix
Val rawRdd=spark. SparkContext. Parallelize (Array (" 12, 32 ", "125125", "13, 35"))
Val vectors=rawRdd. The map (_. The split () ", "). The map (_ the toArray [Double]). The map (g=& gt; Vectors. Dense (g))
Val rm=new RowMatrix (vectors)
Scala 2.11.12