Multiple Directions Forward Mode
Keywords: multiple directions forward mode syntax purpose notation n m f q r xq zero order non-zero lower orders x(t) y(t) yq vector example

| Prev | Next |  |  |  |  |  |  |

Multiple Directions Forward Mode
Syntax
`yq = f.Forward(q, r, xq)
`
Purpose
We use F : B n → B m to denote the AD function corresponding to `f` . Given a function X : B → B n , defined by its Taylor coefficients , forward mode computes the Taylor coefficients for the function Y ( t ) = F [ X ( t ) ]
Notation
n
We use `n` to denote the dimension of the domain space for `f` .
m
We use `m` to denote the dimension of the range space for `f` .
f
The ADFun object `f` has prototype `
ADFun<Base> f
` Note that the ADFun object `f` is not `const`. After this call we will have `
f.size_order() == q + 1
f.size_direction() == r
`
q
This argument has prototype `
size_t q
` It specifies the order of Taylor Coefficient that we are calculating and must be greater than zero. The zero order coefficients can only have one direction computed and stored in `f` so use forward_zero to compute the zero order coefficients.
r
This argument has prototype `
size_t r
` It specifies the number of directions that are computed together. If ( `r == 1` ), you are only using one direction and forward_order is simpler, and should be faster, than this more general case.
xq
The argument `xq` has prototype `
const Vector& xq
` and its size must be `n*r` (see Vector below). For ℓ = 0 , … , r -1 , j = 0 , … , n -1 , the `j`-th component of the `q`-th order Taylor coefficient for X ℓ ( t ) is defined by `
` x j ( q ) , ℓ = `xq[ r * j + ell ]`
Zero Order
For j = 0 , … , n -1 , the `j`-th component of the zero order Taylor coefficient for X ℓ ( t ) is defined by `
` x j ( 0 ) = `xk[ j ]` where `xk` corresponds to the previous call `
f.Forward(k, xk)
` with `k = 0` .
Non-Zero Lower Orders
For ℓ = 0 , … , r -1 , j = 0 , … , n -1 , k = 1 , … , q -1 , the `j`-th component of the `k`-th order Taylor coefficient for X ℓ ( t ) is defined by `
` x j ( k ) , ℓ = `xk[ r * j + ell ]` where `xk` corresponds to the previous call `
f.Forward(k, r, xk)
` Note that `r` must have the same value in this previous call.
X(t)
For ℓ = 0 , … , r -1 , the function X ℓ : B → B n is defined using the Taylor coefficients x ( k ) , ℓ ∈ B n : X ℓ ( t ) = x ( 0 ) + x ( 1 ) , ℓ * t 1 + ⋯ + x ( q ) , ℓ t q Note that the `k`-th derivative of X ℓ ( t ) is related to its Taylor coefficients by x ( 0 ) = X ℓ ( 0 ) x ( k ) , ℓ = 1 k ! X ℓ ( k ) ( 0 ) for k = 1 , … , q .
Y(t)
For ℓ = 0 , … , r -1 , the function Y ℓ : B → B m is defined by Y ℓ ( t ) = F [ X ℓ ( t ) ] . We use y ( 0 ) for the zero order coefficient and y ( k ) , ℓ ∈ B m to denote the hight order coefficients; i.e., Y ℓ ( t ) = y ( 0 ) + y ( 1 ) , ℓ * t 1 + ⋯ + y ( q ) , ℓ * t q + o ( t q ) where o ( t q ) * t - q → 0 as t → 0 . Note that the `k`-th derivative of Y ℓ ( t ) is related to its Taylor coefficients by y ( 0 ) = Y ℓ ( 0 ) y ( k ) , ℓ = 1 k ! Y ℓ ( k ) ( 0 ) for k = 1 , … , q .
yq
The argument `yq` has prototype `
Vector yq
` and its size is `m*r` (see Vector below). For ℓ = 0 , … , r -1 , i = 0 , … , m -1 , the `i`-th component of the `q`-th order Taylor coefficient for Y ℓ ( t ) is given by `
` y i ( q ) , ℓ = `yq[ r * i + ell ]`
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 forward_dir.cpp contains an example and test using one order (multiple orders). They return true if they succeed and false otherwise.

Input File: omh/forward/forward_dir.omh