1 #ifndef __STAN__MATH__MATRIX__VALIDATE_MATCHING_SIZES_HPP__
2 #define __STAN__MATH__MATRIX__VALIDATE_MATCHING_SIZES_HPP__
12 template <
typename T1,
typename T2>
14 const std::vector<T2>& x2,
16 if (x1.size() == x2.size())
return;
18 ss <<
"error in call to " << msg
19 <<
"; require matching sizes, but found"
20 <<
" arg1(size=" << x1.size() <<
");"
21 <<
" arg2(size=" << x2.size() <<
");";
22 throw std::domain_error(ss.str());
25 template <
typename T1,
int R1,
int C1,
typename T2,
int R2,
int C2>
27 const Eigen::Matrix<T2,R2,C2>& x2,
29 if (x1.size() == x2.size())
return;
31 ss <<
"error in call to " << msg
32 <<
"; require matching sizes, but found"
33 <<
" arg1(rows=" << x1.rows() <<
",cols=" << x1.cols()
34 <<
",size=" << (x1.rows() * x1.cols()) <<
");"
35 <<
" arg2(rows=" << x2.rows() <<
",cols=" << x2.cols()
36 <<
",size=" << (x2.rows() * x2.cols()) <<
")";
37 throw std::domain_error(ss.str());
40 template <
typename Derived,
typename T2,
int R2,
int C2>
42 const Eigen::Matrix<T2,R2,C2>& x2,
44 if (x1.size() == x2.size())
return;
46 ss <<
"error in call to " << msg
47 <<
"; require matching sizes, but found"
48 <<
" arg1(rows=" << x1.rows() <<
",cols=" << x1.cols()
49 <<
",size=" << (x1.rows() * x1.cols()) <<
");"
50 <<
" arg2(rows=" << x2.rows() <<
",cols=" << x2.cols()
51 <<
",size=" << (x2.rows() * x2.cols()) <<
")";
52 throw std::domain_error(ss.str());
55 template <
typename T1,
int R1,
int C1,
typename Derived>
57 const Eigen::Block<Derived>& x2,
59 if (x1.size() == x2.size())
return;
61 ss <<
"error in call to " << msg
62 <<
"; require matching sizes, but found"
63 <<
" arg1(rows=" << x1.rows() <<
",cols=" << x1.cols()
64 <<
",size=" << (x1.rows() * x1.cols()) <<
");"
65 <<
" arg2(rows=" << x2.rows() <<
",cols=" << x2.cols()
66 <<
",size=" << (x2.rows() * x2.cols()) <<
")";
67 throw std::domain_error(ss.str());
70 template <
typename Derived1,
typename Derived2>
72 const Eigen::Block<Derived2>& x2,
74 if (x1.size() == x2.size())
return;
76 ss <<
"error in call to " << msg
77 <<
"; require matching sizes, but found"
78 <<
" arg1(rows=" << x1.rows() <<
",cols=" << x1.cols()
79 <<
",size=" << (x1.rows() * x1.cols()) <<
");"
80 <<
" arg2(rows=" << x2.rows() <<
",cols=" << x2.cols()
81 <<
",size=" << (x2.rows() * x2.cols()) <<
")";
82 throw std::domain_error(ss.str());