Automatic Differentiation
 
Loading...
Searching...
No Matches
check_row_index.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_ERR_CHECK_ROW_INDEX_HPP
2#define STAN_MATH_PRIM_ERR_CHECK_ROW_INDEX_HPP
3
7#include <sstream>
8#include <string>
9
10namespace stan {
11namespace math {
12
24template <typename T_y, typename = require_matrix_t<T_y>>
25inline void check_row_index(const char* function, const char* name,
26 const T_y& y, size_t i) {
29 && i < static_cast<size_t>(y.rows()) + stan::error_index::value)) {
30 [&]() STAN_COLD_PATH {
31 std::stringstream msg;
32 msg << " for rows of " << name;
33 std::string msg_str(msg.str());
34 out_of_range(function, y.rows(), i, msg_str.c_str());
35 }();
36 }
37}
38
39} // namespace math
40} // namespace stan
41#endif
#define STAN_COLD_PATH
#define STAN_NO_RANGE_CHECKS_RETURN
Turns all range and size checks into no-ops.
void check_row_index(const char *function, const char *name, const T_y &y, size_t i)
Check if the specified index is a valid row of the matrix This check is 1-indexed by default.
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 ...