<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">> Update -- I've implemented all of R's sample (with identical results)<br>
> except for the walker alias method.  I used Armadillo for ProbSampleReplace<br>
> and ProbSampleNoReplace, since there's no good STL replacement for R's<br>
> revsort.<br>
<br>
Out of curiosity, what does revsort do? It must be something beyond just<br>
a reverse-order sort?<br>
<br>
Darren<br>
<br>
P.S. I don't have an R function of that name. Googling found it used in<br>
random.c but not where its defined!</blockquote></div><br>(BTW, if you CC the poster, it's marginally easier to reply to.)<br><br>Today I learned that revsort is an exported function from the R API, and is therefore in the bible (6:10):  <br>

<a href="http://cran.r-project.org/doc/manuals/R-exts.html#Utility-functions">http://cran.r-project.org/doc/manuals/R-exts.html#Utility-functions</a><br><br>revsort just does the following two operations in a single function call (via scary pointer magic -- Boo!).  Also, boost lambda turns up as another way to accomplish this:<br>

<a href="http://arma.sourceforge.net/docs.html#sort_index">http://arma.sourceforge.net/docs.html#sort_index</a><br><a href="http://arma.sourceforge.net/docs.html#sort">http://arma.sourceforge.net/docs.html#sort</a><br><br>

-Christian<br>