| Stan Math Library 2.6.3 probability, sampling & optimization

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
check_column_index.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_MAT_ERR_CHECK_COLUMN_INDEX_HPP
2 #define STAN_MATH_PRIM_MAT_ERR_CHECK_COLUMN_INDEX_HPP
3
4 #include <stan/math/prim/scal/err/out_of_range.hpp>
5 #include <stan/math/prim/mat/fun/Eigen.hpp>
6 #include <stan/math/prim/scal/meta/error_index.hpp>
7 #include <sstream>
8 #include <string>
9
10 namespace stan {
11 namespace math {
12
36 template <typename T_y, int R, int C>
37 inline bool check_column_index(const char* function,
38 const char* name,
39 const Eigen::Matrix<T_y, R, C>& y,
40 const size_t i) {
41 if (i >= stan::error_index::value
42 && i < static_cast<size_t>(y.cols()) + stan::error_index::value)
43 return true;
44
45 std::stringstream msg;
46 msg << " for columns of " << name;
47 std::string msg_str(msg.str());
48 out_of_range(function,
49 y.cols(),
50 i,
51 msg_str.c_str());
52 return false;
53 }
54
55 }
56 }
57 #endif
out_of_range.hpp
stan::error_index::value
Definition: error_index.hpp:7
stan::math::out_of_range
void out_of_range(const char *function, const int max, const int index, const char *msg1="", const char *msg2="")
Throw an out_of_range exception with a consistently formatted message.
Definition: out_of_range.hpp:30
Eigen.hpp
stan::math::check_column_index
bool check_column_index(const char *function, const char *name, const Eigen::Matrix< T_y, R, C > &y, const size_t i)
Return true if the specified index is a valid column of the matrix.
Definition: check_column_index.hpp:37
error_index.hpp

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