MUQ  0.4.3
SamplingProblem.h
Go to the documentation of this file.
1 #ifndef SAMPLINGPROBLEM_H_
2 #define SAMPLINGPROBLEM_H_
3 
4 // include Density and not ModPiece so that if a SamplingProblem is constructed with a Density the compiler knows it is a child of ModPiece
7 
8 namespace muq {
9  namespace SamplingAlgorithms {
10 
16  public:
17 
21  SamplingProblem(std::shared_ptr<muq::Modeling::ModPiece> const& targetIn);
22 
27  SamplingProblem(std::shared_ptr<muq::Modeling::ModPiece> const& targetIn,
28  std::shared_ptr<muq::Modeling::ModPiece> const& qoiIn);
29 
30  virtual ~SamplingProblem() = default;
31 
32  virtual std::shared_ptr<AbstractSamplingProblem> Clone() const override{return std::make_shared<SamplingProblem>(target, qoi);};
33 
34  virtual double LogDensity(std::shared_ptr<SamplingState> const& state) override;
35 
36  virtual Eigen::VectorXd GradLogDensity(std::shared_ptr<SamplingState> const& state,
37  unsigned const blockWrt) override;
38 
39  std::shared_ptr<muq::Modeling::ModPiece> GetDistribution(){return target;};
40 
41  virtual std::shared_ptr<SamplingState> QOI() override;
42 
43  protected:
44 
46  std::shared_ptr<muq::Modeling::ModPiece> target;
47 
48  std::shared_ptr<muq::Modeling::ModPiece> qoi;
49 
50  std::shared_ptr<SamplingState> lastState;
51 
52  private:
53 
54  static unsigned GetNumBlocks(std::shared_ptr<muq::Modeling::ModPiece> const& target);
55  static std::vector<int> GetBlockSizes(std::shared_ptr<muq::Modeling::ModPiece> const& target);
56  };
57  } // namespace SamplingAlgorithms
58 } // namespace muq
59 
60 #endif
Abstract base class for MCMC and Importance Sampling problems.
Class for sampling problems based purely on a density function.
virtual Eigen::VectorXd GradLogDensity(std::shared_ptr< SamplingState > const &state, unsigned const blockWrt) override
std::shared_ptr< muq::Modeling::ModPiece > qoi
static unsigned GetNumBlocks(std::shared_ptr< muq::Modeling::ModPiece > const &target)
std::shared_ptr< muq::Modeling::ModPiece > target
The target distribution (the prior in the inference case)
virtual double LogDensity(std::shared_ptr< SamplingState > const &state) override
std::shared_ptr< muq::Modeling::ModPiece > GetDistribution()
static std::vector< int > GetBlockSizes(std::shared_ptr< muq::Modeling::ModPiece > const &target)
virtual std::shared_ptr< AbstractSamplingProblem > Clone() const override
SamplingProblem(std::shared_ptr< muq::Modeling::ModPiece > const &targetIn)
std::shared_ptr< SamplingState > lastState
virtual std::shared_ptr< SamplingState > QOI() override