Loading [MathJax]/extensions/TeX/AMSsymbols.js
Automatic Differentiation
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches

◆ lub_constrain() [19/24]

template<bool Jacobian, typename T , typename L , typename U , typename Lp , require_convertible_t< return_type_t< T, L, U >, Lp > * = nullptr>
auto stan::math::lub_constrain ( const T &  x,
const L &  lb,
const U &  ub,
Lp &  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
LpScalar, convertable from the scalar types of T, L, and U
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 401 of file lub_constrain.hpp.