[Rcpp-devel] Blog post - optimizing ragged arrays in R and Rcpp
Christian Gunning
xian at unm.edu
Sun Jul 6 13:29:06 CEST 2014
Thanks. Ok, I'll see what I can come up with.
I rewrote the example as a C++ class, wrapped it into an Rcpp module,
and made a package ( see
https://code.google.com/p/unm-r-programming/source/browse/#git%2FRaggedArray
).
Major changes: I switched to column-major order (initial oversight),
added automated growing, and a "serialize/de-serialize" path.
The big part that's missing is an intelligent apply method that lets
the user simply pass a function.
Example code for the above library:
###
library(RaggedArray)
test.obj = new(RaggedArray, 3, 10, 5)
test.list <- list(1:5, 1:6, 1:7)
test.obj$append(test.list)
test.obj$append(test.list)
str(test.obj)
## turn into something R can serialize
save.obj <- test.obj$serialize()
## regenerate from R
new.obj <- new(RaggedArray, save.obj)
-Christian
On Sat, Jul 5, 2014 at 11:05 AM, Dirk Eddelbuettel <edd at debian.org> wrote:
>
> Hi,
>
> On 3 July 2014 at 21:27, Christian Gunning wrote:
> | I just posted a short article on ragged arrays in R and Rcpp (it will
> | also be auto-posted to R-bloggers). I've tried to be as comprehensive
> | as possible in discussing the problem background, as well as providing
> | relevant citations. I'm curious to hear if anyone else has faced this
> | problem, and if there are prior solutions that I've overlooked.
> |
> | http://helmingstay.blogspot.com/2014/07/computational-speed-is-common-complaint.html
>
> Very nice. How about turning it into an Rcpp Gallery post too?
>
> As you know, either .Rmd, or .cpp with embedded R and md.
>
> Cheers, Dirk
>
> --
> http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
--
A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal – Panama!
More information about the Rcpp-devel
mailing list