-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEmpiricalDistribution.H
37 lines (31 loc) · 1.16 KB
/
EmpiricalDistribution.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/****************************************************************
EmpiricalDistribution.H
Copyright (C)2013 William H. Majoros ([email protected]).
This is OPEN SOURCE SOFTWARE governed by the Gnu General Public
License (GPL) version 3, as described at www.opensource.org.
****************************************************************/
#ifndef INCL_EmpiricalDistribution_H
#define INCL_EmpiricalDistribution_H
#include "BOOM/String.H"
#include "BOOM/Vector.H"
#include "DiscreteDistribution.H"
class EmpiricalDistribution : public DiscreteDistribution
{
typedef pair<unsigned,double> EmpiricalDistributionElement;
BOOM::Vector<EmpiricalDistributionElement*> v;
double smallestElemLogP, largestElemLogP, mean;
int binSize;
bool useInterpolation;
unsigned binarySearch(unsigned elem);
void load(const BOOM::String &filename);
void normalize();
inline double interpolate(unsigned x1,double y1,unsigned x2,double y2,
unsigned x);
public:
EmpiricalDistribution(const BOOM::String &filename,
bool shouldInterpolate=false);
virtual ~EmpiricalDistribution();
virtual double getLogP(unsigned);
virtual void useLogLikelihoodRatios();
};
#endif