Boost logo

Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2003-04-05 14:41:55


Neal D. Becker wrote:

>My purpose was only to demonstrate a generic class to do stats for both
>scalar and complex types. I don't know if I have time or will-power to
>turn it into a real boost submission.

I hope you don't mind, but I have taken your statistics class and vamped it
up. I have made it more boost/standard library-like and fixed the
portability problems (although I have only tested it on MSVC7).

I have also added basic iterator and container support so it can make use of
STL facilities. This will still require work, but the basics are there.

Paul A. Bristow wrote:

>Sadly (but perhaps not too surpringly) this does not seem to work for MSVC
>7.0
>with complex. (OK without)

I have got it working for complex and real numbers, but I don't know if the
results are correct for the complex number test, because I don't know
complex-based statistics; also, is it valid to use complex numbers with
imaginary values in these statistics?

To make it work I made 4 modifications:
[1] wrapped the template partial specialization for compilers that don't
support it;
[2] the MSVC library does not overload std::abs for the different floating
point types - this lead to conversion errors and an incorrect
stddev/variance calculation;
[3] the MSVC compiler complained that it could not divide a complex number
by count, so I added conversions to the base type;
[4] if template partial specialization is available, there will be
complaints on the statistical functions about
   complex -> real
number conversions - this is what stat_t< T >::convert is for.

This has not been tested on any other compiler, so I don't know exactly how
compatible it is.

>A full working example with at least a few comments might sell this better?

I have created a basic test program with a few examples. This is not an
extensive test, but will give a basic idea of how to use it.

-rhd-
mailto:msclrhd_at_[hidden]

_________________________________________________________________
Surf together with new Shared Browsing
http://join.msn.com/?page=features/browse&pgmarket=en-gb&XAPID=74&DI=1059




Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk