11 namespace SamplingAlgorithms {
50 std::shared_ptr<Eigen::ColPivHouseholderQR<Eigen::MatrixXd>>
const& uQRIn,
51 std::shared_ptr<Eigen::MatrixXd>
const& oldWIn,
52 std::shared_ptr<Eigen::VectorXd>
const& oldValsIn,
53 std::shared_ptr<muq::Modeling::LinearOperator>
const&
newHess);
56 virtual Eigen::MatrixXd
Apply(Eigen::Ref<const Eigen::MatrixXd>
const& x)
override;
59 virtual Eigen::MatrixXd
ApplyTranspose(Eigen::Ref<const Eigen::MatrixXd>
const& x)
override;
63 std::shared_ptr<Eigen::MatrixXd>
oldW;
64 std::shared_ptr<Eigen::ColPivHouseholderQR<Eigen::MatrixXd>>
uQR;
67 std::shared_ptr<muq::Modeling::LinearOperator>
newHess;
77 std::shared_ptr<Eigen::MatrixXd>
const& Win,
84 virtual Eigen::MatrixXd
Apply(Eigen::Ref<const Eigen::MatrixXd>
const& x)
override;
87 virtual Eigen::MatrixXd
ApplyTranspose(Eigen::Ref<const Eigen::MatrixXd>
const& x)
override;
90 std::shared_ptr<Eigen::MatrixXd>
U,
W;
98 LIS2Full(std::shared_ptr<Eigen::MatrixXd>
const& Uin,
99 std::shared_ptr<Eigen::VectorXd>
const& Lin) :
LinearOperator(Uin->rows(), Lin->rows()),
100 U(Uin),
L(Lin),
lisDim(Lin->rows()){};
105 virtual Eigen::MatrixXd
Apply(Eigen::Ref<const Eigen::MatrixXd>
const& x)
override;
108 virtual Eigen::MatrixXd
ApplyTranspose(Eigen::Ref<const Eigen::MatrixXd>
const& x)
override;
111 std::shared_ptr<Eigen::MatrixXd>
U;
112 std::shared_ptr<Eigen::VectorXd>
L;
144 DILIKernel(boost::property_tree::ptree
const& pt,
145 std::shared_ptr<AbstractSamplingProblem>
problem);
147 DILIKernel(boost::property_tree::ptree
const& pt,
148 std::shared_ptr<AbstractSamplingProblem>
problem,
149 Eigen::VectorXd
const& genEigVals,
150 Eigen::MatrixXd
const& genEigVecs);
152 DILIKernel(boost::property_tree::ptree
const& pt,
153 std::shared_ptr<AbstractSamplingProblem>
problem,
154 std::shared_ptr<muq::Modeling::GaussianBase>
const&
prior,
155 std::shared_ptr<muq::Modeling::ModPiece>
const& noiseModel,
156 std::shared_ptr<muq::Modeling::ModPiece>
const& forwardModelIn);
158 DILIKernel(boost::property_tree::ptree
const& pt,
159 std::shared_ptr<AbstractSamplingProblem>
problem,
160 std::shared_ptr<muq::Modeling::GaussianBase>
const&
prior,
161 std::shared_ptr<muq::Modeling::ModPiece>
const& noiseModel,
162 std::shared_ptr<muq::Modeling::ModPiece>
const& forwardModelIn,
163 Eigen::VectorXd
const& genEigVals,
164 Eigen::MatrixXd
const& genEigVecs);
167 DILIKernel(boost::property_tree::ptree
const& pt,
168 std::shared_ptr<AbstractSamplingProblem>
problem,
169 std::shared_ptr<muq::Modeling::GaussianBase>
const&
prior,
170 std::shared_ptr<muq::Modeling::ModPiece>
const& likelihood);
172 DILIKernel(boost::property_tree::ptree
const& pt,
173 std::shared_ptr<AbstractSamplingProblem>
problem,
174 std::shared_ptr<muq::Modeling::GaussianBase>
const&
prior,
175 std::shared_ptr<muq::Modeling::ModPiece>
const& likelihood,
176 Eigen::VectorXd
const& genEigVals,
177 Eigen::MatrixXd
const& genEigVecs);
184 virtual void PostStep(
unsigned int const t,
185 std::vector<std::shared_ptr<SamplingState>>
const& state)
override;
187 virtual std::vector<std::shared_ptr<SamplingState>>
Step(
unsigned int const t,
188 std::shared_ptr<SamplingState> prevState)
override;
190 virtual void PrintStatus(std::string prefix)
const override;
195 static std::shared_ptr<muq::Modeling::ModPiece>
ExtractLikelihood(std::shared_ptr<AbstractSamplingProblem>
const&
problem,
196 std::string
const& nodeName);
202 static std::shared_ptr<muq::Modeling::GaussianBase>
ExtractPrior(std::shared_ptr<AbstractSamplingProblem>
const&
problem,
203 std::string
const& nodeName);
205 static std::shared_ptr<muq::Modeling::ModPiece>
ExtractNoiseModel(std::shared_ptr<muq::Modeling::ModPiece>
const& likelihood);
208 static std::shared_ptr<muq::Modeling::ModPiece>
ExtractForwardModel(std::shared_ptr<muq::Modeling::ModPiece>
const& likelihoodIn);
211 std::shared_ptr<muq::Modeling::ModPiece>
const&
noiseDensity);
216 Eigen::VectorXd
const&
LISL()
const{
return *
lisL;};
222 void CreateLIS(std::vector<Eigen::VectorXd>
const& currState);
227 Eigen::VectorXd
ToLIS(Eigen::VectorXd
const& x)
const;
232 Eigen::VectorXd
FromLIS(Eigen::VectorXd
const& r)
const;
238 Eigen::VectorXd
ToCS(Eigen::VectorXd
const& x)
const;
243 std::pair<Eigen::MatrixXd, Eigen::VectorXd>
ComputeLocalLIS(std::vector<Eigen::VectorXd>
const& currState);
248 void SetLIS(Eigen::VectorXd
const& eigVals, Eigen::MatrixXd
const& eigVecs);
258 std::vector<Eigen::VectorXd>
const& currState);
267 std::shared_ptr<muq::Modeling::GaussianBase>
prior;
273 std::shared_ptr<Eigen::MatrixXd>
hessU;
276 std::shared_ptr<Eigen::ColPivHouseholderQR<Eigen::MatrixXd>>
hessUQR;
282 std::shared_ptr<Eigen::MatrixXd>
hessW;
285 std::shared_ptr<Eigen::VectorXd>
lisL;
288 std::shared_ptr<muq::Modeling::LinearOperator>
lisToFull;
291 std::shared_ptr<muq::Modeling::LinearOperator>
fullToCS;
Generic linear operator base class.
LinearOperator(int rowsIn, int colsIn, int numInputCols=1)
virtual Eigen::MatrixXd Apply(Eigen::Ref< const Eigen::MatrixXd > const &x) override
AverageHessian(unsigned int numOldSamps, std::shared_ptr< Eigen::ColPivHouseholderQR< Eigen::MatrixXd >> const &uQRIn, std::shared_ptr< Eigen::MatrixXd > const &oldWIn, std::shared_ptr< Eigen::VectorXd > const &oldValsIn, std::shared_ptr< muq::Modeling::LinearOperator > const &newHess)
std::shared_ptr< muq::Modeling::LinearOperator > newHess
std::shared_ptr< Eigen::VectorXd > oldEigVals
std::shared_ptr< Eigen::MatrixXd > oldW
virtual Eigen::MatrixXd ApplyTranspose(Eigen::Ref< const Eigen::MatrixXd > const &x) override
std::shared_ptr< Eigen::ColPivHouseholderQR< Eigen::MatrixXd > > uQR
std::shared_ptr< Eigen::MatrixXd > W
CSProjector(std::shared_ptr< Eigen::MatrixXd > const &Uin, std::shared_ptr< Eigen::MatrixXd > const &Win, unsigned int lisDimIn)
virtual ~CSProjector()=default
virtual Eigen::MatrixXd ApplyTranspose(Eigen::Ref< const Eigen::MatrixXd > const &x) override
std::shared_ptr< Eigen::MatrixXd > U
virtual Eigen::MatrixXd Apply(Eigen::Ref< const Eigen::MatrixXd > const &x) override
An implementation of the Dimension Independent Likelihood Informed subspace (DILI) MCMC sampler.
boost::property_tree::ptree csKernelOpts
virtual std::vector< std::shared_ptr< SamplingState > > Step(unsigned int const t, std::shared_ptr< SamplingState > prevState) override
Eigen::MatrixXd const & LISW() const
std::shared_ptr< muq::Modeling::LinearOperator > lisToFull
virtual std::shared_ptr< TransitionKernel > LISKernel()
std::shared_ptr< Eigen::ColPivHouseholderQR< Eigen::MatrixXd > > hessUQR
static std::shared_ptr< muq::Modeling::ModPiece > CreateLikelihood(std::shared_ptr< muq::Modeling::ModPiece > const &forwardModel, std::shared_ptr< muq::Modeling::ModPiece > const &noiseDensity)
std::shared_ptr< muq::Modeling::GaussianBase > prior
void UpdateLIS(unsigned int numSamps, std::vector< Eigen::VectorXd > const &currState)
std::shared_ptr< Eigen::MatrixXd > hessW
std::shared_ptr< TransitionKernel > lisKernel
Eigen::VectorXd const & LISL() const
boost::property_tree::ptree eigOpts
std::pair< Eigen::MatrixXd, Eigen::VectorXd > ComputeLocalLIS(std::vector< Eigen::VectorXd > const &currState)
Eigen::VectorXd FromLIS(Eigen::VectorXd const &r) const
std::shared_ptr< muq::Modeling::ModPiece > noiseDensity
std::shared_ptr< Eigen::VectorXd > hessEigVals
Eigen::VectorXd const & LISVals() const
static std::shared_ptr< muq::Modeling::ModPiece > ExtractLikelihood(std::shared_ptr< AbstractSamplingProblem > const &problem, std::string const &nodeName)
void SetLIS(Eigen::VectorXd const &eigVals, Eigen::MatrixXd const &eigVecs)
boost::property_tree::ptree lisKernelOpts
unsigned int LISDim() const
std::shared_ptr< muq::Modeling::ModPiece > logLikelihood
Eigen::MatrixXd const & LISVecs() const
const int initialHessSamps
static std::shared_ptr< muq::Modeling::ModPiece > ExtractForwardModel(std::shared_ptr< muq::Modeling::ModPiece > const &likelihoodIn)
std::shared_ptr< Eigen::MatrixXd > hessU
virtual std::shared_ptr< TransitionKernel > CSKernel()
static std::shared_ptr< muq::Modeling::ModPiece > ExtractNoiseModel(std::shared_ptr< muq::Modeling::ModPiece > const &likelihood)
Eigen::VectorXd ToLIS(Eigen::VectorXd const &x) const
std::shared_ptr< TransitionKernel > csKernel
static std::shared_ptr< muq::Modeling::GaussianBase > ExtractPrior(std::shared_ptr< AbstractSamplingProblem > const &problem, std::string const &nodeName)
void CreateLIS(std::vector< Eigen::VectorXd > const &currState)
std::shared_ptr< muq::Modeling::ModPiece > forwardModel
virtual ~DILIKernel()=default
virtual void PostStep(unsigned int const t, std::vector< std::shared_ptr< SamplingState >> const &state) override
Allow the kernel to adapt given a new state.
Eigen::VectorXd ToCS(Eigen::VectorXd const &x) const
DILIKernel(boost::property_tree::ptree const &pt, std::shared_ptr< AbstractSamplingProblem > problem)
std::shared_ptr< Eigen::VectorXd > lisL
unsigned int numLisUpdates
std::shared_ptr< muq::Modeling::LinearOperator > fullToCS
virtual ~LIS2Full()=default
const unsigned int lisDim
LIS2Full(std::shared_ptr< Eigen::MatrixXd > const &Uin, std::shared_ptr< Eigen::VectorXd > const &Lin)
std::shared_ptr< Eigen::MatrixXd > U
std::shared_ptr< Eigen::VectorXd > L
virtual Eigen::MatrixXd ApplyTranspose(Eigen::Ref< const Eigen::MatrixXd > const &x) override
virtual Eigen::MatrixXd Apply(Eigen::Ref< const Eigen::MatrixXd > const &x) override
Defines the transition kernel used by an MCMC algorithm.
std::shared_ptr< AbstractSamplingProblem > problem
The sampling problem that evaluates/samples the target distribution.
virtual void PrintStatus() const