1#ifndef STAN_MATH_PRIM_ERR_CHECK_GREATER_OR_EQUAL_HPP
2#define STAN_MATH_PRIM_ERR_CHECK_GREATER_OR_EQUAL_HPP
34template <
typename T_y,
typename T_low,
35 require_all_stan_scalar_t<T_y, T_low>* =
nullptr,
typename... Idxs>
37 const T_y& y,
const T_low& low,
40 [](
auto y,
auto low,
auto function,
auto name,
44 (
", but must be greater than or equal to "
47 }(y, low, function, name, idxs...);
75 const T_y& y,
const T_low& low,
78 for (Eigen::Index i = 0; i < low_arr.size(); ++i) {
79 if (
unlikely(!(y >= low_arr.coeff(i)))) {
80 [](
auto y,
auto&& low_arr,
auto name,
auto function,
auto i,
84 (
", but must be greater than or equal to "
85 + std::to_string(low_arr.coeff(i)))
87 }(y, low_arr, name, function, i, idxs...);
110template <
typename T_y,
typename T_low, require_stan_scalar_t<T_y>* =
nullptr,
111 require_dense_dynamic_t<T_low>* =
nullptr,
typename... Idxs>
113 const T_y& y,
const T_low& low,
116 for (Eigen::Index j = 0; j < low_arr.cols(); ++j) {
117 for (Eigen::Index i = 0; i < low_arr.rows(); ++i) {
118 if (
unlikely(!(y >= low_arr.coeff(i, j)))) {
119 [](
auto y,
auto&& low_arr,
auto name,
auto function,
auto i,
auto j,
124 (
", but must be greater than or equal to "
125 + std::to_string(low_arr.coeff(i, j)))
127 }(y, low_arr, name, function, i, j, idxs...);
151template <
typename T_y,
typename T_low, require_vector_t<T_y>* =
nullptr,
152 require_not_std_vector_vt<is_container_or_var_matrix, T_y>* =
nullptr,
153 require_stan_scalar_t<T_low>* =
nullptr,
typename... Idxs>
155 const T_y& y,
const T_low& low,
158 for (Eigen::Index i = 0; i < y_arr.size(); ++i) {
159 if (
unlikely(!(y_arr.coeff(i) >= low))) {
160 [](
auto&& y_arr,
auto low,
auto name,
auto function,
auto i,
auto... idxs)
165 (
", but must be greater than or equal to "
168 }(y_arr, low, name, function, i, idxs...);
191template <
typename T_y,
typename T_low, require_dense_dynamic_t<T_y>* =
nullptr,
192 require_stan_scalar_t<T_low>* =
nullptr,
typename... Idxs>
194 const T_y& y,
const T_low& low,
197 for (Eigen::Index j = 0; j < y_arr.cols(); ++j) {
198 for (Eigen::Index i = 0; i < y_arr.rows(); ++i) {
199 if (
unlikely(!(y_arr.coeff(i, j) >= low))) {
200 [](
auto&& y_arr,
auto low,
auto name,
auto function,
auto i,
auto j,
205 (
", but must be greater than or equal to "
208 }(y_arr, low, name, function, i, j, idxs...);
234template <
typename T_y,
typename T_low,
235 require_all_vector_t<T_y, T_low>* =
nullptr,
240 const T_y& y,
const T_low& low,
244 for (Eigen::Index i = 0; i < low_arr.size(); ++i) {
245 if (
unlikely(!(y_arr.coeff(i) >= low_arr.coeff(i)))) {
246 [](
auto&& y_arr,
auto&& low_arr,
auto name,
auto function,
auto i,
251 (
", but must be greater than or equal to "
252 + std::to_string(low_arr.coeff(i)))
254 }(y_arr, low_arr, name, function, i, idxs...);
279template <
typename T_y,
typename T_low,
280 require_all_dense_dynamic_t<T_y, T_low>* =
nullptr,
typename... Idxs>
282 const T_y& y,
const T_low& low,
286 for (Eigen::Index j = 0; j < low_arr.cols(); ++j) {
287 for (Eigen::Index i = 0; i < low_arr.rows(); ++i) {
288 if (
unlikely(!(y_arr.coeff(i, j) >= low_arr.coeff(i, j)))) {
289 [](
auto&& y_arr,
auto&& low_arr,
auto name,
auto function,
auto i,
294 (
", but must be greater than or equal to "
295 + std::to_string(low_arr.coeff(i, j)))
297 }(y_arr, low_arr, name, function, i, j, idxs...);
320template <
typename T_y,
typename T_low,
321 require_std_vector_vt<is_container_or_var_matrix, T_y>* =
nullptr,
322 require_not_std_vector_t<T_low>* =
nullptr,
typename... Idxs>
324 const T_y& y,
const T_low& low,
326 for (
size_t i = 0; i < y.size(); ++i) {
348template <
typename T_y,
typename T_low,
349 require_not_std_vector_t<T_y>* =
nullptr,
350 require_std_vector_vt<is_container_or_var_matrix, T_low>* =
nullptr,
353 const T_y& y,
const T_low& low,
355 for (
size_t i = 0; i < low.size(); ++i) {
376template <
typename T_y,
typename T_low,
379 require_all_std_vector_t<T_y, T_low>* =
nullptr,
typename... Idxs>
381 const T_y& y,
const T_low& low,
383 for (
size_t i = 0; i < y.size(); ++i) {
require_t< is_stan_scalar< std::decay_t< T > > > require_stan_scalar_t
Require type satisfies is_stan_scalar.
require_any_t< container_type_check_base< is_std_vector, value_type_t, TypeCheck, Check >... > require_any_std_vector_vt
Require any of the types satisfy is_std_vector.
require_not_t< container_type_check_base< is_std_vector, value_type_t, TypeCheck, Check... > > require_not_std_vector_vt
Require type does not satisfy is_std_vector or.
require_all_not_t< container_type_check_base< is_std_vector, value_type_t, TypeCheck, Check >... > require_all_not_std_vector_vt
Require none of the types satisfy is_std_vector.
require_t< is_vector< std::decay_t< T > > > require_vector_t
Require type satisfies is_vector.
auto make_iter_name(const char *name)
double value_of_rec(const fvar< T > &v)
Return the value of the specified variable.
T as_array_or_scalar(T &&v)
Returns specified input value.
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 check_greater_or_equal(const char *function, const char *name, const T_y &y, const T_low &low, Idxs... idxs)
Throw an exception if y is not greater or equal than low.
ref_type_t< T && > to_ref(T &&a)
This evaluates expensive Eigen expressions.
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.
bool_constant< math::disjunction< is_container< Container >, is_var_matrix< Container > >::value > is_container_or_var_matrix
Deduces whether type is eigen matrix, standard vector, or var<Matrix>.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...