Stan  2.14.0
probability, sampling & optimization
model_functional.hpp
Go to the documentation of this file.
1 #ifndef STAN_MODEL_MODEL_FUNCTIONAL_HPP
2 #define STAN_MODEL_MODEL_FUNCTIONAL_HPP
3 
4 #include <Eigen/Dense>
5 #include <iostream>
6 
7 namespace stan {
8  namespace model {
9 
10  // Interface for automatic differentiation of models
11  template <class M>
13  const M& model;
14  std::ostream* o;
15 
16  model_functional(const M& m, std::ostream* out)
17  : model(m), o(out) {}
18 
19  template <typename T>
20  T operator()(Eigen::Matrix<T, Eigen::Dynamic, 1>& x) const {
21  return model.template log_prob<true, true, T>(x, o);
22  }
23  };
24 
25  }
26 }
27 #endif
T operator()(Eigen::Matrix< T, Eigen::Dynamic, 1 > &x) const
Probability, optimization and sampling library.
model_functional(const M &m, std::ostream *out)

     [ Stan Home Page ] © 2011–2016, Stan Development Team.