
On 5/6/2010 9:32 PM, alfC wrote:
Hi,
Some features of accumulator, such as variance needs to compute powers of quantities. What happens if the power of quantity is not the same as the type of the original quantity?
An example is a boost::units::quantity,
accumulator_set< quantity<si::energy>, stats<tag::mean, tag::moment<2> > > acc; //not compiling because of moment<2> acc(1.2*si::joules); ...
So quantity<si::energy> is a type such that squaring it yields a different type. I'm sorry to say that the accumulators library doesn't handle such sample types. You can submit a feature request, or (better) submit a patch. You'd need to change moment_impl in moment.hpp to use some new trait (numeric::functional::pow?) to compute the type of a variable raised to the Nth power. -- Eric Niebler BoostPro Computing http://www.boostpro.com