Stan  1.3
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Pages
validate_column_index.hpp
Go to the documentation of this file.
1 #ifndef __STAN__MATH__MATRIX__VALIDATE_COLUMN_INDEX_HPP__
2 #define __STAN__MATH__MATRIX__VALIDATE_COLUMN_INDEX_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_column_index(const Eigen::Matrix<T,R,C>& m,
13  size_t j,
14  const char* msg) {
15  if (j > 0 && j <= static_cast<size_t>(m.cols())) return;
16  std::stringstream ss;
17  ss << "require 0 < column index <= number of columns in" << msg;
18  ss << " found cols()=" << m.cols()
19  << "; index j=" << j;
20  throw std::domain_error(ss.str());
21  }
22 
23  }
24 }
25 #endif

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