Alexandria
2.19
Please provide a description of the project.
|
Go to the documentation of this file.
25 #ifndef ALEXANDRIA_HISTOGRAM_HISTOGRAM_H
26 #define ALEXANDRIA_HISTOGRAM_HISTOGRAM_H
35 #include <type_traits>
48 template <
typename VarType>
122 return (edges.second + edges.first) / 2;
136 template <
typename VarType,
typename WeightType =
float>
155 template <
typename IterType,
typename BinType,
157 Histogram(IterType begin, IterType end, BinType&& bin_type) {
158 auto binning_impl = make_unique<ComputationImpl<BinType>>(
std::move(bin_type));
184 template <
typename IterType,
typename WeightIterType,
typename BinType,
186 Histogram(IterType begin, IterType end, WeightIterType wbegin, WeightIterType wend, BinType&& bin_type) {
187 assert(wend - wbegin == end - begin);
188 auto binning_impl = make_unique<ComputationImpl<BinType>>(
std::move(bin_type));
189 binning_impl->computeBins(begin, end, wbegin);
249 std::generate(bins.
begin(), bins.
end(), [
this, &i]() { return m_binning_concept->getBinStrategy().getBin(i++); });
270 void clip(VarType min, VarType max) {
331 virtual void clip(VarType min, VarType max) = 0;
341 template <
typename BinType>
357 return make_unique<ComputationImpl<BinType>>(*this);
373 template <
typename IterType,
typename WeightIterType>
374 void computeBins(IterType begin, IterType end, WeightIterType wbegin);
376 void clip(VarType min, VarType max)
final;
387 #include "Histogram/_impl/ComputationImpl.icpp"
389 #endif // ALEXANDRIA_HISTOGRAM_HISTOGRAM_H
virtual void clip(VarType min, VarType max)=0
void computeBins(IterType begin, IterType end, WeightIterType wbegin)
ComputationImpl(BinType &&bin_type)
Histogram & operator=(Histogram &&)=default
size_t getBinCount() const
virtual VarType getBin(size_t i) const
virtual std::vector< VarType > getEdges() const
virtual std::pair< VarType, VarType > getBinEdges(size_t i) const
virtual std::unique_ptr< ComputationInterface > clone() const =0
std::vector< WeightType > getCounts() const
virtual ~ComputationInterface()=default
Histogram(IterType begin, IterType end, BinType &&bin_type)
std::shared_ptr< std::vector< WeightType > > m_counts
std::vector< VarType > getEdges() const
std::pair< VarType, VarType > getBinEdges(size_t i) const
Histogram(const Histogram &other)
std::unique_ptr< ComputationInterface > clone() const final
virtual std::tuple< VarType, VarType, VarType > getStats() const =0
std::tuple< VarType, VarType, VarType > getStats() const final
std::vector< VarType > getBins() const
Histogram(Histogram &&)=default
Histogram(IterType begin, IterType end, WeightIterType wbegin, WeightIterType wend, BinType &&bin_type)
void clip(VarType min, VarType max) final
virtual VarType getEdge(size_t e) const =0
WeightType operator*() const
virtual ~BinStrategy()=default
Histogram & operator=(const Histogram &)=default
virtual const BinStrategy< VarType > & getBinStrategy() const =0
std::unique_ptr< ComputationInterface > m_binning_concept
ConstantWeight & operator++()
void clip(VarType min, VarType max)
virtual ssize_t getBinIndex(VarType value) const =0
ComputationImpl(const ComputationImpl &)=default
std::tuple< VarType, VarType, VarType > getStats() const
const BinStrategy< VarType > & getBinStrategy() const final