
10.6. SOME TIMING COMPARISONS 229
which returns true if x > y. Due to the way Thrust’s sort function is
set up, this amounts to specifying a descending-order sort. But we could
set up a custom sort, with our own comparison function tailored to our
application.
The fact that Rcpp and Thrust are both modeled after C++ STL makes
them rather similar to each other; learn one, and then learning the other is
much easier. Thus statements such as
t h r u s t : : copy ( dx . begin () , dx . end ( ) , xb . begin ( ) ) ;
are straightforward.
10.6 Some Timing Comparisons
Here we compare R’s built-in serial sort(), our multicore implementation
of Bucket Sort, and Rth ...