
On 1/31/07, Eric Niebler <eric@boost-consulting.com> wrote:
John Maddock wrote:
Matthias Troyer wrote:
This all leads on to the algorithms used for the mean and variance etc: I assume that these are of the "naive" variety? Perfectly satisfactory for simple cases, but there are well known pathological situations where these fail.
Very naive, yes. Actually tag::variance is the naive implementation while tag::variance (immediate) is a more accurate implementation.
OK I switched my torture test to use the "immediate" versions of the mean and variance, and got all the right answers :-) So with some suitable warnings in the documentation about which to use when, I'm happy now.
In the interest of users not getting burned by this, perhaps the default behavior should be the stable algorithm with something like tag::variance(fast_and_dangerous) being, well, the fast and dangerous algorithm. —Ben