9#ifndef __QUETZAL_ACCUMULATOR_H_INCLUDED__
10#define __QUETZAL_ACCUMULATOR_H_INCLUDED__
12#include <boost/accumulators/framework/accumulator_base.hpp>
13#include <boost/accumulators/framework/parameters/sample.hpp>
46 template <
typename Args>
void operator()(Args
const &args)
48 this->tajima += args[sample];
56 using tajimasD = quetzal::polymophism::statistics::tajimasD;
57 return tajimasD(mean_pairwise_differences(args[accumulator]), nb_segregating_site(args[accumulator]),
58 count(args[accumulator]));
67 typedef Sample result_type;
72 template <
typename Args> result_type result(Args
const &args)
const
74 return sum(args[accumulator]) / count(args[accumulator]);
80namespace boost::accumulators::tag
82struct segregating_sites;
83struct pairwise_differences;
88struct tajima : depends_on<count, pairwise_differences, segregating_sites>
95namespace boost::accumulators
102extractor<tag::tajima>
const tajima = {};
108using extract::tajima;
Definition accumulator.hpp:27
Sample result_type
The type returned by result() below.
Definition accumulator.hpp:32
result_type result(Args const &args) const
The result function will also be passed an argument pack, but we don't use it here.
Definition accumulator.hpp:54
tajima_accumulator(Args const &args)
Constructor with a Boost.Parameter argument pack.
Definition accumulator.hpp:39
void operator()(Args const &args)
The accumulate function is the function call operator, accepting an argument pack.
Definition accumulator.hpp:46
Putting the accumulator implementations in this namespace is recommended.
Definition accumulator.hpp:24
Definition accumulator.hpp:66
Tajima's statistics accumulator tag.
Definition accumulator.hpp:89