Stan  1.3
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Pages
validate_multiplicable.hpp
Go to the documentation of this file.
1 #ifndef __STAN__MATH__MATRIX__VALIDATE_MULTIPLICABLE_HPP__
2 #define __STAN__MATH__MATRIX__VALIDATE_MULTIPLICABLE_HPP__
3 
4 #include <sstream>
5 #include <stdexcept>
7 
8 namespace stan {
9  namespace math {
10 
11  template <typename T1, int R1, int C1, typename T2, int R2, int C2>
12  inline void validate_multiplicable(const Eigen::Matrix<T1,R1,C1>& x1,
13  const Eigen::Matrix<T2,R2,C2>& x2,
14  const char* msg) {
15  if (x1.cols() == x2.rows()) return;
16  std::stringstream ss;
17  ss << "error in call to " << msg
18  << "; require cols of arg1 to match rows of arg2, but found "
19  << " arg1 rows=" << x1.rows() << " arg1 cols=" << x1.cols()
20  << " arg2 rows=" << x2.rows() << " arg2 cols=" << x2.cols();
21  throw std::domain_error(ss.str());
22  }
23 
24  }
25 }
26 #endif

     [ Stan Home Page ] © 2011–2013, Stan Development Team.