Boost logo

Boost :

Subject: Re: [boost] [math] & [random] distribution object compatibility
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2014-04-13 13:55:22


On 04/13/2014 07:36 AM, Thijs van den Berg wrote:
> 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.

They need to be separate types, because efficient
algorithms for generating random variates often require
extra members that are useless for anything else.

At one time I considered trying to make param_type a
typedef for the corresponding Boost.Math distribution,
but the required interface is a bit of a problem.

> 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.

In Christ,
Steven Watanabe

Boost list run by bdawes at, gregod at, cpdaniel at, john at