1 #ifndef STAN_MATH_PRIM_SCAL_ERR_CHECK_CONSISTENT_SIZE_MVT_HPP 2 #define STAN_MATH_PRIM_SCAL_ERR_CHECK_CONSISTENT_SIZE_MVT_HPP 26 const T& x,
size_t expected_size) {
31 if (expected_size == 0)
36 typename std::remove_reference<decltype(x[0])>::type>::value;
38 if (!x_contains_vectors)
40 else if (expected_size == size_x)
44 std::stringstream msg;
45 msg <<
", expecting dimension = " << expected_size
46 <<
"; a function was called with arguments of different " 47 <<
"scalar, array, vector, or matrix types, and they were not " 48 <<
"consistently sized; all arguments must be scalars or " 49 <<
"multidimensional values of the same shape.";
50 std::string msg_str(msg.str());
52 invalid_argument(
function, name, size_x,
"has dimension = ", msg_str.c_str());
size_t length(const std::vector< T > &x)
Returns the length of the provided std::vector.
void check_consistent_size_mvt(const char *function, const char *name, const T &x, size_t expected_size)
Check if the dimension of x is consistent, which is defined to be expected_size if x is a vector of v...
void invalid_argument(const char *function, const char *name, const T &y, const char *msg1, const char *msg2)
Throw an invalid_argument exception with a consistently formatted message.
size_t length_mvt(const Eigen::Matrix< T, R, C > &)