forpy 2

ientropyfunction.h
Go to the documentation of this file.
1 /* Author: Christoph Lassner. */
2 #pragma once
3 #ifndef FORPY_IMPURITIES_IENTROPYFUNCTION_H_
4 #define FORPY_IMPURITIES_IENTROPYFUNCTION_H_
5
6 #include "../global.h"
7
8 #include "../util/serialization/basics.h"
9
10 #include <vector>
11
12 #include "../types.h"
13
14 namespace forpy {
15
16 #pragma clang diagnostic push
17 #pragma clang diagnostic ignored "-Wunused-variable"
18 static const float ENTROPY_EPS = 1E-7;
19 #pragma clang diagnostic pop
20
26 class IEntropyFunction {
27 public:
28 virtual ~IEntropyFunction();
29
40 virtual float operator()(const std::vector<float> &class_members_numbers,
41 const float &fsum) const {
42 return operator()(&class_members_numbers[0], class_members_numbers.size(),
43 fsum);
44 };
45
46 virtual float operator()(const float *class_members_numbers,
47 const size_t &n, const float &fsum) const
48 VIRTUAL(float);
49
59 virtual float operator()(
60 const std::vector<float> &class_members_numbers) const;
61
65 virtual bool operator==(const IEntropyFunction &rhs) const VIRTUAL(bool);
66
67 protected:
68 IEntropyFunction();
69
70 private:
71 friend class cereal::access;
72 template <class Archive>
73 void serialize(Archive &, const uint &) {}
74
75 DISALLOW_COPY_AND_ASSIGN(IEntropyFunction);
76 };
77 } // namespace forpy
78 #endif // FORPY_IMPURITIES_IENTROPYFUNCTION_H_
forpy::ENTROPY_EPS
static const float ENTROPY_EPS
Definition: ientropyfunction.h:18
forpy::IEntropyFunction::IEntropyFunction
IEntropyFunction()
forpy::IEntropyFunction::operator()
virtual float operator()(const std::vector< float > &class_members_numbers, const float &fsum) const
The interface function that must be implemented.
Definition: ientropyfunction.h:40
VIRTUAL
#define VIRTUAL(type)
Definition: global.h:31
forpy::IEntropyFunction
Interface for an entropy calculation functor.
Definition: ientropyfunction.h:26
forpy::IEntropyFunction::operator==
virtual bool operator==(const IEntropyFunction &rhs) const VIRTUAL(bool)
forpy::IEntropyFunction::access
friend class cereal::access
Definition: ientropyfunction.h:71
forpy
Definition: fastdprov.h:13
forpy::IEntropyFunction::DISALLOW_COPY_AND_ASSIGN
DISALLOW_COPY_AND_ASSIGN(IEntropyFunction)
forpy::IEntropyFunction::~IEntropyFunction
virtual ~IEntropyFunction()
forpy::uint
unsigned int uint
Convenience typedef for unsigned int.
Definition: types.h:113
forpy::IEntropyFunction::serialize
void serialize(Archive &, const uint &)
Definition: ientropyfunction.h:73