1#ifndef STAN_MATH_PRIM_ERR_CHECK_CORR_MATRIX_HPP
2#define STAN_MATH_PRIM_ERR_CHECK_CORR_MATRIX_HPP
33template <
typename Mat, require_matrix_t<Mat>* =
nullptr>
39 if (y_ref.size() == 0) {
43 for (Eigen::Index k = 0; k < y.rows(); ++k) {
46 std::ostringstream msg;
47 msg <<
"is not a valid correlation matrix. " << name <<
"("
50 std::string msg_str(msg.str());
52 ", but should be near 1.0");
75template <
typename StdVec, require_std_vector_t<StdVec>* =
nullptr>
78 for (
auto&& y_i : y) {
double value_of_rec(const fvar< T > &v)
Return the value of the specified variable.
void check_square(const char *function, const char *name, const T_y &y)
Check if the specified matrix is square.
void check_corr_matrix(const char *function, const char *name, const Mat &y)
Throw an exception if the specified matrix is not a valid correlation matrix.
void check_pos_definite(const char *function, const char *name, const EigMat &y)
Check if the specified square, symmetric matrix is positive definite.
void throw_domain_error(const char *function, const char *name, const T &y, const char *msg1, const char *msg2)
Throw a domain error with a consistently formatted message.
ref_type_t< T && > to_ref(T &&a)
This evaluates expensive Eigen expressions.
const double CONSTRAINT_TOLERANCE
The tolerance for checking arithmetic bounds in rank and in simplexes.
fvar< T > fabs(const fvar< T > &x)
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...