1 #ifndef STAN_MATH_PRIM_MAT_PROB_MULTI_GP_LOG_HPP
2 #define STAN_MATH_PRIM_MAT_PROB_MULTI_GP_LOG_HPP
39 template <
bool propto,
40 typename T_y,
typename T_covar,
typename T_w>
41 typename boost::math::tools::promote_args<T_y, T_covar, T_w>::type
42 multi_gp_log(
const Eigen::Matrix<T_y, Eigen::Dynamic, Eigen::Dynamic>& y,
44 <T_covar, Eigen::Dynamic, Eigen::Dynamic>& Sigma,
45 const Eigen::Matrix<T_w, Eigen::Dynamic, 1>& w) {
46 static const char*
function(
"multi_gp_log");
47 typedef typename boost::math::tools::promote_args<T_y, T_covar, T_w>::type
60 "Size of random variable (rows y)", y.rows(),
61 "Size of kernel scales (w)", w.size());
63 "Size of random variable", y.cols(),
64 "rows of covariance parameter", Sigma.rows());
80 lp += (0.5 * y.cols()) *
sum(
log(w));
84 Eigen::Matrix<T_w, Eigen::Dynamic, Eigen::Dynamic>
85 w_mat(w.asDiagonal());
86 Eigen::Matrix<T_y, Eigen::Dynamic, Eigen::Dynamic> yT(y.transpose());
93 template <
typename T_y,
typename T_covar,
typename T_w>
95 typename boost::math::tools::promote_args<T_y, T_covar, T_w>::type
96 multi_gp_log(
const Eigen::Matrix<T_y, Eigen::Dynamic, Eigen::Dynamic>& y,
97 const Eigen::Matrix<T_covar, Eigen::Dynamic, Eigen::Dynamic>&
99 const Eigen::Matrix<T_w, Eigen::Dynamic, 1>& w) {
100 return multi_gp_log<false>(y, Sigma, w);
fvar< T > sum(const std::vector< fvar< T > > &m)
Return the sum of the entries of the specified standard vector.
fvar< T > log(const fvar< T > &x)
Template metaprogram to calculate whether a summand needs to be included in a proportional (log) prob...
bool check_ldlt_factor(const char *function, const char *name, LDLT_factor< T, R, C > &A)
Return true if the argument is a valid LDLT_factor.
bool check_positive(const char *function, const char *name, const T_y &y)
Return true if y is positive.
bool check_size_match(const char *function, const char *name_i, T_size1 i, const char *name_j, T_size2 j)
Return true if the provided sizes match.
boost::math::tools::promote_args< T_y, T_covar, T_w >::type multi_gp_log(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.
const double NEG_LOG_SQRT_TWO_PI
bool check_finite(const char *function, const char *name, const T_y &y)
Return true if y is finite.
bool check_symmetric(const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
Return true if the specified matrix is symmetric.
T log_determinant_ldlt(LDLT_factor< T, R, C > &A)
boost::enable_if_c<!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)
bool check_positive_finite(const char *function, const char *name, const T_y &y)
Return true if y is positive and finite.