1 #ifndef STAN__MATH__ERROR_HANDLING__MATRIX__CHECK_CORR_MATRIX_HPP
2 #define STAN__MATH__ERROR_HANDLING__MATRIX__CHECK_CORR_MATRIX_HPP
37 template <
typename T_y,
typename T_result>
39 const Eigen::Matrix<T_y,Eigen::Dynamic,Eigen::Dynamic>& y,
47 y.rows(),
"Rows of correlation matrix",
48 y.cols(),
"columns of correlation matrix",
55 for (
size_t k = 0; k < y.rows(); ++k) {
57 std::ostringstream message;
58 message <<
" is not a valid correlation matrix. "
61 <<
") is %1%, but should be near 1.0";
62 std::string msg(message.str());
63 return dom_err(
function,y(k,k),name,msg.c_str(),
"",result);
fvar< T > fabs(const fvar< T > &x)
bool dom_err(const char *function, const T &y, const char *name, const char *error_msg, const T_msg error_msg2, T_result *result)
bool check_size_match(const char *function, T_size1 i, const char *name_i, T_size2 j, const char *name_j, T_result *result)
const double CONSTRAINT_TOLERANCE
The tolerance for checking arithmetic bounds In rank and in simplexes.
bool check_symmetric(const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result)
Return true if the specified matrix is symmetric.
Primary template class for the metaprogram to compute the index type of a container.
bool check_pos_definite(const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result)
Return true if the specified matrix is positive definite.
bool check_positive(const char *function, const T_y &y, const char *name, T_result *result)
bool check_corr_matrix(const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result)
Return true if the specified matrix is a valid correlation matrix.