|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file.
50 return *std::min_element(h.
begin(), h.
end());
55 return *std::max_element(h.
begin(), h.
end());
60 return std::distance(h.
begin(), std::min_element(h.
begin(), h.
end()));
65 return std::distance(h.
begin(), std::max_element(h.
begin(), h.
end()));
70 const double mid =
sum(h) / 2;
74 for (i = 0; i < h.
bins(); ++i) {
75 if (part + h[i] < mid) {
81 assert(part < mid && i < h.
bins());
85 const double pos = (mid - part) / h[i];
101 for (
size_t i = 0; i < h.
bins(); ++i) {
103 const double wi = h[i];
107 wmean += (xi - wmean) * (wi / weight);
121 const double wmean =
mean(h);
125 for (
size_t i = 0; i < h.
bins(); ++i) {
127 const double wi = h[i];
130 const double delta = (xi - wmean);
133 wvar += (delta * delta - wvar) * (wi / weight);
137 return std::sqrt(wvar);
142 return std::accumulate (h.
begin(), h.
end(), 0.0);
double bin_midpoint(size_t bin_num) const
double sum(const Histogram &h)
double sigma(const Histogram &h)
Compute the bin-weighted standard deviation.
Header of Histogram class.
size_t min_bin(const Histogram &h)
double bin_width(size_t bin_num) const
double max_value(const Histogram &h)
size_t max_bin(const Histogram &h)
std::pair< double, double > bin_range(size_t bin_num) const
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
Header of Histogram statistics functions.
double mean(const Histogram &h)
Compute the bin-weighted arithmetic mean.
double min_value(const Histogram &h)
Histogram class for accumulating and summarizing data.
double median(const Histogram &h)