1 #ifndef STAN_MATH_PRIM_MAT_PROB_MULTI_GP_LOG_HPP
2 #define STAN_MATH_PRIM_MAT_PROB_MULTI_GP_LOG_HPP
42 template <
bool propto,
43 typename T_y,
typename T_covar,
typename T_w>
44 typename boost::math::tools::promote_args<T_y, T_covar, T_w>::type
45 multi_gp_log(
const Eigen::Matrix<T_y, Eigen::Dynamic, Eigen::Dynamic>& y,
47 <T_covar, Eigen::Dynamic, Eigen::Dynamic>& Sigma,
48 const Eigen::Matrix<T_w, Eigen::Dynamic, 1>& w) {
49 static const char*
function(
"stan::math::multi_gp_log");
50 typedef typename boost::math::tools::promote_args<T_y, T_covar, T_w>::type
76 "Size of random variable (rows y)", y.rows(),
77 "Size of kernel scales (w)", w.size());
79 "Size of random variable", y.cols(),
80 "rows of covariance parameter", Sigma.rows());
96 lp += (0.5 * y.cols()) *
sum(
log(w));
100 Eigen::Matrix<T_w, Eigen::Dynamic, Eigen::Dynamic>
101 w_mat(w.asDiagonal());
102 Eigen::Matrix<T_y, Eigen::Dynamic, Eigen::Dynamic> yT(y.transpose());
109 template <
typename T_y,
typename T_covar,
typename T_w>
111 typename boost::math::tools::promote_args<T_y, T_covar, T_w>::type
112 multi_gp_log(
const Eigen::Matrix<T_y, Eigen::Dynamic, Eigen::Dynamic>& y,
113 const Eigen::Matrix<T_covar, Eigen::Dynamic, Eigen::Dynamic>&
115 const Eigen::Matrix<T_w, Eigen::Dynamic, 1>& w) {
116 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.
bool check_not_nan(const char *function, const char *name, const T_y &y)
Return true if y is not NaN.
fvar< T > log(const fvar< T > &x)
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 stan::math::LDLT_factor< T2, R2, C2 > &A, const Eigen::Matrix< T3, R3, C3 > &B)
Template metaprogram to calculate whether a summand needs to be included in a proportional (log) prob...
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(stan::math::LDLT_factor< T, R, C > &A)
bool check_positive_finite(const char *function, const char *name, const T_y &y)
Return true if y is positive and finite.
bool check_ldlt_factor(const char *function, const char *name, stan::math::LDLT_factor< T, R, C > &A)
Return true if the argument is a valid stan::math::LDLT_factor.