1#ifndef STAN_MATH_PRIM_CONSTRAINT_LB_CONSTRAIN_HPP
2#define STAN_MATH_PRIM_CONSTRAINT_LB_CONSTRAIN_HPP
35template <
typename T,
typename L, require_all_stan_scalar_t<T, L>* =
nullptr,
36 require_all_not_st_var<T, L>* =
nullptr>
58template <
typename T,
typename L, require_all_stan_scalar_t<T, L>* =
nullptr,
59 require_all_not_st_var<T, L>* =
nullptr>
79template <
typename T,
typename L, require_eigen_t<T>* =
nullptr,
80 require_stan_scalar_t<L>* =
nullptr,
81 require_all_not_st_var<T, L>* =
nullptr>
83 return eval(x.unaryExpr([lb](
auto&& x) { return lb_constrain(x, lb); }));
97template <
typename T,
typename L, require_eigen_t<T>* =
nullptr,
98 require_stan_scalar_t<L>* =
nullptr,
99 require_all_not_st_var<T, L>* =
nullptr>
102 x.unaryExpr([lb, &lp](
auto&& xx) { return lb_constrain(xx, lb, lp); }));
115template <
typename T,
typename L, require_all_eigen_t<T, L>* =
nullptr,
116 require_all_not_st_var<T, L>* =
nullptr>
119 return eval(x.binaryExpr(
120 lb, [](
auto&& x,
auto&& lb) { return lb_constrain(x, lb); }));
134template <
typename T,
typename L, require_all_eigen_t<T, L>* =
nullptr,
135 require_all_not_st_var<T, L>* =
nullptr>
136inline auto lb_constrain(
const T& x,
const L& lb, return_type_t<T, L>& lp) {
138 return eval(x.binaryExpr(
139 lb, [&lp](
auto&& xx,
auto&& lbb) { return lb_constrain(xx, lbb, lp); }));
152template <
typename T,
typename L, require_not_std_vector_t<L>* =
nullptr>
155 for (
size_t i = 0; i < x.size(); ++i) {
172template <
typename T,
typename L, require_not_std_vector_t<L>* =
nullptr>
176 for (
size_t i = 0; i < x.size(); ++i) {
192template <
typename T,
typename L>
193inline auto lb_constrain(
const std::vector<T>& x,
const std::vector<L>& lb) {
196 for (
size_t i = 0; i < x.size(); ++i) {
213template <
typename T,
typename L>
214inline auto lb_constrain(
const std::vector<T>& x,
const std::vector<L>& lb,
218 for (
size_t i = 0; i < x.size(); ++i) {
242template <
bool Jacobian,
typename T,
typename L>
addition_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > add(T_a &&a, T_b &&b)
typename return_type< Ts... >::type return_type_t
Convenience type for the return type of the specified template parameters.
double value_of_rec(const fvar< T > &v)
Return the value of the specified variable.
T eval(T &&arg)
Inputs which have a plain_type equal to the own time are forwarded unmodified (for Eigen expressions ...
static constexpr double NEGATIVE_INFTY
Negative infinity.
void check_matching_dims(const char *function, const char *name1, const T1 &y1, const char *name2, const T2 &y2)
Check if the two containers have the same dimensions.
auto lb_constrain(T &&x, L &&lb)
Return the lower-bounded value for the specified unconstrained input and specified lower bound.
auto identity_constrain(T &&x, Types &&...)
Returns the result of applying the identity constraint transform to the input.
fvar< T > exp(const fvar< T > &x)
typename plain_type< T >::type plain_type_t
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...