Automatic Differentiation
 
Loading...
Searching...
No Matches
throw_domain_error_mat.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_ERR_THROW_DOMAIN_ERROR_MAT_HPP
2#define STAN_MATH_PRIM_ERR_THROW_DOMAIN_ERROR_MAT_HPP
3
7#include <sstream>
8#include <string>
9
10namespace stan {
11namespace math {
12
31template <typename T, require_eigen_t<T>* = nullptr>
32inline void throw_domain_error_mat(const char* function, const char* name,
33 const T& y, size_t i, size_t j,
34 const char* msg1, const char* msg2) {
35 std::ostringstream vec_name_stream;
37 vec_name_stream << name << "[" << stan::error_index::value + i << "]";
38 } else if (is_row_vector<T>::value) {
39 vec_name_stream << name << "[" << stan::error_index::value + j << "]";
40 } else {
41 vec_name_stream << name << "[" << stan::error_index::value + i << ", "
42 << stan::error_index::value + j << "]";
43 }
44 std::string vec_name(vec_name_stream.str());
45 throw_domain_error(function, vec_name.c_str(), y.coeff(i, j), msg1, msg2);
46}
47
65template <typename T>
66inline void throw_domain_error_mat(const char* function, const char* name,
67 const T& y, size_t i, size_t j,
68 const char* msg) {
69 throw_domain_error_vec(function, name, y, i, j, msg, "");
70}
71
72} // namespace math
73} // namespace stan
74#endif
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.
void throw_domain_error_mat(const char *function, const char *name, const T &y, size_t i, size_t j, const char *msg1, const char *msg2)
Throw a domain error with a consistently formatted message for matrices.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Definition fvar.hpp:9
If the input type T has a static comple time constant type ColsAtCompileTime equal to 1 this has a st...
If the input type T has a static comple time constant type RowsAtCompileTime equal to 1 this has a st...