Boost logo

Boost :

Subject: [boost] [math] & [random] distribution object compatibility
From: Thijs van den Berg (thijs_at_[hidden])
Date: 2014-04-13 10:36:24


Boost [random] has probability distribution objects for drawing random samples of those distributions. Boost [math] also has probability distributions, those provide free functions for computing properties of the distributions, like mean, pdf etc.

I like the free function design of math variant e.g. it uses pdf(distribution,x) and I was wondering why this hasn’t been adopt in C++11 for <random>? To me a free function syntax like random(distribution,engine) would make sense. It would align with the fact that C++11 has added begin(container) and end(container) free functions.

I think it’s a bit inconvenient to have two libs that both contain probability distributions. Especially since I’m hoping that boost/math would some day en up in the standard? One way we could integrate the two libs is by adding a random(distribution,engine) free function to the math lib which would accept both distribution objects from the random lib and the math lib. This however could stimulate users in writing less C++11 portable code.

My questions are:
* Why wasn’t the free function syntax adopted in C++11? Perhaps because of performance options?
* Is there an effort to integrate the distributions in math and random within boost?
* Are there concrete plans to add elements of math to the C++ standard? We already have <random> now, I would love more.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk