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

◆ abs() [6/7]

template<typename T >
auto stan::math::abs ( const var_value< T > &  a)
inline

Return the absolute value of the variable (std).

Delegates to fabs() (see for doc).

\[ \mbox{abs}(x) = \begin{cases} |x| & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{abs}(x)}{\partial x} = \begin{cases} -1 & \mbox{if } x < 0 \\ 0 & \mbox{if } x = 0 \\ 1 & \mbox{if } x > 0 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Template Parameters
TA floating point type or an Eigen type with floating point scalar.
Parameters
aVariable input.
Returns
Absolute value of variable.

Definition at line 41 of file abs.hpp.