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

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