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>
59template <
typename T,
typename L,
typename Lp,
82template <
typename T,
typename L, require_eigen_t<T>* =
nullptr,
83 require_stan_scalar_t<L>* =
nullptr,
84 require_all_not_st_var<T, L>* =
nullptr>
86 return eval(x.unaryExpr([lb](
auto&& x) { return lb_constrain(x, lb); }));
101template <
typename T,
typename L,
typename Lp, require_eigen_t<T>* =
nullptr,
102 require_stan_scalar_t<L>* =
nullptr,
103 require_all_not_st_var<T, L>* =
nullptr,
104 require_convertible_t<return_type_t<T, L>, Lp>* =
nullptr>
108 x.unaryExpr([lb, &lp](
auto&& xx) { return lb_constrain(xx, lb, lp); }));
121template <
typename T,
typename L, require_all_eigen_t<T, L>* =
nullptr,
122 require_all_not_st_var<T, L>* =
nullptr>
125 return eval(x.binaryExpr(
126 lb, [](
auto&& x,
auto&& lb) { return lb_constrain(x, lb); }));
141template <
typename T,
typename L,
typename Lp,
142 require_all_eigen_t<T, L>* =
nullptr,
143 require_all_not_st_var<T, L>* =
nullptr,
144 require_convertible_t<return_type_t<T, L>, Lp>* =
nullptr>
145inline auto lb_constrain(
const T& x,
const L& lb, Lp& lp) {
147 return eval(x.binaryExpr(
148 lb, [&lp](
auto&& xx,
auto&& lbb) { return lb_constrain(xx, lbb, lp); }));
161template <
typename T,
typename L, require_not_std_vector_t<L>* =
nullptr>
164 for (
size_t i = 0; i < x.size(); ++i) {
182template <
typename T,
typename L,
typename Lp,
185inline auto lb_constrain(
const std::vector<T>& x,
const L& lb, Lp& lp) {
187 for (
size_t i = 0; i < x.size(); ++i) {
203template <
typename T,
typename L>
204inline auto lb_constrain(
const std::vector<T>& x,
const std::vector<L>& lb) {
207 for (
size_t i = 0; i < x.size(); ++i) {
225template <
typename T,
typename L,
typename Lp,
227inline auto lb_constrain(
const std::vector<T>& x,
const std::vector<L>& lb,
231 for (
size_t i = 0; i < x.size(); ++i) {
256template <
bool Jacobian,
typename T,
typename L,
typename Lp,
259 if constexpr (Jacobian) {
require_t< std::is_convertible< std::decay_t< T >, std::decay_t< S > > > require_convertible_t
Require types T and S satisfies std::is_convertible.
addition_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > add(T_a &&a, T_b &&b)
require_all_t< is_stan_scalar< std::decay_t< Types > >... > require_all_stan_scalar_t
Require all of the types satisfy is_stan_scalar.
require_not_t< is_std_vector< std::decay_t< T > > > require_not_std_vector_t
Require type does not satisfy is_std_vector.
require_all_not_t< is_var< scalar_type_t< std::decay_t< Types > > >... > require_all_not_st_var
Require none of the scalar types satisfy is_var.
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 ...