Stan Math Library
4.9.0
Automatic Differentiation
|
|
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} \]
T | A floating point type or an Eigen type with floating point scalar. |
a | Variable input. |