1 #ifndef STAN_MATH_PRIM_MAT_ERR_CHECK_SIMPLEX_HPP 2 #define STAN_MATH_PRIM_MAT_ERR_CHECK_SIMPLEX_HPP 38 template <
typename T_prob>
40 const Eigen::Matrix<T_prob, Eigen::Dynamic, 1>&
theta) {
48 std::stringstream
msg;
49 T_prob
sum = theta.sum();
50 msg <<
"is not a valid simplex.";
52 msg <<
" sum(" << name <<
") = " << sum <<
", but should be ";
56 for (
size_t n = 0;
n < theta.size();
n++) {
57 if (!(theta[
n] >= 0)) {
58 std::ostringstream
msg;
59 msg <<
"is not a valid simplex. " << name <<
"[" 64 ", but should be greater than or equal to 0");
fvar< T > sum(const std::vector< fvar< T > > &m)
void check_simplex(const char *function, const char *name, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &theta)
void check_nonzero_size(const char *function, const char *name, const T_y &y)
fvar< T > fabs(const fvar< T > &x)
const double CONSTRAINT_TOLERANCE
void domain_error(const char *function, const char *name, const T &y, const char *msg1, const char *msg2)