1 #ifndef PRODUCTKERNEL_H
2 #define PRODUCTKERNEL_H
20 namespace Approximation
37 std::shared_ptr<KernelBase> kernel2In);
41 virtual void FillBlock(Eigen::Ref<const Eigen::VectorXd>
const& x1,
42 Eigen::Ref<const Eigen::VectorXd>
const& x2,
43 Eigen::Ref<const Eigen::VectorXd>
const& params,
44 Eigen::Ref<Eigen::MatrixXd> block)
const override;
47 Eigen::Ref<const Eigen::VectorXd>
const& x2,
48 Eigen::Ref<const Eigen::VectorXd>
const& params,
49 std::vector<int>
const& wrts,
50 Eigen::Ref<Eigen::MatrixXd> block)
const override
61 kernel1->FillPosDerivBlock(x1,x2,params.head(
kernel1->numParams),{wrts.at(0)}, deriv1_i);
64 kernel2->FillPosDerivBlock(x1,x2,params.tail(
kernel2->numParams), {wrts.at(0)}, deriv2_i);
67 block = (deriv2_i.array() * eval1.array() + deriv1_i.array()*eval2.array()).matrix();
69 }
else if(wrts.size()==2){
71 kernel1->FillPosDerivBlock(x1,x2,params.head(
kernel1->numParams),{wrts.at(1)}, deriv1_j);
74 kernel2->FillPosDerivBlock(x1,x2,params.tail(
kernel2->numParams), {wrts.at(1)}, deriv2_j);
77 kernel1->FillPosDerivBlock(x1,x2,params.head(
kernel1->numParams), wrts, secDeriv1_ij);
80 kernel2->FillPosDerivBlock(x1,x2,params.tail(
kernel2->numParams), wrts, secDeriv2_ij);
82 block = (secDeriv1_ij.array() * eval2.array() + deriv1_i.array()*deriv2_j.array() + deriv1_j.array()*deriv2_i.array() + eval1.array()*secDeriv2_ij.array()).matrix();
89 virtual std::shared_ptr<KernelBase>
Clone()
const override{
return std::make_shared<ProductKernel>(
kernel1,
kernel2);};
132 virtual std::tuple<std::shared_ptr<muq::Modeling::LinearSDE>, std::shared_ptr<muq::Modeling::LinearOperator>, Eigen::MatrixXd>
GetStateSpace(boost::property_tree::ptree sdeOptions=boost::property_tree::ptree())
const override;
138 std::tuple<std::shared_ptr<muq::Modeling::LinearSDE>, std::shared_ptr<muq::Modeling::LinearOperator>, Eigen::MatrixXd>
GetProductStateSpace(std::shared_ptr<PeriodicKernel>
const&
kernel1,
139 std::shared_ptr<KernelBase>
const&
kernel2,
140 boost::property_tree::ptree sdeOptions)
const;
146 template<
typename KernelType1,
typename KernelType2,
153 std::shared_ptr<ProductKernel>
operator*(std::shared_ptr<KernelBase> k1, std::shared_ptr<KernelBase> k2);
Base class for all covariance kernels.
std::tuple< std::shared_ptr< muq::Modeling::LinearSDE >, std::shared_ptr< muq::Modeling::LinearOperator >, Eigen::MatrixXd > GetProductStateSpace(std::shared_ptr< PeriodicKernel > const &kernel1, std::shared_ptr< KernelBase > const &kernel2, boost::property_tree::ptree sdeOptions) const
virtual std::vector< std::shared_ptr< KernelBase > > GetSeperableComponents() override
Overridden by ProductKernel.
virtual void FillBlock(Eigen::Ref< const Eigen::VectorXd > const &x1, Eigen::Ref< const Eigen::VectorXd > const &x2, Eigen::Ref< const Eigen::VectorXd > const ¶ms, Eigen::Ref< Eigen::MatrixXd > block) const override
virtual std::tuple< std::shared_ptr< muq::Modeling::LinearSDE >, std::shared_ptr< muq::Modeling::LinearOperator >, Eigen::MatrixXd > GetStateSpace(boost::property_tree::ptree sdeOptions=boost::property_tree::ptree()) const override
Returns a state space representation of the covariance kernel.
virtual std::shared_ptr< KernelBase > Clone() const override
virtual void FillPosDerivBlock(Eigen::Ref< const Eigen::VectorXd > const &x1, Eigen::Ref< const Eigen::VectorXd > const &x2, Eigen::Ref< const Eigen::VectorXd > const ¶ms, std::vector< int > const &wrts, Eigen::Ref< Eigen::MatrixXd > block) const override
std::shared_ptr< KernelBase > kernel2
std::shared_ptr< KernelBase > kernel1
ProductKernel(std::shared_ptr< KernelBase > kernel1In, std::shared_ptr< KernelBase > kernel2In)
LinearTransformMean< MeanType > operator*(Eigen::MatrixXd const &A, MeanType const &K)