lines 9-69 of file: include/cppad/core/unary_minus.hpp

{xrst_begin unary_minus}

AD Unary Minus Operator
#######################

Syntax
******

*y* = ``-`` *x*

Purpose
*******
Computes the negative of *x* .

Base
****
The operation in the syntax above must be supported for the case where
the operand is a ``const`` *Base* object.

x
*
The operand *x* has one of the following prototypes

| |tab| ``const AD`` < *Base* >               & *x*
| |tab| ``const VecAD`` < *Base* >:: ``reference &`` *x*

y
*
The result *y* has type

   ``AD`` < *Base* > *y*

It is equal to the negative of the operand *x* .

Operation Sequence
******************
This is an AD of *Base*
:ref:`atomic operation<glossary@Operation@Atomic>`
and hence is part of the current
AD of *Base*
:ref:`operation sequence<glossary@Operation@Sequence>` .

Derivative
**********
If :math:`f` is a
:ref:`glossary@Base Function` ,

.. math::

   \D{[ - f(x) ]}{x} = - \D{f(x)}{x}

Example
*******
{xrst_toc_hidden
   example/general/unary_minus.cpp
}
The file
:ref:`unary_minus.cpp-name`
contains an example and test of this operation.

{xrst_end unary_minus}
