1#ifndef STAN_MATH_PRIM_ERR_CHECK_SYMMETRIC_HPP
2#define STAN_MATH_PRIM_ERR_CHECK_SYMMETRIC_HPP
31template <
typename EigMat, require_matrix_t<EigMat>* =
nullptr>
38 Eigen::Index k = y.rows();
42 const auto& y_ref =
to_ref(y);
43 for (Eigen::Index m = 0; m < k; ++m) {
44 for (Eigen::Index n = m + 1; n < k; ++n) {
48 std::ostringstream msg1;
49 msg1 <<
"is not symmetric. " << name <<
"["
52 std::string msg1_str(msg1.str());
53 std::ostringstream msg2;
56 std::string msg2_str(msg2.str());
void check_symmetric(const char *function, const char *name, const matrix_cl< T > &y)
Check if the matrix_cl is symmetric.
void check_square(const char *function, const char *name, const T_y &y)
Check if the specified matrix is square.
T value_of(const fvar< T > &v)
Return the value of the specified variable.
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 ...