MUQ  0.4.3
KarhunenLoeveFactory.h
Go to the documentation of this file.
1 #ifndef KARHUNENLOEVEFACTORY_H
2 #define KARHUNENLOEVEFACTORY_H
3 
4 
6 
7 #include <boost/property_tree/ptree.hpp>
8 
9 #include <vector>
10 #include <memory>
11 
12 namespace muq
13 {
14 namespace Approximation
15 {
16 
17 
19  {
20 
21  public:
22 
23  template<typename KernelType>
24  KarhunenLoeveFactory(KernelType &kernelIn) : KarhunenLoeveFactory(kernelIn.GetPtr()){}
25 
26  KarhunenLoeveFactory(std::shared_ptr<KernelBase> kernelIn);
27 
28  void Compute(Eigen::VectorXd const& p0,
29  Eigen::VectorXd const& p1,
30  Eigen::VectorXi const& ns,
31  boost::property_tree::ptree options = boost::property_tree::ptree());
32 
33  Eigen::MatrixXd GetModes() const;
34  Eigen::VectorXd GetWeights() const;
35 
36  private:
37  std::shared_ptr<KernelBase> kernel;
38 
39  // Contains parts of the covariance kernel that can be separated based on dimension. i.e., the product of kernels acting in different dimensions
40  std::vector<std::shared_ptr<KernelBase>> kernelParts;
41 
42  Eigen::MatrixXd modes;
43  Eigen::VectorXd weights;
44 
45 
46  // Extract the seperable components of the kernel (requires kernel to be set and will fill in the contents of kernelParts)
47  static std::vector<std::shared_ptr<KernelBase>> SeparateKernel(std::shared_ptr<KernelBase> kernel);
48 
49  };
50 
51 
52 
53 } // namespace Approximation
54 } // namespace muq
55 
56 
57 #endif
static std::vector< std::shared_ptr< KernelBase > > SeparateKernel(std::shared_ptr< KernelBase > kernel)
std::vector< std::shared_ptr< KernelBase > > kernelParts
void Compute(Eigen::VectorXd const &p0, Eigen::VectorXd const &p1, Eigen::VectorXi const &ns, boost::property_tree::ptree options=boost::property_tree::ptree())