Multiple Order Forward Mode
Keywords: multiple order forward mode any syntax purpose function values derivative notation n m f one q xq orders restrictions s x(t) y(t) yq vector zero first second example

| Prev | Next |  |  |  |  |  |  |

Multiple Order Forward Mode
Syntax
`yq = f.Forward(q, xq )
` `yq = f.Forward(q, xq, s)
`
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 ) ]
Function Values
If you are using forward mode to compute values for F ( x ) , forward_zero is simpler to understand than this explanation of the general case.
Derivative Values
If you are using forward mode to compute values for F ( 1 ) ( x ) * dx , forward_one is simpler to understand than this explanation of the general case.
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() == 1
`
One Order
If `xq.size() == n` , then we are only computing one order. In this case, before this call we must have `
f.size_order() >= q
f.size_direction() == 1
`
q
The argument `q` has prototype `
size_t q
` and specifies the highest order of the Taylor coefficients to be calculated.
xq
The argument `xq` has prototype `
const Vector& xq
` (see Vector below). As above, we use `n` to denote the dimension of the domain space for `f` . The size of `xq` must be either `n` or `n*(q+1)` . After this call we will have `
f.size_order() == q + 1
`
One Order
If `xq.size() == n` , the `q`-th order Taylor coefficient for X ( t ) is defined by `
` x ( q ) = `xq` . For k = 0 , … , q -1 , the Taylor coefficient x ( k ) is defined by `xk` in the previous call to `
f.Forward(k, xk)
`
Multiple Orders
If `xq.size() == n*(q+1)` , For k = 0 , … , q , j = 0 , … , n -1 , the `j`-th component of the `k`-th order Taylor coefficient for X ( t ) is defined by `
` x j ( k ) = `xq[ (q+1) * j + k ]`
Restrictions
Note if `f` uses old_atomic functions, the size of `xq` must be `n` .
s
If the argument `s` is not present, `std::cout` is used in its place. Otherwise, this argument has prototype `
std::ostream& s
` If order zero is begin calculated, `s` specifies where the output corresponding to PrintFor will be written. If order zero is not being calculated, `s` is not used
X(t)
The function X : B → B n is defined using the Taylor coefficients x ( k ) ∈ B n : X ( t ) = x ( 0 ) * t 0 + x ( 1 ) * t 1 + ⋯ + x ( q ) * t q Note that for k = 0 , … , q , the `k`-th derivative of X ( t ) is related to the Taylor coefficients by the equation x ( k ) = 1 k ! X ( k ) ( 0 )
Y(t)
The function Y : B → B m is defined by Y ( t ) = F [ X ( t ) ] . We use y ( k ) ∈ B m to denote the `k`-th order Taylor coefficient of Y ( t ) ; i.e., Y ( t ) = y ( 0 ) * t 0 + y ( 1 ) * t 1 + ⋯ + y ( q ) * t q + o ( t q ) where o ( t q ) * t - q → 0 as t → 0 . Note that y ( k ) is related to the `k`-th derivative of Y ( t ) by the equation y ( k ) = 1 k ! Y ( k ) ( 0 )
yq
The return value `yq` has prototype `
Vector yq
` (see Vector below).
One Order
If `xq.size() == n` , the vector `yq` has size `m` . The `q`-th order Taylor coefficient for Y ( t ) is returned as `
yq` = y ( q ) .
Multiple Orders
If `xq.size() == n*(q+1)` , the vector `yq` has size `m*(q+1)` . For k = 0 , … , q , for i = 0 , … , m -1 , the `i`-th component of the `k`-th order Taylor coefficient for Y ( t ) is returned as `
yq[ (q+1) * i + k ]` = y i ( k )
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.
Zero Order
The case where q = 0 and `xq.size() == n` , corresponds to the zero order special case .
First Order
The case where q = 1 and `xq.size() == n` , corresponds to the first order special case .
Second Order
The case where q = 2 and `xq.size() == n` , corresponds to the second order special case .
Example
The file forward.cpp ( forward_order.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_order.omh