Displaying 1 result from an estimated 1 matches for "rrcomp".
Did you mean:
prcomp
2011 Dec 13
1
Rcpp too good to be true?
...my code, if someone has a minute to point out anything wrong
(or even if its correct and there is room for improvement, im pretty new to
this) it would be much appreciated. I've had a simple look at the results
and they look fine, but seriously, 500x faster?!
function in R;
library(compiler)
Rrcomp <- cmpfun(
function(n, lam, nu, max = 100L) {
ans <- integer(n)
dist <- dcomp(0:max, lam, nu, max)
u <- runif(n)
for (i in 1:n) {
count <- 0L
pr <- dist[1L]
while (pr < u[i])...