Monday, July 26, 2010

poisson_distribution broken in boost and g++?

I needed to generate samples from poisson distribution in c++. poisson_distribution happens to be a function included in C++0x. When I wrote the code and ran it using g++ 4.4.3 with std=c++0x, the code hung inside the poisson_distribution generator (i,e. operator()). I then converted my code to using boost 1.40 instead of g++. It still hung!

Then I decided to try out the code from MSDN documentation at http://msdn.microsoft.com/en-us/library/bb982217.aspx. This example hangs with both boost and g++!

I set a breakpoint inside the generator code. A product was being accumulated (starting from 1.0) and to be able to break it was checked to be less than a quantity less than 1.  However the product was increasing, not decreasing, soon reaching to inf.

No comments: