Blog Archives

Disambiguating Rcpp11 and Rcpp

May 27, 2014
By

I pushed some code this morning to allow us to use this alternative syntax to use Rcpp11. #include <Rcpp11> using namespace Rcpp11 ; Of course the usual code will continue to work, and might even be preferable if you write code that needs to...

Read more »

Disambiguating Rcpp11 and Rcpp

May 27, 2014
By
Disambiguating Rcpp11 and Rcpp

I pushed some code this morning to allow us to use this alternative syntax to use Rcpp11. #include <Rcpp11> using namespace Rcpp11 ; Of course the usual code will continue to work, and might even be preferable if you write code that needs...

Read more »

Modernizing sugar in Rcpp11

May 26, 2014
By
Modernizing sugar in Rcpp11

I'm in the process of modernizing the implementation of sugar in Rcpp11. Previous work already improved performance of sugar by allowing sugar classes themselves to implement how to apply themselves into their target vector. For example the sugar class SeqLen leverages std::iota instead of a manual for loop. template <typename Target> inline...

Read more »

Vectorized vs Devectorized

May 24, 2014
By

This gist from @hadley has been on my mind for some time. This was already a follow up of this post from @johnmyleswhite. The problem was that sugar vectorised code suffered a performance penalty compared to devectorised code. This is particularly troubling me because the whole point of sugar is to have nice syntax without...

Read more »

Vectorized vs Devectorized

May 24, 2014
By

This gist from @hadley has been on my mind for some time. This was already a follow up of this post from @johnmyleswhite. The problem was that sugar vectorised code suffered a performance penalty compared to devectorised code. This is particularly troubling me because the whole point of sugar is to have nice syntax without...

Read more »

Reduce in Rcpp11

May 23, 2014
By

And now for something completely difference, the reduce function, doing something similar to what the Reduce function does in R: #include <Rcpp.h> using namespace Rcpp ; // ] double reduce_example(NumericVector x ){ auto ad...

Read more »

reduce in Rcpp11

May 23, 2014
By

And now for something completely difference, the reduce function, doing something similar to what the Reduce function does in R: #include <Rcpp.h> using namespace Rcpp ; // ] double reduce_example(NumericVector x ){ auto a...

Read more »

A taste of functional programmming in Rcpp11

May 23, 2014
By

@kevinushey requested some functional programming in Rcpp11 and provided initial versions of map and filter. map is actually doing exactly the same thing as mapply so I added map as a synonym to mapply so that we can do (see this previous post for details): // ] NumericVector mapply_example(NumericVector x, NumericVector y, double z){ ...

Read more »

Using mapply in Rcpp11

May 22, 2014
By

mapply is a well known (or perhaps not) function in R. mapply applies a function to extracts from one or more vectors. For example in R: > mapply( function(x,y, z) x + y + z, 1:4, 4:1, 2) # 7 7 7 7 Notice how the last argument is recycled as...

Read more »

Compile times Rcpp11 vs Rcpp

May 22, 2014
By
Compile times Rcpp11 vs Rcpp

So I've been curious about a different kind of performance comparison between Rcpp11 and Rcpp, i.e. I've benchmarked the time it takes to compile the following code (the example you get from RStudio when you do new C++ file) with Rcpp and Rcpp11. #...

Read more »