I wrote a C ++ simulation that generates (1,000,000) ^ 2 numbers from a specific probability distribution, and then does something with them. So far I have used exponential, normal, gamma, uniform and Poisson distributions. Here is the code for one of them:
#include <boost/random.hpp> ...main... srand(time(NULL)) ; seed = rand(); boost::random::mt19937 igen(seed) ; boost::random::variate_generator<boost::random::mt19937, boost::random::normal_distribution<> > norm_dist(igen, boost::random::normal_distribution<>(mu,sigma)) ;
Now I need to run it to distribute the beta version. All the distributions that I have done so far have taken 10-15 hours. The beta distribution is not in the boost / random package, so I had to use the boost / math / distribution package. I found an https://stackoverflow.com/a/16626749/2127 which suggested a solution. Here it is (copied):
I played it, and it worked. Estimates of the runtime of my simulation are linear and accurately predictable. They say it will work for 25 days. I see two possibilities: 1. the proposed method is inferior to the one I used earlier for other distributions 2. The beta distribution is much more difficult to generate random numbers from
Mention that I have below a minimal understanding of C ++ coding, so the questions I ask may be dumb. I cannot wait a month to complete this simulation, so what can I do to improve this? Perhaps use the initial method that I used and modified to work with the boost / math / distribution package? I don’t even know if this is possible.
Other useful information may be that the parameters are the same for all (1,000,000) ^ 2 numbers that I need to generate. I say this because the Beta distribution has an unpleasant PDF file, and perhaps knowing that the parameters are fixed can be used in some way to simplify the process? Just a random guess.
c ++ boost boost-random beta-distribution
jaff
source share