Automatic Differentiation
 
Loading...
Searching...
No Matches
throw_domain_error_vec.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_ERR_THROW_DOMAIN_ERROR_VEC_HPP
2#define STAN_MATH_PRIM_ERR_THROW_DOMAIN_ERROR_VEC_HPP
3
7#include <sstream>
8#include <string>
9
10namespace stan {
11namespace math {
12
30template <typename T>
31inline void throw_domain_error_vec(const char* function, const char* name,
32 const T& y, size_t i, const char* msg1,
33 const char* msg2) {
34 std::ostringstream vec_name_stream;
35 vec_name_stream << name << "[" << stan::error_index::value + i << "]";
36 std::string vec_name(vec_name_stream.str());
37 throw_domain_error(function, vec_name.c_str(), stan::get(y, i), msg1, msg2);
38}
39
56template <typename T>
57inline void throw_domain_error_vec(const char* function, const char* name,
58 const T& y, size_t i, const char* msg) {
59 throw_domain_error_vec(function, name, y, i, msg, "");
60}
61
62} // namespace math
63} // namespace stan
64#endif
T get(const T &x, size_t n)
Returns the provided element.
Definition get.hpp:23
void throw_domain_error(const char *function, const char *name, const T &y, const char *msg1, const char *msg2)
Throw a domain error with a consistently formatted message.
void throw_domain_error_vec(const char *function, const char *name, const T &y, size_t i, const char *msg1, const char *msg2)
Throw a domain error with a consistently formatted message.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Definition fvar.hpp:9