1#ifndef STAN_MATH_PRIM_PROB_MULTI_GP_LPDF_HPP
2#define STAN_MATH_PRIM_PROB_MULTI_GP_LPDF_HPP
33template <
bool propto,
typename T_y,
typename T_covar,
typename T_w,
34 require_all_matrix_t<T_y, T_covar>* =
nullptr,
35 require_col_vector_t<T_w>* =
nullptr>
40 static constexpr const char* function =
"multi_gp_lpdf";
42 "Size of kernel scales (w)", w.size());
44 "rows of covariance parameter", Sigma.rows());
47 const auto& Sigma_ref =
to_ref(Sigma);
48 const auto& w_ref =
to_ref(w);
49 const auto& y_t_ref =
to_ref(y.transpose());
74 lp += (0.5 * y.cols()) *
sum(
log(w_ref));
84template <
typename T_y,
typename T_covar,
typename T_w>
88 return multi_gp_lpdf<false>(y, Sigma, w);
void check_symmetric(const char *function, const char *name, const matrix_cl< T > &y)
Check if the matrix_cl is symmetric.
return_type_t< T_y, T_covar, T_w > multi_gp_lpdf(const T_y &y, const T_covar &Sigma, const T_w &w)
The log of a multivariate Gaussian Process for the given y, Sigma, and w.
typename return_type< Ts... >::type return_type_t
Convenience type for the return type of the specified template parameters.
value_type_t< T > log_determinant_ldlt(LDLT_factor< T > &A)
Returns log(abs(det(A))) given a LDLT_factor of A.
auto make_ldlt_factor(const T &A)
Make an LDLT_factor with matrix type plain_type_t<T>
fvar< T > log(const fvar< T > &x)
const double NEG_LOG_SQRT_TWO_PI
The value of minus the natural logarithm of the square root of , .
ref_type_t< T && > to_ref(T &&a)
This evaluates expensive Eigen expressions.
return_type_t< EigMat1, T2, EigMat3 > trace_gen_inv_quad_form_ldlt(const EigMat1 &D, LDLT_factor< T2 > &A, const EigMat3 &B)
Compute the trace of an inverse quadratic form.
void check_finite(const char *function, const char *name, const T_y &y)
Return true if all values in y are finite.
void check_ldlt_factor(const char *function, const char *name, LDLT_factor< T > &A)
Raise domain error if the specified LDLT factor is invalid.
auto sum(const std::vector< T > &m)
Return the sum of the entries of the specified standard vector.
void check_positive(const char *function, const char *name, const T_y &y)
Check if y is positive.
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.
void check_positive_finite(const char *function, const char *name, const T_y &y)
Check if y is positive and finite.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Template metaprogram to calculate whether a summand needs to be included in a proportional (log) prob...