Prev | Next |
y = abs(x)
y = fabs(x)
x
is an AD type,
this is an atomic operation
.
abs
and
fabs
are not defined for the base types
std::complex<float>
or std::complex<double>
because the complex abs
function is not complex differentiable
(see complex types faq
).
abs
function is
the sign
function; i.e.,
@[@
{\rm abs}^{(1)} ( x ) = {\rm sign} (x ) =
\left\{ \begin{array}{rl}
+1 & {\rm if} \; x > 0 \\
0 & {\rm if} \; x = 0 \\
-1 & {\rm if} \; x < 0
\end{array} \right.
@]@
The result for
x == 0
used to be a directional derivative.