
pete@pcbartlett.com wrote:
Hi all,
I really like the range of statistical properties that the accumulators library supports but am a little unclear about the laziness properties of the library.
Suppose I wish to offer a interface that lets the user send a bunch of data and request the k-th moments where k is specified by the user at runtime. Will the accumulator_set
accumulator_set< value_type , ba::tag::moments
> acc; where k_max >= k (but the inequality may be strict) be efficient. I.e. I only do the calculations necessary to get the k-th moment not the k-max-th? The reason I ask is the documentation makes a distinction between variance and lazy_variance, but this distinction does not seem to be made for other statistics.
Hi, The accumulators library doesn't mandate laziness or eagerness. As you've noticed, some accumulators come in lazy or eager flavors. Each accumulator defines an operator() that accepts a sample and a result() function that extracts the result. Whether the bulk of the work gets done in operator() (eager) or in result() (lazy) is up to you. HTH, -- Eric Niebler BoostPro Computing http://www.boostpro.com