<div dir="ltr">there is an example of using OpenMP for this:<div><br></div><div><a href="http://dirk.eddelbuettel.com/code/rcpp/html/OpenMP_2OpenMPandInline_8r-example.html">http://dirk.eddelbuettel.com/code/rcpp/html/OpenMP_2OpenMPandInline_8r-example.html</a><br>

</div><div><br></div><div style>thanks Dirk :-)</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Feb 14, 2013 at 3:43 AM, Zhao Yang <span dir="ltr"><<a href="mailto:kikyoyangz@gmail.com" target="_blank">kikyoyangz@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
Firstly, I would like to thank the develops of Rcpp for this tool.<br>
<br>
Then, here is the function:<br>
-----------------------------<br>
code<-'<br>
NumericVector my_id(id);<br>
NumericMatrix my_link(link);<br>
NumericVector lst(1000);<br>
<br>
for (int i=0;i<1000;i++){<br>
for (int j=0;j<1000;j++){<br>
if (my_link(my_id[i],my_id[j])==1){<br>
lst[i]+=1;}}}<br>
return lst;<br>
'<br>
fun<-cxxfunction(signature(id="numeric",link="numeric"),body=code,plugin="Rcpp")<br>
------------------------------<br>
<br>
And my question is: How to use multicores to calculate the loop and output the final result?<br>
<br>
Thank you.<br>
<br>
Best,<br>
Zhao<br>
_______________________________________________<br>
Rcpp-devel mailing list<br>
<a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><i>A model is a lie that helps you see the truth.</i><div><i><br></i><div><a href="http://cancerres.aacrjournals.org/content/31/9/1173.full.pdf" target="_blank">Howard Skipper</a></div>

</div>
</div>