1 #ifndef STAN_MATH_PRIM_MAT_PROB_MULTI_GP_LPDF_HPP 2 #define STAN_MATH_PRIM_MAT_PROB_MULTI_GP_LPDF_HPP 37 template <
bool propto,
typename T_y,
typename T_covar,
typename T_w>
38 typename boost::math::tools::promote_args<T_y, T_covar, T_w>::type
40 const Eigen::Matrix<T_y, Eigen::Dynamic, Eigen::Dynamic>& y,
41 const Eigen::Matrix<T_covar, Eigen::Dynamic, Eigen::Dynamic>& Sigma,
42 const Eigen::Matrix<T_w, Eigen::Dynamic, 1>& w) {
43 static const char*
function =
"multi_gp_lpdf";
45 typename boost::math::tools::promote_args<T_y, T_covar, T_w>::type T_lp;
56 "Size of kernel scales (w)", w.size());
58 "rows of covariance parameter", Sigma.rows());
74 lp += (0.5 * y.cols()) *
sum(
log(w));
78 Eigen::Matrix<T_w, Eigen::Dynamic, Eigen::Dynamic> w_mat(w.asDiagonal());
79 Eigen::Matrix<T_y, Eigen::Dynamic, Eigen::Dynamic> yT(y.transpose());
86 template <
typename T_y,
typename T_covar,
typename T_w>
87 inline typename boost::math::tools::promote_args<T_y, T_covar, T_w>::type
89 const Eigen::Matrix<T_y, Eigen::Dynamic, Eigen::Dynamic>& y,
90 const Eigen::Matrix<T_covar, Eigen::Dynamic, Eigen::Dynamic>& Sigma,
91 const Eigen::Matrix<T_w, Eigen::Dynamic, 1>& w) {
92 return multi_gp_lpdf<false>(y, Sigma, w);
fvar< T > sum(const std::vector< fvar< T > > &m)
Return the sum of the entries of the specified standard vector.
void check_finite(const char *function, const char *name, const T_y &y)
Check if y is finite.
boost::math::tools::promote_args< T_y, T_covar, T_w >::type multi_gp_lpdf(const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const Eigen::Matrix< T_covar, Eigen::Dynamic, Eigen::Dynamic > &Sigma, const Eigen::Matrix< T_w, Eigen::Dynamic, 1 > &w)
The log of a multivariate Gaussian Process for the given y, Sigma, and w.
void check_ldlt_factor(const char *function, const char *name, LDLT_factor< T, R, C > &A)
Raise domain error if the specified LDLT factor is invalid.
fvar< T > log(const fvar< T > &x)
std::enable_if< !stan::is_var< T1 >::value &&!stan::is_var< T2 >::value &&!stan::is_var< T3 >::value, typename boost::math::tools::promote_args< T1, T2, T3 >::type >::type trace_gen_inv_quad_form_ldlt(const Eigen::Matrix< T1, R1, C1 > &D, const LDLT_factor< T2, R2, C2 > &A, const Eigen::Matrix< T3, R3, C3 > &B)
void check_size_match(const char *function, const char *name_i, T_size1 i, const char *name_j, T_size2 j)
Check if the provided sizes match.
Template metaprogram to calculate whether a summand needs to be included in a proportional (log) prob...
void check_positive_finite(const char *function, const char *name, const T_y &y)
Check if y is positive and finite.
LDLT_factor is a thin wrapper on Eigen::LDLT to allow for reusing factorizations and efficient autodi...
const double NEG_LOG_SQRT_TWO_PI
void check_positive(const char *function, const char *name, const T_y &y)
Check if y is positive.
void check_symmetric(const char *function, const char *name, const matrix_cl &y)
Check if the matrix_cl is symmetric.
T log_determinant_ldlt(LDLT_factor< T, R, C > &A)