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


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)

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

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

- how about moving the operator() code and perhaps even the operator==
code into random.tcc?

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

- with the definition being in ext/random, the test cases shouldn't
reference the non-existing rice_distribution.h header


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