trouble with boost/random/poisson_distribution and large lambda
Hello, I am new to the boost mailing list, so I apologize before hand if this is not the appropriate forum for this question. I have been using boost/random recently and have encountered what appears to be a problem with poisson variate generators with large lambda values. The random values can't seem to get much higher than 800 regardless of what value lambda is. For example: #include<iostream> #include<iterator> #include<vector> #include<algorithm> #include<boost/random/poisson_distribution.hpp> #include<boost/random/variate_generator.hpp> #include<boost/random/mersenne_twister.hpp> using namespace boost; using namespace std; int main() { mt19937 gen; double lambda = 1000.; poisson_distribution<int, double> pois(lambda); variate_generator<mt19937&, poisson_distribution<int, double> > rpois(gen, pois); // generate 10 random poisson variables vector<double> sample(10); generate(sample.begin(), sample.end(), rpois); cout << "Simulating from Poisson Random Variable with lambda=" << lambda << endl; cout << "\nSample: "; copy(sample.begin(), sample.end(), ostream_iterator<int>(cout, " ")); cout << "\n\nShouldn't the numbers be a little closer to 1,000?" << endl; return 0; } Thanks, Mike
AMDG On 06/22/2011 03:49 PM, Michael King wrote:
Hello,
I am new to the boost mailing list, so I apologize before hand if this is not the appropriate forum for this question.
I have been using boost/random recently and have encountered what appears to be a problem with poisson variate generators with large lambda values.
The random values can't seem to get much higher than 800 regardless of what value lambda is.
poisson_distribution has been completely reimplemented in 1.47. This problem appears to be gone. I tested your code with MSVC 10 and the current trunk (r74137).
For example:
<snip>
In Christ, Steven Watanabe
participants (2)
-
Michael King
-
Steven Watanabe