This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/packages/CLPBN/horus/Histogram.h

52 lines
1018 B
C
Raw Normal View History

2013-02-07 17:50:02 +00:00
#ifndef YAP_PACKAGES_CLPBN_HORUS_HISTOGRAM_H_
#define YAP_PACKAGES_CLPBN_HORUS_HISTOGRAM_H_
2012-05-23 14:56:01 +01:00
#include <vector>
#include <ostream>
2012-12-27 22:25:45 +00:00
#include "Horus.h"
2013-02-07 13:37:15 +00:00
typedef std::vector<unsigned> Histogram;
2012-05-23 14:56:01 +01:00
namespace Horus {
2013-02-07 23:53:13 +00:00
class HistogramSet {
2012-05-23 14:56:01 +01:00
public:
HistogramSet (unsigned, unsigned);
2012-12-17 18:39:42 +00:00
void nextHistogram();
2012-05-23 14:56:01 +01:00
2012-05-24 22:55:20 +01:00
unsigned operator[] (size_t idx) const;
2012-12-17 18:39:42 +00:00
unsigned nrHistograms() const;
2012-05-23 14:56:01 +01:00
void reset();
2012-05-23 14:56:01 +01:00
2013-02-07 13:37:15 +00:00
static std::vector<Histogram> getHistograms (unsigned, unsigned);
2012-12-17 18:39:42 +00:00
2012-05-23 14:56:01 +01:00
static unsigned nrHistograms (unsigned, unsigned);
2012-05-24 22:55:20 +01:00
static size_t findIndex (
2013-02-07 13:37:15 +00:00
const Histogram&, const std::vector<Histogram>&);
2012-05-23 14:56:01 +01:00
2013-02-07 13:37:15 +00:00
static std::vector<double> getNumAssigns (unsigned, unsigned);
2012-05-23 14:56:01 +01:00
private:
2012-05-24 22:55:20 +01:00
unsigned maxCount (size_t) const;
2012-05-23 14:56:01 +01:00
2012-05-24 22:55:20 +01:00
void clearAfter (size_t);
2012-05-23 14:56:01 +01:00
friend std::ostream& operator<< (std::ostream&, const HistogramSet&);
2012-12-17 18:39:42 +00:00
unsigned size_;
Histogram hist_;
2012-12-27 22:25:45 +00:00
DISALLOW_COPY_AND_ASSIGN (HistogramSet);
2012-05-23 14:56:01 +01:00
};
} // namespace Horus
2013-02-07 23:53:13 +00:00
2013-02-08 00:20:01 +00:00
#endif // YAP_PACKAGES_CLPBN_HORUS_HISTOGRAM_H_
2012-05-23 14:56:01 +01:00