@@ -19,29 +19,26 @@ namespace math {
1919 * Check if the specified matrix is symmetric.
2020 * The error message is either 0 or 1 indexed, specified by
2121 * <code>stan::error_index::value</code>.
22- * @tparam T_y Type of scalar
22+ * @tparam EigMat Type of matrix
2323 * @param function Function name (for error messages)
2424 * @param name Variable name (for error messages)
2525 * @param y Matrix to test
2626 * @throw <code>std::invalid_argument</code> if the matrix is not square.
2727 * @throw <code>std::domain_error</code> if any element not on the
2828 * main diagonal is <code>NaN</code>
2929 */
30- template <typename T_y>
31- inline void check_symmetric (
32- const char * function, const char * name,
33- const Eigen::Matrix<T_y, Eigen::Dynamic, Eigen::Dynamic>& y) {
30+ template <typename EigMat, require_eigen_t <EigMat>* = nullptr >
31+ inline void check_symmetric (const char * function, const char * name,
32+ const EigMat& y) {
3433 check_square (function, name, y);
3534 using std::fabs;
36- using size_type
37- = index_type_t <Eigen::Matrix<T_y, Eigen::Dynamic, Eigen::Dynamic>>;
3835
39- size_type k = y.rows ();
36+ Eigen::Index k = y.rows ();
4037 if (k <= 1 ) {
4138 return ;
4239 }
43- for (size_type m = 0 ; m < k; ++m) {
44- for (size_type n = m + 1 ; n < k; ++n) {
40+ for (Eigen::Index m = 0 ; m < k; ++m) {
41+ for (Eigen::Index n = m + 1 ; n < k; ++n) {
4542 if (!(fabs (value_of (y (m, n)) - value_of (y (n, m)))
4643 <= CONSTRAINT_TOLERANCE)) {
4744 std::ostringstream msg1;
0 commit comments