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

◆ corr_constrain() [1/3]

template<typename T >
plain_type_t< T > stan::math::corr_constrain ( const T &  x)
inline

Return the result of transforming the specified scalar or container of values to have a valid correlation value between -1 and 1 (inclusive).

The transform used is the hyperbolic tangent function,

\(f(x) = \tanh x = \frac{\exp(2x) - 1}{\exp(2x) + 1}\).

Template Parameters
Ttype of value or container
Parameters
[in]xvalue or container
Returns
tanh transform

Definition at line 27 of file corr_constrain.hpp.