[Rcpp-devel] Help with SubMatrix test case

Christian Gunning xian at unm.edu
Sat Dec 4 03:45:30 CET 2010


In this test case, I expected yy to be a proper subset of xx.  I
confess that I don't understand the results at all, but I'm assuming
that the Row/Column exchange is involved. Am I missing anything?

thanks,
christian

src <- '
     NumericMatrix xx(4, 5);
     xx(0,0) = 3;
     xx(0,1) = 4;
     xx(0,2) = 5;
       Rf_PrintValue(xx);
     xx(1,_) = xx(0,_);
       Rf_PrintValue(xx);
     xx(_,3) = xx(_,2);
       Rf_PrintValue(xx);
     SubMatrix<REALSXP> yy = xx( Range(0,2), Range(0,3) ) ;
       Rf_PrintValue(wrap(yy));
     return(wrap(yy));
 '

myfun <- cxxfunction( , src, plugin='Rcpp')

aa = myfun()


More information about the Rcpp-devel mailing list