Blog Archives

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 »

Extending wrap with Rcpp11

May 22, 2014
By

Context Extending wrap to custom classes has always been a struggle in Rcpp, and led to the split between RcppCommon.h and Rcpp.h, the idea being that you load a "minimal" subset of Rcpp, declare your class, declare that you are going to provide a s...

Read more »

Moving

March 24, 2013
By
Moving

This blog is moving to blog.r-enthusiasts.com. The new one is powered by wordpress and gets a subdomain of r-enthusiasts.com. See you there

Read more »