From: John Maddock (John_Maddock_at_[hidden])
Date: 2001-06-12 06:26:01
>Is anyone interested in statistical functions for
>Students's T, Fisher F, Chisq, their inverses,
>and functions needed to generate them?
>There is a collection of C functions which are
>generated from FORTRAN (UGH!) by Barry Brown et al
>at Univerisity of Texas dated 1997. The key work
>is based on Didinto AR and Morris AH, Navel Surface Weapons Viginia
>ACM TOMS 18 (1993) 360 -373
There's a lot of FORTRAN code out there that could be usefully repackaged
as C++, stats functions would be a good place to start. It annoys me that
my 20 year old calculator (it really is, still going too!), has more stats
functions than <math.h>.
>Re-packaging C++ style is easy enough,
>but I would like guidance on how to handle the exceptional
throw std::range_error for range errors?
>Should this be handled using exceptions, and if so exactly how, showing
>as much info as possible. In this case, p is out of range 0 to 1 and
>its erroneous value is useful. In other cases, other parameters can be
>wrong (negative degrees of freedom), or the calculation itself can fail.
>Worked examples please!
If the user breaks the interface contract (negative degrees of freedom),
then I guess that is an assertion not an exception - it's a fine line to
tread though. I don't know what you do if there is a range error but the
result is still useful, unless you want to define your own exception
>Should perhaps the functions be templated for float, double and long
>(I am not sure about the internal computational implications of this).
Absolutely, although if things get too problematical (table driven
implementations spring to mind), then you may have to rethink, ideally
though try and define a single generic version if you can.
- John Maddock
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk