[PATCH] Fix Bug 83237 - Values returned by std::poisson_distribution are not distributed correctly
Michele Pezzutti
mpezz@tiscali.it
Mon Dec 11 22:16:00 GMT 2017
I lowered to N = 2500000 and still fails with a good margin.
On 12/11/2017 09:58 PM, Michele Pezzutti wrote:
> I apologize as I am unable to run the test suite in its full form.
>
> Nevertheless, I locally tested the following patch for the test suite:
>
> *26_numerics/random/poisson_distribution/operators/values.cc
> Â Â Â Add additional test to cover bin 'floor(mu) + 1'
>
> by compiling locally values.cc and running it as main().
>
>
> I had to increase N from default value N = 100000 to N = 4000000 to
> trigger the fault.
> I think that for smaller N, the deviation due to the bug is well
> within the confidence
> interval set in testDiscreteDist().
>
>
> The test case below is successful with the proposed patch.
>
>
> diff --git a/values.cc b/values.cc
> index 0039b7d..e12e54f 100644
> --- a/values.cc
> +++ b/values.cc
> @@ -42,6 +42,10 @@ void test01()
> Â Â std::poisson_distribution<> pd3(30.0);
> Â Â auto bpd3 = std::bind(pd3, eng);
> Â Â testDiscreteDist(bpd3, [](int n) { return poisson_pdf(n, 30.0); } );
> +
> +Â std::poisson_distribution<> pd4(37.17);
> +Â auto bpd4 = std::bind(pd4, eng);
> +Â testDiscreteDist<100, 4000000>(bpd4, [](int n) { return
> poisson_pdf(n, 37.17); } );
> Â }
>
>
>
> On 12/11/2017 10:52 AM, Paolo Carlini wrote:
>> Hi,
>>
>> On 10/12/2017 14:47, Michele Pezzutti wrote:
>>> Hi.
>>>
>>> This patch intends to fix Bug 83237 - Values returned by
>>> std::poisson_distribution are not distributed correctly.
>>> See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83237 for issue
>>> description and tests.
>> In any case, the fix should come with a testcase, which would also
>> validate the analysis. For this discrete distribution should be
>> pretty easy to add one, because all the infrastructure is already in
>> place, essentially three lines added to
>> 26_numerics/random/poisson_distribution/operators/values.cc.
>>
>> Paolo.
>
More information about the Libstdc++
mailing list