Stan  1.3
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Pages
validate_vector.hpp
Go to the documentation of this file.
1 #ifndef __STAN__MATH__MATRIX__VALIDATE_VECTOR_HPP__
2 #define __STAN__MATH__MATRIX__VALIDATE_VECTOR_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  inline void validate_vector(const Eigen::Matrix<T,R,C>& x,
13  const char* msg) {
14  if (x.rows() == 1 || x.cols() == 1) return;
15  std::stringstream ss;
16  ss << "error in " << msg
17  << "; require vector, found "
18  << " rows=" << x.rows() << "cols=" << x.cols();
19  throw std::domain_error(ss.str());
20  }
21 
22  }
23 }
24 #endif

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