32 #ifndef UQTKMCMC_H_SEEN
33 #define UQTKMCMC_H_SEEN
35 #include "dsfmt_add.h"
56 virtual double fun(
double* x,
int n){
return 0.0;}
94 void setWriteFlag(
int I);
96 void setFcnAccept(
void (*fcnAccept)(
void *));
97 void setFcnReject(
void (*fcnReject)(
void *));
99 void setChainDim(
int chdim);
107 void setOutputInfo(
string outtype,
string file,
int freq_file,
int freq_screen);
109 void namesPrepended();
111 void setSeed(
int seed);
113 void setLower(
double lower,
int i);
115 void setUpper(
double upper,
int i);
117 void setDefaultDomain();
119 void setPostInfo(
void *postinfo);
126 string getFilename();
134 void getFcnAccept(
void (*fcnAccept)(
void *));
135 void getFcnReject(
void (*fcnReject)(
void *));
137 string getOutputType();
143 bool getNamesPrepended();
147 double getLower(
int i);
149 double getUpper(
int i);
153 void getPostInfo(
void *post);
155 bool getPropCovInit();
157 bool getOutputInit();
161 bool getFcnAcceptInit();
162 bool getFcnRejectInit();
166 int getLowerFlag(
int i);
167 int getUpperFlag(
int i);
169 void getAcceptRatio(
double * accrat);
171 double getAcceptRatio();
173 int GetChainDim()
const;
178 void resetChainState();
180 void resetChainFilename(
string filename);
192 int getFullChainSize();
197 void setCurrentStateStep(
int i);
201 double getCurrentStatePost();
205 void setCurrentStatePost(
double newPost);
207 void setCurrentStateAlfa(
double newAlfa);
209 double getModeStatePost();
235 void writeChainTxt(
string filename);
237 void writeChainBin(
string filename);
240 void setNewMode(
bool value);
246 void setAcceptRatio(
double d);
248 void addCurrentState();
252 void setLastWrite(
int i);
269 void (*fcnAccept_)(
void *) = NULL;
270 void (*fcnReject_)(
void *) = NULL;
271 void *postInfo_ = NULL;
285 bool namesPrepend =
false;
287 bool newMode_ =
false;
289 double accRatio_ = -1.0;
292 bool chaindimInit_ =
false;
293 bool propcovInit_ =
false;
294 bool methodInit_ =
false;
295 bool outputInit_ =
false;
297 bool fcnAcceptFlag_ =
false;
298 bool fcnRejectFlag_ =
false;
Header file for array read/write utilities.
Definition: Array1D.h:472
Definition: Array1D.h:262
Stores data of any type T in a 1D array.
Definition: Array1D.h:61
virtual ~LogPosteriorBase()
Definition: mcmc.h:51
virtual double eval(Array1D< double > &)
Definition: mcmc.h:48
Markov Chain Monte Carlo base class. Implemented the basic and most general MCMC algorithms.
Definition: mcmc.h:72
Array2D< double > chcov
Definition: mcmc.h:272
LogPosteriorBase * L_
Definition: mcmc.h:260
chainstate currState_
Definition: mcmc.h:275
Array1D< int > lower_flag_
Lower bound existence flags.
Definition: mcmc.h:306
Array1D< int > upper_flag_
Upper bound existence flags.
Definition: mcmc.h:308
int chainDim_
Definition: mcmc.h:267
dsfmt_t RandomState
Definition: mcmc.h:254
virtual void runChain(int ncalls)=0
Start an MCMC chain with trivial initial condition.
virtual void runChain(int ncalls, Array1D< double > &chstart)=0
The actual function that generates MCMC.
int seed_
Definition: mcmc.h:273
int FLAG
Definition: mcmc.h:259
Array1D< double > Lower_
Lower bounds.
Definition: mcmc.h:301
virtual int getNSubSteps()
Get function for number of sub steps.
Definition: mcmc.h:164
virtual double probOldNew(Array1D< double > &a, Array1D< double > &b)
Definition: mcmc.h:275
Array1D< double > Upper_
Upper bounds.
Definition: mcmc.h:303
int WRITE_FLAG
Definition: mcmc.h:258
int lastwrite_
Definition: mcmc.h:284
Array1D< chainstate > fullChain_
Definition: mcmc.h:280
chainstate modeState_
Definition: mcmc.h:279
virtual double fun(double *x, int n)
Definition: mcmc.h:56
base * b_
Definition: mcmc.h:61
main(base &b)
Definition: mcmc.h:63
double alfa
Definition: mcmc.h:78
Array1D< double > state
Definition: mcmc.h:77
double post
Definition: mcmc.h:79
int step
Definition: mcmc.h:76
string filename
Definition: mcmc.h:263
int freq_file
Definition: mcmc.h:264
string outtype
Definition: mcmc.h:262
int freq_screen
Definition: mcmc.h:265