Skip to content

Commit 11663a2

Browse files
authored
Merge pull request #3049 from stan-dev/fix/odd-matching-dims-error-wording
Fix wording of error on dimension mismatch
2 parents b9d0a33 + 942ca76 commit 11663a2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

stan/math/prim/err/check_matching_dims.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,11 @@ inline void check_matching_dims(const char* function, const char* name1,
8585
[&]() STAN_COLD_PATH {
8686
std::ostringstream y1_err;
8787
std::ostringstream msg_str;
88-
y1_err << "(" << y1.rows() << ", " << y1.cols() << ")";
89-
msg_str << y2.rows() << ", " << y2.cols() << ") must match in size";
90-
invalid_argument(function, name1, y1_err.str(), "(",
88+
y1_err << "(" << y1.rows() << ", " << y1.cols() << ") and ";
89+
msg_str << " (" << y2.rows() << ", " << y2.cols()
90+
<< ") must match in size";
91+
invalid_argument(function, name1, name2,
92+
std::string(y1_err.str()).c_str(),
9193
std::string(msg_str.str()).c_str());
9294
}();
9395
}

0 commit comments

Comments
 (0)