This is due to the distributed matrices like BlockMatrix/RowMatrix/IndexedRowMatrix/CoordinateMatrix do not provide Java friendly constructors. I have file a SPARK-10757 <https://issues.apache.org/jira/browse/SPARK-10757> to track this issue.
2015-09-18 3:36 GMT+08:00 Pulasthi Supun Wickramasinghe < pulasthi...@gmail.com>: > Hi All, > > I am new to Spark and i am trying to do some BlockMatrix operations with > the Mllib API's. But i can't seem to create a BlockMatrix with the java > API. I tried the following > > Matrix matrixa = Matrices.rand(4, 4, new Random(1000)); > List<Tuple2<Tuple2<Integer,Integer>,Matrix>> list = new > ArrayList<Tuple2<Tuple2<Integer, Integer>, Matrix>>(); > Tuple2<Integer,Integer> intTuple = new Tuple2<Integer, Integer>(0,0); > Tuple2<Tuple2<Integer,Integer>,Matrix> tuple2MatrixTuple2 = new > Tuple2<Tuple2<Integer, Integer>, Matrix>(intTuple,matrixa ); > list.add(tuple2MatrixTuple2); > JavaRDD<Tuple2<Tuple2<Integer, Integer>, Matrix>> rdd = sc.parallelize(list); > > BlockMatrix blockMatrix = new BlockMatrix(rdd,2,2); > > > but since BlockMatrix only > takes > "RDD<scala.Tuple2<scala.Tuple2<java.lang.Object,java.lang.Object>,Matrix>>" > this code does not work. sc.parallelize() returns a JavaRDD so the two > are not compatible. I also couldn't find any code samples for this. Any > help on this would be highly appreciated. > > Best Regards, > Pulasthi > -- > Pulasthi S. Wickramasinghe > Graduate Student | Research Assistant > School of Informatics and Computing | Digital Science Center > Indiana University, Bloomington > cell: 224-386-9035 >