[Rcpp-devel] parallelization in Rcpp

Zhao Yang kikyoyangz at gmail.com
Thu Feb 14 12:43:10 CET 2013


Hello,

Firstly, I would like to thank the develops of Rcpp for this tool.

Then, here is the function:
-----------------------------
code<-'
NumericVector my_id(id);
NumericMatrix my_link(link);
NumericVector lst(1000);

for (int i=0;i<1000;i++){
for (int j=0;j<1000;j++){
if (my_link(my_id[i],my_id[j])==1){
lst[i]+=1;}}}
return lst;
'
fun<-cxxfunction(signature(id="numeric",link="numeric"),body=code,plugin="Rcpp")
------------------------------

And my question is: How to use multicores to calculate the loop and output the final result? 

Thank you.

Best,
Zhao


More information about the Rcpp-devel mailing list