MUQ  0.4.3
CrankNicolsonProposal.h
Go to the documentation of this file.
1 #ifndef CRANKNICOLSONPROPOSAL_H_
2 #define CRANKNICOLSONPROPOSAL_H_
3 
6 
8 
9 namespace muq {
10  namespace SamplingAlgorithms {
11 
34  public:
35 
36  CrankNicolsonProposal(boost::property_tree::ptree const& pt,
37  std::shared_ptr<AbstractSamplingProblem> prob,
38  std::shared_ptr<muq::Modeling::GaussianBase> prior);
39 
40  CrankNicolsonProposal(boost::property_tree::ptree const& pt,
41  std::shared_ptr<AbstractSamplingProblem> prob);
42 
43  virtual ~CrankNicolsonProposal() = default;
44 
45  protected:
46 
47  double beta;
48 
49  // When the prior distribution has inputs, we need to save information to evaluate them
50  std::shared_ptr<muq::Modeling::ModPiece> priorMeanModel;
51  std::vector<int> priorMeanInds;
52 
53  std::shared_ptr<muq::Modeling::ModPiece> priorCovModel;
54  std::vector<int> priorCovInds;
56 
57  std::vector<Eigen::VectorXd>GetPriorInputs(std::vector<Eigen::VectorXd> const& currState);
58 
59  //const Eigen::VectorXd priorMu;
60 
62  //std::shared_ptr<muq::Modeling::Gaussian> propPart;
63 
64  // Sometimes we have to keep track of the prior distribution so we can update the proposal mean and covariance
65  std::shared_ptr<muq::Modeling::GaussianBase> priorDist;
66 
67  virtual std::shared_ptr<SamplingState> Sample(std::shared_ptr<SamplingState> const& currentState) override;
68 
69  virtual double LogDensity(std::shared_ptr<SamplingState> const& currState,
70  std::shared_ptr<SamplingState> const& propState) override;
71 
72  void ExtractPrior(std::shared_ptr<AbstractSamplingProblem> const& prob, std::string nodeName);
73  };
74 
75  } // namespace SamplingAlgoirthms
76 } // namespace muq
77 
78 #endif
An implement of the dimension-independent pCN proposal.
std::shared_ptr< muq::Modeling::ModPiece > priorMeanModel
std::shared_ptr< muq::Modeling::GaussianBase > priorDist
The proposal distribution.
void ExtractPrior(std::shared_ptr< AbstractSamplingProblem > const &prob, std::string nodeName)
std::vector< Eigen::VectorXd > GetPriorInputs(std::vector< Eigen::VectorXd > const &currState)
virtual double LogDensity(std::shared_ptr< SamplingState > const &currState, std::shared_ptr< SamplingState > const &propState) override
std::shared_ptr< muq::Modeling::ModPiece > priorCovModel
CrankNicolsonProposal(boost::property_tree::ptree const &pt, std::shared_ptr< AbstractSamplingProblem > prob, std::shared_ptr< muq::Modeling::GaussianBase > prior)
virtual std::shared_ptr< SamplingState > Sample(std::shared_ptr< SamplingState > const &currentState) override
std::shared_ptr< AbstractSamplingProblem > prob
Definition: MCMCProposal.h:81