\(\newcommand{\W}[1]{ \; #1 \; }\) \(\newcommand{\R}[1]{ {\rm #1} }\) \(\newcommand{\B}[1]{ {\bf #1} }\) \(\newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} }\) \(\newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} }\) \(\newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} }\) \(\newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }\)
reverse_one¶
View page sourceFirst Order Reverse Mode¶
Syntax¶
Reverse
(1, w )Purpose¶
We use \(F : \B{R}^n \rightarrow \B{R}^m\) to denote the AD Function corresponding to f . The function \(W : \B{R}^n \rightarrow \B{R}\) is defined by
The result of this operation is the derivative \(dw = W^{(1)} (x)\); i.e.,
Note that if \(w\) is the i-th Elementary Vector , \(dw = F_i^{(1)} (x)\).
f¶
The object f has prototype
const ADFun
< Base > f
Before this call to Reverse
, the value returned by
f .
size_order
()
must be greater than or equal one (see size_order ).
x¶
The vector x in expression for dw above corresponds to the previous call to forward_zero using this ADFun object f ; i.e.,
f .
Forward
(0, x )
If there is no previous call with the first argument zero, the value of the Independent variables during the recording of the AD sequence of operations is used for x .
w¶
The argument w has prototype
const
Vector & w
(see Vector below) and its size must be equal to m , the dimension of the Range space for f .
dw¶
The result dw has prototype
Vector dw
(see Vector below) and its value is the derivative \(W^{(1)} (x)\). The size of dw is equal to n , the dimension of the Domain space for f .
Vector¶
The type Vector must be a SimpleVector class with elements of type Base . The routine CheckSimpleVector will generate an error message if this is not the case.
Example¶
The file reverse_one.cpp contains an example and test of this operation.