MUQ  0.4.3
SDEWrapper.cpp
Go to the documentation of this file.
1 #include "AllClassWrappers.h"
2 
4 
6 #include <Eigen/Sparse>
7 
8 #include <pybind11/pybind11.h>
9 #include <pybind11/eigen.h>
10 #include <pybind11/stl.h>
11 
12 using namespace muq::Modeling;
13 using namespace muq::Utilities;
14 namespace py = pybind11;
15 
17 
18  py::class_<LinearSDE, std::shared_ptr<LinearSDE> >(m, "LinearSDE")
19  .def(py::init( [] (Eigen::MatrixXd const& F, Eigen::MatrixXd const& L, Eigen::MatrixXd const& Q, py::dict const& d) { return new LinearSDE(F,L,Q, ConvertDictToPtree(d)); }))
20  .def(py::init( [] (Eigen::SparseMatrix<double> const& F, Eigen::MatrixXd const& L, Eigen::MatrixXd const& Q, py::dict const& d) { return new LinearSDE(F,L,Q, ConvertDictToPtree(d)); }))
21  .def(py::init( [] (Eigen::MatrixXd const& F, Eigen::SparseMatrix<double> const& L, Eigen::MatrixXd const& Q, py::dict const& d) { return new LinearSDE(F,L,Q, ConvertDictToPtree(d)); }))
22  .def(py::init( [] (Eigen::SparseMatrix<double> const& F, Eigen::SparseMatrix<double> const& L, Eigen::MatrixXd const& Q, py::dict const& d) { return new LinearSDE(F,L,Q, ConvertDictToPtree(d)); }))
23  .def(py::init( [] (std::shared_ptr<muq::Modeling::LinearOperator> F, std::shared_ptr<muq::Modeling::LinearOperator> L, Eigen::MatrixXd const& Q, py::dict const& d) { return new LinearSDE(F,L,Q,ConvertDictToPtree(d)); }))
24  .def("EvolveState", (void (LinearSDE::*)(py::EigenDRef<const Eigen::VectorXd> const&, double, py::EigenDRef<Eigen::VectorXd>) const) &LinearSDE::EvolveState)
25  .def("EvolveState", (Eigen::VectorXd (LinearSDE::*)(py::EigenDRef<const Eigen::VectorXd> const&, double) const) &LinearSDE::EvolveState)
26  //.def("EvolveDistribution", (void (LinearSDE::*)(std::pair<py::EigenDRef<Eigen::VectorXd>,py::EigenDRef<Eigen::MatrixXd>> const&, double) const) &LinearSDE::EvolveDistribution)
27  .def("EvolveDistribution", (void (LinearSDE::*)(py::EigenDRef<const Eigen::VectorXd> const&, py::EigenDRef<const Eigen::MatrixXd> const&, double, py::EigenDRef<Eigen::VectorXd>, py::EigenDRef<Eigen::MatrixXd>) const) &LinearSDE::EvolveDistribution, py::arg().noconvert(), py::arg().noconvert(), py::arg().noconvert(), py::arg().noconvert(), py::arg().noconvert())
28  .def("EvolveDistribution", (std::pair<Eigen::VectorXd, Eigen::MatrixXd> (LinearSDE::*)(std::pair<py::EigenDRef<const Eigen::VectorXd>,py::EigenDRef<const Eigen::MatrixXd>> const&, double) const) &LinearSDE::EvolveDistribution<py::EigenDRef<const Eigen::VectorXd>,py::EigenDRef<const Eigen::MatrixXd>>)
29  .def("EvolveDistribution", (std::pair<Eigen::VectorXd, Eigen::MatrixXd> (LinearSDE::*)(py::EigenDRef<const Eigen::VectorXd> const&, py::EigenDRef<const Eigen::MatrixXd> const&, double) const) &LinearSDE::EvolveDistribution<py::EigenDRef<const Eigen::VectorXd>,py::EigenDRef<const Eigen::MatrixXd>>)
30  .def("Discretize", &LinearSDE::Discretize)
31  .def_static("Concatenate", &LinearSDE::Concatenate)
32  .def("GetF", &LinearSDE::GetF)
33  .def("GetL", &LinearSDE::GetL)
34  .def("GetQ", &LinearSDE::GetQ)
35  .def_readonly("stateDim", &LinearSDE::stateDim);
36 }
Defines a linear time invariant stochastic differential equation with Gaussian process noise.
Definition: LinearSDE.h:28
std::shared_ptr< muq::Modeling::LinearOperator > GetL() const
Definition: LinearSDE.h:244
Eigen::VectorXd EvolveState(EigenRefVector const &f0, double T) const
Definition: LinearSDE.h:62
std::pair< Eigen::MatrixXd, Eigen::MatrixXd > Discretize(double deltaT)
Definition: LinearSDE.cpp:213
Eigen::MatrixXd const & GetQ() const
Definition: LinearSDE.h:245
static std::shared_ptr< LinearSDE > Concatenate(std::vector< std::shared_ptr< LinearSDE >> const &sdes, boost::property_tree::ptree options=boost::property_tree::ptree())
Combines the states of multiple SDEs into a single monolitch SDE.
Definition: LinearSDE.cpp:180
const int stateDim
The dimension of the state variable .
Definition: LinearSDE.h:240
std::shared_ptr< muq::Modeling::LinearOperator > GetF() const
Definition: LinearSDE.h:243
std::pair< Eigen::VectorXd, Eigen::MatrixXd > EvolveDistribution(EigenRefVector const &mu0, EigenRefMatrix const &gamma0, double T) const
Definition: LinearSDE.h:110
void SDEWrapper(pybind11::module &m)
boost::property_tree::ptree ConvertDictToPtree(pybind11::dict dict)