A library for working with phylogenetic and population genetic data.
v0.32.0
utils/math/histogram/operators.cpp
Go to the documentation of this file.
1
/*
2
Genesis - A toolkit for working with phylogenetic data.
3
Copyright (C) 2014-2017 Lucas Czech
4
5
This program is free software: you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
9
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
14
15
You should have received a copy of the GNU General Public License
16
along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18
Contact:
19
Lucas Czech <lucas.czech@h-its.org>
20
Exelixis Lab, Heidelberg Institute for Theoretical Studies
21
Schloss-Wolfsbrunnenweg 35, D-69118 Heidelberg, Germany
22
*/
23
31
#include "
genesis/utils/math/histogram/operators.hpp
"
32
33
#include <ostream>
34
35
#include "
genesis/utils/math/histogram.hpp
"
36
#include "
genesis/utils/math/histogram/accumulator.hpp
"
37
38
namespace
genesis
{
39
namespace
utils {
40
41
// =================================================================================================
42
// Histogram Operators
43
// =================================================================================================
44
45
std::ostream&
operator<<
(std::ostream& os,
const
Histogram
& h)
46
{
47
for
(
size_t
i = 0; i < h.
bins
(); ++i) {
48
auto
range = h.
bin_range
(i);
49
os <<
"["
<< range.first <<
", "
<< range.second <<
"): "
;
50
os << h[i] <<
"\n"
;
51
}
52
return
os;
53
}
54
55
// =================================================================================================
56
// Histogram Accumulator Operators
57
// =================================================================================================
58
59
std::ostream&
operator<<
(std::ostream& os,
const
HistogramAccumulator
& h)
60
{
61
for
(
auto
& v : h) {
62
os << v.first <<
" <- "
<< v.second <<
"\n"
;
63
}
64
return
os;
65
}
66
67
}
// namespace utils
68
}
// namespace genesis
genesis::utils::operator<<
std::ostream & operator<<(std::ostream &os, Color const &color)
Write a textual representation of the Color the a stream, in the format "(r, g, b,...
Definition:
utils/color/functions.cpp:129
histogram.hpp
Header of Histogram class.
operators.hpp
Header of Histogram operator functions.
genesis::utils::Histogram::bin_range
std::pair< double, double > bin_range(size_t bin_num) const
Definition:
histogram.cpp:249
accumulator.hpp
Header of Histogram Accumulator class.
genesis
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
Definition:
placement/formats/edge_color.cpp:42
genesis::utils::Histogram::bins
size_t bins() const
Definition:
histogram.cpp:244
genesis::utils::HistogramAccumulator
Histogram helper class that collects data and builds a fitting Histogram.
Definition:
accumulator.hpp:63
genesis::utils::Histogram
Histogram class for accumulating and summarizing data.
Definition:
histogram.hpp:68
lib
genesis
utils
math
histogram
operators.cpp
Generated on Mon Aug 5 2024 16:57:52 for genesis by
1.8.17