Hi Pulasthi You can always use JavaRDD.rdd() to get the scala rdd. So in your case,
new BlockMatrix(rdd.rdd(), 2, 2) should work. Regards Sab On Tue, Sep 22, 2015 at 10:50 PM, Pulasthi Supun Wickramasinghe < [email protected]> wrote: > Hi Yanbo, > > Thanks for the reply. I thought i might be missing something. Anyway i > moved to using scala since it is the complete API. > > Best Regards, > Pulasthi > > On Tue, Sep 22, 2015 at 7:03 AM, Yanbo Liang <[email protected]> wrote: > >> 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 < >> [email protected]>: >> >>> 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 >>> >> >> > > > -- > Pulasthi S. Wickramasinghe > Graduate Student | Research Assistant > School of Informatics and Computing | Digital Science Center > Indiana University, Bloomington > cell: 224-386-9035 > -- Architect - Big Data Ph: +91 99805 99458 Manthan Systems | *Company of the year - Analytics (2014 Frost and Sullivan India ICT)* +++
