Skip to main content
6 events
when toggle format what by license comment
Jul 1, 2021 at 19:31 comment added G. Sliepen I didn't delve into the internals of Rccp, but could it be that Rccp::rbinom() returns dynamically allocated memory? That means a lot of new and delete behind the scenes.
Jul 1, 2021 at 11:48 comment added Jonathan1234 And lastly, the most significant time reduction was given by std::bernoulli_distribution distrib(p) and I was wondering why?? I mean a random draw from a Bernoulli distribution seems already easy and fast to implement what additionally they do that makes it even faster?
Jul 1, 2021 at 11:47 comment added Jonathan1234 Also, as you pointed out I changed the .submat which requires the use of a non optimal binomial version with a For Loop that goes exactly to the places where we want to conduct the trial
Jul 1, 2021 at 11:45 comment added Jonathan1234 This is a really helpful answer, I did manage to reduce the computational time with those suggestions!! So, for the H.zeros(); because each row will have zeros on the first cells and last cells I think I would have to use 3 loops, one for the first zeros, for the ones in the middle and for the zeros in the end. What I did is instead of using arma::mat H(N,K) and H.zeros(); I used NumericMatrix H(N,K) which is much faster and initializes the matrix with zeros.
Jul 1, 2021 at 11:41 vote accept Jonathan1234
Jun 30, 2021 at 20:39 history answered G. Sliepen CC BY-SA 4.0