This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Rice distribution


Hi,

On 09/13/2012 03:05 PM, Ed Smith-Rowland wrote:
On 09/05/2012 10:29 PM, Ulrich Drepper wrote:
On Wed, Sep 5, 2012 at 6:34 PM, Ed Smith-Rowland <3dw4rd@verizon.net> wrote:
I wrote some distributions a couple months back.  I wrote them as
(name-uglified) extensions to libstdc++.

Here is the Rice distribution.
I never used this distribution myself but that doesn't mean anything.
A few nits:

- you should add __generate functions (see the current svn code)
Forgot about that. Fixed.

- in the operator function, did you consider using hypot? I'm not sure it's necessary, the x and y numbers might not require it. hypot is usually more accurate. The multiplications are throwing away a lot of bits which the sqrt call might need.
Hypot is a good idea. I'm not worried about overflow heresuch as student-t.

- the operator== has the bug which we fixed in the library. You cannot define a template friend function in the template class definition. Look at the current libstdc++ code. Likewise for the other friend functions.
i think I got this right. Other distros have things as I have them here.

- how about moving the operator() code and perhaps even the operator== code into random.tcc?
They are small. i left them where they wre but I could still move them.

- move the operator!= outside the class definition, just like for the other classes
Done.

- with the definition being in ext/random, the test cases shouldn't reference the non-existing rice_distribution.h header
I sent an old patch I guess. Fixed.

I think the updated patch is Ok (as a general rule, tough, remember to always submit a ChangeLog entry together with the patch proper), you tested it, right? (better multilib, to catch issues having to do with 32-bit longs, etc) In that case it's Ok to commit.


Thanks,
Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]