Spec AverageAccumulator
Accumulator for computing averages.

Extends Accumulator
All Extended Accumulator
Defined in <seqan/misc/accumulators.h>
Signature template <typename TValue> struct Accumulator<TValue, AccuAverage>;

Template Parameters

TValue The type of the values to compute the average of.

Interface Function Overview

Interface Functions Inherited From Accumulator

Interface Metafunction Overview

Interface Metafunctions Inherited From Accumulator

Detailed Description

The average of an empty sequence is defined to be 0.

Examples

This program shows how to use the Average Accumulator.

Accumulator<int, AccuAverage> acc;
push(acc, 1);
push(acc, 2);
push(acc, 3);
std::cout << "average: " << average(acc) << "\n"
          << "sum:     " << sum(acc) << "\n"
          << "count:   " << count(acc) << "\n";

The output is then:

average: 2
sum:     6
count:   3

Interface Functions Detail

TResult average(acc);

Return the average of the included values.

Parameters

acc The Accumulator to compute the average for.

Returns

TResult The average of the values (Metafunction: Result).

Data Races

Thread safety unknown!

TResult count(acc);

Return the number of included values.

Parameters

count The number of values pushed to the accumulator.

Returns

TResult The number of pushed values (Metafunction: Result).

Data Races

Thread safety unknown!

TResult sum(acc);

Return the sum of the included values.

Parameters

acc The Accumulator to compute the sum for.

Returns

TResult The sum of the values (Metafunction: Result).

Data Races

Thread safety unknown!