By Paolo Carlini on Jun 18, 2009
... this is my first post on my first blog, thus please be patient in case something goes wrong, the formatting is a bit off and the like...
That said, my name is Paolo Carlini and I live in Viterbo, close to Rome. I belong to the team led by Elena Zannoni, working mainly on GCC (http://gcc.gnu.org) and in particular its runtime C++ library which I co-maintain. I'm also representing Oracle at the ISO WG21 Meetings and, as part of that effort, I'm rather focused on implementing for the first time features which are being standardized or which must be fixed according to the resolutions of official DRs.
In particular, in this first post I wanted to tell you something about the ongoing work to implement the new, forthcoming C++ Standard, so called, in GCC, C++0x, but actually due for 2010 or 2011 in the worst case. For reference, you can find the last draft here http://http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2857.pdf, freely available: the library is described in chapters 17-30, a large fraction of the document, as you can see...
The last weeks I have been specifically implementing features in the <random> header (section 26.5), on which we have already some practical experience, dating back to the implementation of TR1 (http://http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf), which already included a rather useful <tr1/random> header. However, after a couple of years of on the field testing, also in big labs carrying out large "Montecarlo" simulations (e.g., Fermilab), it appeared obvious that both the user interfaces had to be improved and more distributions and generators added. That explains the rather large effort necessary now to deliver also the C++0x versions of those facilities to the GCC users.
Thanks also to some code donated by an independent contributor (Ed Smith-Rowland) all the interfaces are already in place in the mainline (would be GCC 4.5x) library and many distributions are apparently working well, but a lot of work remains to be done, in particular auditing the various algorithms and making sure they are still optimal in the light of the most recent literature. Just as an example, two weeks ago I replaced a rather convoluted solution for the Gamma distribution described in Devroye' treatise (http://http://cg.scs.carleton.ca/~luc/rnbookindex.html) with a faster and simpler one due to Marsaglia and Tsang (you can find it described also in the third edition of Numerical Recipes (http://www.nr.com): I suspect the same could/should be done also in a couple of other cases. There are also more ambitious possibilities, like investigating the use of parallel algorithms.
I know for sure that random numbers are often used in many different application areas and generators written in many different languages, thus I thought it could make sense to ask the feedback of the community about this specific task. Please have a look to the code already in the mainline GCC compiler - I would suggest using SVN (http://http://gcc.gnu.org/svn.html) for that - compare it to the code you are already using for random number generation and management, see if there is something the future GCC 4.5 could do better, faster, or more accurately in the light of your experience. Any help would be really welcome!