Displaying 1 result from an estimated 1 matches for "dist_".
Did you mean:
dist
2011 Dec 13
1
Rcpp too good to be true?
...nu, max) {
sum <- 0L
for(i in 0L:max) {
sum <- sum + lam^i / factorial(i)^nu
}
return(sum)
}
return(lam^y / (factorial(y)^nu * Z(lam, nu, max)))
}
function in Rcpp;
header file;
#include <Rcpp.h>
RcppExport SEXP rcomp(SEXP n_, SEXP dist_);
source file;
#include "rcomp.h"
SEXP rcomp(SEXP n_, SEXP dist_) {
using namespace Rcpp ;
int n = as<int>(n_);
NumericVector dist(dist_);
NumericVector ans(n);
int count;
double pr;
RNGScope scope;
NumericVector u = runif(n);
for (int i = 0...