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

◆ offset_multiplier_constrain() [6/14]

template<typename T , typename M , typename S , require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T, M, S > * = nullptr>
auto stan::math::offset_multiplier_constrain ( const T &  x,
const M &  mu,
const S &  sigma,
return_type_t< T, M, S > &  lp 
)
inline

Return the linearly transformed value for the specified unconstrained input and specified offset and multiplier, incrementing the specified reference with the log absolute Jacobian determinant of the transform.

Return the linearly transformed value for the specified unconstrained input and specified offset and multiplier.

The transform applied is

\(f(x) = mu + sigma * x\)

where mu is the offset and sigma is the multiplier.

If the offset is zero and multiplier is one, this function reduces to identity_constraint(x, lp).

Template Parameters
Ttype of scalar
Mtype of offset
Stype of multiplier
Parameters
[in]xUnconstrained scalar input
[in]muoffset of constrained output
[in]sigmamultiplier of constrained output
[in,out]lpReference to log probability to increment.
Returns
linear transformed value corresponding to inputs
Exceptions
std::domain_errorif sigma <= 0
std::domain_errorif mu is not finite

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
MA type inheriting from Eigen::EigenBase, a var_value with inner type inheriting from Eigen::EigenBase, a standard vector, or a scalar
SA type inheriting from Eigen::EigenBase, a var_value with inner type inheriting from Eigen::EigenBase, a standard vector, or a scalar
Parameters
[in]xUnconstrained scalar input
[in]muoffset of constrained output
[in]sigmamultiplier of constrained output
[in,out]lplog density accumulator
Returns
linear transformed value corresponding to inputs
Exceptions
std::domain_errorif sigma <= 0
std::domain_errorif mu is not finite

Definition at line 93 of file offset_multiplier_constrain.hpp.