unary_minus

View page source

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

      const AD < Base > & x
      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 atomic operation and hence is part of the current AD of Base operation sequence .

Derivative

If \(f\) is a Base Function ,

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

Example

The file unary_minus.cpp contains an example and test of this operation.