Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ lub_constrain() [18/22]

template<bool Jacobian, typename T , typename L , typename U >
auto stan::math::lub_constrain ( const T &  x,
const L &  lb,
const U &  ub,
return_type_t< T, L, U > &  lp 
)
inline

Return the lower and upper-bounded scalar derived by transforming the specified free scalar given the specified lower and upper bounds.

If the Jacobian parameter is true, the log density accumulator is incremented with the log absolute Jacobian determinant of the transform. All of the transforms are specified with their Jacobians in the Stan Reference Manual chapter Constraint Transforms.

Template Parameters
Jacobianif true, increment log density accumulator with log absolute Jacobian determinant of constraining transform
TA type inheriting from Eigen::EigenBase, a var_value with inner type inheriting from Eigen::EigenBase, a standard vector, or a scalar
LA type inheriting from Eigen::EigenBase, a var_value with inner type inheriting from Eigen::EigenBase, a standard vector, or a scalar
UA type inheriting from Eigen::EigenBase, a var_value with inner type inheriting from Eigen::EigenBase, a standard vector, or a scalar
Parameters
[in]xFree scalar to transform
[in]lbLower bound
[in]ubUpper bound
[in,out]lplog density accumulator
Returns
Lower- and upper-bounded scalar derived from transforming the free scalar
Exceptions
std::domain_errorif ub <= lb

Definition at line 395 of file lub_constrain.hpp.