Skip to content
Prev 2759 / 10988 Next

[Rcpp-devel] R.e. Speed gain assistance (Wray, Christopher)

Thanks for responses, sure I do make use of the R side - when required and where there is not a significant penalty.

I suppose the root of my question (aside from the functions calls complicating and slowing things down) was that if in R, I might do something like Vector1[subvector_of_relevant_indices] = Vector2, say:

R> (1:50)[runif(10,0,20)]

And I was wondering if I had missed some sugar-type of construct that would allow me to avoid the explicit 1e7 loop - and instead make use of some Rcpp vectorised/optimised/ machinery. Christian's sugg' of allowing double->int did speed things up enough, by me to chuck away the "floor"...

Aside from that, the genral theme I was aiming for was "sampling via indices" which I assumed someone may had already have a wheel which they had invented..already.. :-)

No probs - and sorry for the unclear post! Thanks