Automatic Differentiation
 
Loading...
Searching...
No Matches
check_column_index.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_ERR_CHECK_COLUMN_INDEX_HPP
2#define STAN_MATH_PRIM_ERR_CHECK_COLUMN_INDEX_HPP
3
7#include <sstream>
8#include <string>
9
10namespace stan {
11namespace math {
12
27template <typename T_y,
28 require_any_t<is_matrix<T_y>,
29 is_prim_or_rev_kernel_expression<T_y>>* = nullptr>
30inline void check_column_index(const char* function, const char* name,
31 const T_y& y, size_t i) {
33 && i < static_cast<size_t>(y.cols()) + stan::error_index::value)) {
34 [&]() STAN_COLD_PATH {
35 std::stringstream msg;
36 msg << " for columns of " << name;
37 std::string msg_str(msg.str());
38 out_of_range(function, y.cols(), i, msg_str.c_str());
39 }();
40 }
41}
42
43} // namespace math
44} // namespace stan
45#endif
#define STAN_COLD_PATH
void check_column_index(const char *function, const char *name, const T_y &y, size_t i)
Check if the specified index is a valid column of the matrix.
void out_of_range(const char *function, int max, int index, const char *msg1="", const char *msg2="")
Throw an out_of_range exception with a consistently formatted message.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...