-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathbetadistributionwithtrend.h
64 lines (50 loc) · 2.96 KB
/
betadistributionwithtrend.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef RPLIB_BETADISTRIBUTIONWITHTREND_H
#define RPLIB_BETADISTRIBUTIONWITHTREND_H
#include "rplib/distributionwithtrend.h"
namespace NRLib {
class Trend;
}
class BetaDistributionWithTrend : public DistributionWithTrend {
public:
BetaDistributionWithTrend();
BetaDistributionWithTrend(const NRLib::Trend * mean,
const NRLib::Trend * var,
const double & lower_limit,
const double & upper_limit,
int shared);
BetaDistributionWithTrend(const BetaDistributionWithTrend & dist);
virtual ~BetaDistributionWithTrend();
virtual DistributionWithTrend * Clone() const { return new BetaDistributionWithTrend(*this) ;}
virtual bool GetIsShared() const { return(share_level_ > None) ;}
virtual bool GetIsDistribution() const { return(true) ;}
virtual std::vector<bool> GetUseTrendCube() const { return(use_trend_cube_) ;}
//Triggers resampling for share_level_ <= level_. Not necessary for share_level_ = 0/None
virtual void TriggerNewSample(int level) {if(share_level_<=level)
resample_ = true; }
virtual double ReSample(double s1, double s2);
virtual double GetQuantileValue(double u, double s1, double s2);
virtual double GetMeanValue(double s1, double s2);
virtual double GetVarianceValue(double s1, double s2);
static void CalculateAlpha(const double & mean,
const double & var,
const double & lower_limit,
const double & upper_limit,
double & alpha);
static void CalculateBeta(const double & mean,
const double & var,
const double & lower_limit,
const double & upper_limit,
double & beta);
private:
NRLib::Grid2D<NRLib::Distribution<double> *> * beta_distribution_;
const NRLib::Trend * mean_;
const NRLib::Trend * var_;
std::vector<bool> use_trend_cube_; // First element true if first trend cube is used, second true if second is used, and both true if both are used
int ni_;
int nj_;
std::vector<double> mean_sampling_;
std::vector<double> var_sampling_;
int n_samples_mean_;
int n_samples_var_;
};
#endif