libspatialSEIR  0.1
Bayesian Spatial SEIR Modeling
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
LSS_FullConditional.hpp
Go to the documentation of this file.
1 #ifndef SPATIALSEIR_INCLUDEFILES
2 #define SPATIALSEIR_INCLUDEFILES
3 
4 #include<cstring>
5 #include<vector>
6 #endif
7 
8 #ifndef FULL_CONDITIONAL_INC
9 #define FULL_CONDITIONAL_INC
10 
11 #define LSS_COMPARTMENT_FULL_CONDITIONAL_TYPE 1
12 #define LSS_INIT_COMPARTMENT_FULL_CONDITIONAL_TYPE 2
13 #define LSS_PARAMETER_FULL_CONDITIONAL_TYPE 3
14 
15 
16 namespace SpatialSEIR
17 {
18 
19  class ModelContext;
20  class CompartmentalModelMatrix;
21  class CovariateMatrix;
22  class OCLProvider;
23  class Sampler;
24 
26  struct priorControl
27  {
35  double Phi_priorBeta;
36  };
37 
40  {
41  double* S_starWidth;
42  double* E_starWidth;
43  double* R_starWidth;
44  double* S0Width;
45  double* I0Width;
46  double* betaWidth;
47  double* betaPrsWidth;
48  double* rhoWidth;
49  double* gammaEiWidth;
50  double* gammaIrWidth;
51  double* phiWidth;
52  };
53 
55  class InitData
56  {
57  public:
58  InitData(int *_S0,
59  int *_E0,
60  int *_I0,
61  int *_R0,
62  int *nLoc);
63  InitData();
64  void populate(int *_S0,
65  int *_E0,
66  int *_I0,
67  int *_R0,
68  int *nLoc);
69 
70  ~InitData();
71  int *S0;
72  int *E0;
73  int *I0;
74  int *R0;
76  };
77 
78 
79 
87  {
88  public:
89  //Template for shared methods
90  virtual ~FullConditional(){};
91  virtual void sample(int verbose) = 0;
92  virtual long double getValue() = 0;
93  virtual void setValue(long double value) = 0;
94  virtual int calculateRelevantCompartments() = 0;
95  virtual int calculateRelevantCompartments_OCL() = 0;
96  virtual void updateSamplingParameters(double desiredRatio, double targetWidth, double proportionChange) = 0;
97  virtual int getFullConditionalType() = 0;
98  double acceptanceRatio();
99  double* sliceWidth;
100  void setSamplerType(int type);
101  std::vector<Sampler*>* samplers;
103  int* samples;
104  int* accepted;
105  };
106 
116  {
117  public:
118  //Template for shared methods
120  virtual int evalCPU() = 0;
121  virtual int evalCPU(int i, int j) = 0;
122  virtual int evalOCL() = 0;
123  virtual void sample(int verbose) = 0;
124  virtual long double getValue() = 0;
125  virtual void setValue(long double value) = 0;
126  virtual int calculateRelevantCompartments() = 0;
127  virtual int calculateRelevantCompartments(int i, int j) = 0;
128  virtual int calculateRelevantCompartments_OCL() = 0;
129  void updateSamplingParameters(double desiredRatio, double targetWidth, double proportionChange);
130 
133 
135  };
136 
148  {
149  public:
150  //Template for shared methods
152  virtual int evalCPU() = 0;
153  virtual int evalOCL() = 0;
154  virtual void sample(int verbose) = 0;
155  virtual long double getValue() = 0;
156  virtual void setValue(long double value) = 0;
157  virtual int calculateRelevantCompartments() = 0;
158  virtual int calculateRelevantCompartments_OCL() = 0;
159  virtual double acceptanceRatio(int i);
160  void updateSamplingParameters(double desiredRatio, double targetWidth, double proportionChange);
161 
162  int *varLen;
163 
166  };
167 
168 
178  {
179  public:
180 
182  virtual int evalCPU() = 0;
183  virtual int evalOCL() = 0;
184  virtual void sample(int verbose) = 0;
185  virtual long double getValue() = 0;
186  virtual void setValue(long double value) = 0;
187  virtual int calculateRelevantCompartments() = 0;
188  virtual int calculateRelevantCompartments_OCL() = 0;
189  void updateSamplingParameters(double desiredRatio, double targetWidth, double proportionChange);
190 
191 
194  };
195 }
196 
197 #endif
Definition: LSS_FullConditional.hpp:115
virtual int calculateRelevantCompartments()=0
double * betaWidth
Definition: LSS_FullConditional.hpp:46
virtual void sample(int verbose)=0
int * R0
Definition: LSS_FullConditional.hpp:74
virtual int getFullConditionalType()=0
virtual long double getValue()=0
void updateSamplingParameters(double desiredRatio, double targetWidth, double proportionChange)
Definition: FullConditional.cpp:150
int * S0
Definition: LSS_FullConditional.hpp:71
Definition: LSS_FullConditional.hpp:177
int * accepted
Definition: LSS_FullConditional.hpp:104
int * E0
Definition: LSS_FullConditional.hpp:72
double P_IR_priorAlpha
Definition: LSS_FullConditional.hpp:32
double * gammaIrWidth
Definition: LSS_FullConditional.hpp:50
std::vector< Sampler * > * samplers
Definition: LSS_FullConditional.hpp:101
int * numLocations
Definition: LSS_FullConditional.hpp:75
Definition: LSS_FullConditional.hpp:147
double P_EI_priorBeta
Definition: LSS_FullConditional.hpp:31
void updateSamplingParameters(double desiredRatio, double targetWidth, double proportionChange)
Definition: FullConditional.cpp:176
double P_IR_priorBeta
Definition: LSS_FullConditional.hpp:33
struct containing initial slice sampling tuning parameters.
Definition: LSS_FullConditional.hpp:39
double * betaPrsWidth
Definition: LSS_FullConditional.hpp:47
double * steadyStateConstraintPrecision
Definition: LSS_FullConditional.hpp:134
int getFullConditionalType()
Definition: FullConditional.cpp:108
int * varLen
Definition: LSS_FullConditional.hpp:162
double * S_starWidth
Definition: LSS_FullConditional.hpp:41
double acceptanceRatio()
Definition: FullConditional.cpp:72
virtual int calculateRelevantCompartments_OCL()=0
int * samples
Definition: LSS_FullConditional.hpp:103
~InitData()
Definition: FullConditional.cpp:63
void setSamplerType(int type)
Definition: FullConditional.cpp:77
double P_EI_priorAlpha
Definition: LSS_FullConditional.hpp:30
int getFullConditionalType()
Definition: FullConditional.cpp:98
double * I0Width
Definition: LSS_FullConditional.hpp:45
Definition: LSS_FullConditional.hpp:86
double Phi_priorBeta
Definition: LSS_FullConditional.hpp:35
virtual void setValue(long double value)=0
double * S0Width
Definition: LSS_FullConditional.hpp:44
virtual void updateSamplingParameters(double desiredRatio, double targetWidth, double proportionChange)=0
virtual ~ParameterFullConditional()
Definition: LSS_FullConditional.hpp:151
Sampler ** currentSampler
Definition: LSS_FullConditional.hpp:102
double * E_starWidth
Definition: LSS_FullConditional.hpp:42
virtual void setValue(long double value)=0
virtual void sample(int verbose)=0
virtual long double getValue()=0
virtual void setValue(long double value)=0
Definition: LSS_Samplers.hpp:46
struct containing hyperparameters for beta, betaP_RS, P_EI, and P_IR
Definition: LSS_FullConditional.hpp:26
double * phiWidth
Definition: LSS_FullConditional.hpp:51
virtual ~InitCompartmentFullConditional()
Definition: LSS_FullConditional.hpp:181
double betaPrsPriorPrecision
Definition: LSS_FullConditional.hpp:29
void populate(int *_S0, int *_E0, int *_I0, int *_R0, int *nLoc)
Definition: FullConditional.cpp:40
virtual ~CompartmentFullConditional()
Definition: LSS_FullConditional.hpp:119
virtual void setValue(long double value)=0
double betaPriorPrecision
Definition: LSS_FullConditional.hpp:28
void updateSamplingParameters(double desiredRatio, double targetWidth, double proportionChange)
Definition: FullConditional.cpp:120
virtual void sample(int verbose)=0
double * gammaEiWidth
Definition: LSS_FullConditional.hpp:49
double * sliceWidth
Definition: LSS_FullConditional.hpp:99
Simple class containing the starting compartment sizes.
Definition: LSS_FullConditional.hpp:55
int * I0
Definition: LSS_FullConditional.hpp:73
virtual void sample(int verbose)=0
double * rhoWidth
Definition: LSS_FullConditional.hpp:48
int getFullConditionalType()
Definition: FullConditional.cpp:103
virtual ~FullConditional()
Definition: LSS_FullConditional.hpp:90
virtual int calculateRelevantCompartments_OCL()=0
InitData()
Definition: FullConditional.cpp:35
double Phi_priorAlpha
Definition: LSS_FullConditional.hpp:34
double * R_starWidth
Definition: LSS_FullConditional.hpp:43