1 #ifndef __STAN__PROB__DISTRIBUTIONS__MULTIVARIATE__CONTINUOUS__MULTI_GP_HPP__
2 #define __STAN__PROB__DISTRIBUTIONS__MULTIVARIATE__CONTINUOUS__MULTI_GP_HPP__
4 #include <boost/random/normal_distribution.hpp>
5 #include <boost/random/variate_generator.hpp>
45 template <
bool propto,
46 typename T_y,
typename T_covar,
typename T_w,
48 typename boost::math::tools::promote_args<T_y,T_w,T_covar>::type
49 multi_gp_log(
const Eigen::Matrix<T_y,Eigen::Dynamic,Eigen::Dynamic>& y,
50 const Eigen::Matrix<T_covar,Eigen::Dynamic,Eigen::Dynamic>& Sigma,
51 const Eigen::Matrix<T_w,Eigen::Dynamic,1>& w,
53 static const char*
function =
"stan::prob::multi_gp_log(%1%)";
54 typename boost::math::tools::promote_args<T_y,T_w,T_covar>::type lp(0.0);
70 Sigma.rows(),
"Rows of kernel matrix",
71 Sigma.cols(),
"columns of kernel matrix",
74 if (!
check_positive(
function, Sigma.rows(),
"Kernel matrix rows", &lp, Policy()))
76 if (!
check_finite(
function, Sigma,
"Kernel", &lp, Policy()))
83 y.rows(),
"Size of random variable",
84 w.size(),
"Size of location parameter",
88 y.cols(),
"Size of random variable",
89 Sigma.rows(),
"rows of covariance parameter",
92 if (!
check_finite(
function, w,
"Kernel scales", &lp, Policy()))
96 if (!
check_not_nan(
function, y,
"Random variable", &lp, Policy()))
103 lp += NEG_LOG_SQRT_TWO_PI * y.rows() * y.cols();
111 lp += (0.5 * y.cols()) *
sum(
log(w));
115 Eigen::Matrix<
typename
116 boost::math::tools::promote_args<T_covar,T_y>::type,
124 template <
bool propto,
125 typename T_y,
typename T_loc,
typename T_covar>
127 typename boost::math::tools::promote_args<T_y,T_loc,T_covar>::type
128 multi_gp_log(
const Eigen::Matrix<T_y,Eigen::Dynamic,Eigen::Dynamic>& y,
129 const Eigen::Matrix<T_covar,Eigen::Dynamic,Eigen::Dynamic>& Sigma,
130 const Eigen::Matrix<T_loc,Eigen::Dynamic,1>& w) {
135 template <
typename T_y,
typename T_loc,
typename T_covar,
138 typename boost::math::tools::promote_args<T_y,T_loc,T_covar>::type
139 multi_gp_log(
const Eigen::Matrix<T_y,Eigen::Dynamic,Eigen::Dynamic>& y,
140 const Eigen::Matrix<T_covar,Eigen::Dynamic,Eigen::Dynamic>& Sigma,
141 const Eigen::Matrix<T_loc,Eigen::Dynamic,1>& w,
143 return multi_gp_log<false>(y,Sigma,w,Policy());
147 template <
typename T_y,
typename T_loc,
typename T_covar>
149 typename boost::math::tools::promote_args<T_y,T_loc,T_covar>::type
150 multi_gp_log(
const Eigen::Matrix<T_y,Eigen::Dynamic,Eigen::Dynamic>& y,
151 const Eigen::Matrix<T_covar,Eigen::Dynamic,Eigen::Dynamic>& Sigma,
152 const Eigen::Matrix<T_loc,Eigen::Dynamic,1>& w) {