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

◆ ub_constrain() [5/14]

template<typename T , typename U , require_all_stan_scalar_t< T, U > * = nullptr, require_all_not_st_var< T, U > * = nullptr>
auto stan::math::ub_constrain ( const T &  x,
const U &  ub 
)
inline

Return the upper-bounded value for the specified unconstrained matrix and upper bound.

Specialization of ub_constrain to apply a matrix of upper bounds elementwise to each input element.

The transform is

\(f(x) = U - \exp(x)\)

where \(U\) is the upper bound.

Template Parameters
Ttype of Matrix
Utype of upper bound
Parameters
[in]xfree Matrix.
[in]ubupper bound
Returns
matrix constrained to have upper bound
Template Parameters
TA type inheriting from EigenBase.
UA type inheriting from EigenBase.
Parameters
[in]xunconstrained input
[in]ubupper bound on output
Returns
upper-bound constrained value corresponding to inputs

The transform is

\(f(x) = U - \exp(x)\)

where \(U\) is the upper bound.

Template Parameters
TScalar
UScalar
Parameters
[in]xfree Matrix.
[in]ubupper bound
Returns
matrix constrained to have upper bound
Template Parameters
TA type inheriting from EigenBase or a var_value with inner type inheriting from EigenBase.
UA type inheriting from EigenBase or a var_value with inner type inheriting from EigenBase.
Parameters
[in]xunconstrained input
[in]ubupper bound on output
Returns
upper-bound constrained value corresponding to inputs

Definition at line 36 of file ub_constrain.hpp.