Prev Next link_ode

Speed Testing Gradient of Ode Solution

Prototype
extern bool link_ode(
     size_t                 
size      ,
     size_t                 
repeat    ,
     bool                   
retape    ,
     CppAD::vector<double> &
x         ,
     CppAD::vector<double> &
gradient
);

Purpose
Each package must define a version of this routine as specified below. This is used by the speed_main program to run the corresponding speed and correctness tests.

f
The function  f : \R^n \rightarrow \R  that is define and computed by evaluating ode_evaluate .

Return Value
If this speed test is not yet supported by a particular package , the corresponding return value for link_ode should be false.

size
The argument size is the number of variables in the ordinary differential equation; i.e.,  n = size .

repeat
The argument repeat is the number of different functions  f(x) that the gradient is computed for.

retape

true
If retape is true, the operation sequence is considered to change for each repetition. Thus an AD package can not use one recording of the operation sequence to compute the gradient for all of the repetitions.

false
If retape is false, the operation sequence is known to be the same for each repetition. Thus an AD package may use one recording of the operation sequence to compute the gradient for all of the repetitions.

x
The argument x is a vector with  n elements. The input value of the elements of x does not matter. On output, it has been set to the argument value for which the function, or its derivative, is being evaluated. The value of this vector must change with each repetition.

gradient
The argument gradient is a vector with  n elements. The input value of its elements does not matter. The output value of its elements is the gradient of the function  f(x) that corresponds to output values of i , j and x . To be more specific, for  j = 0 , \ldots , n-1 ,  \[
     \D{f}{x[j]} (x) = gradient [ j ]
\] 


double
In the case where package is double, only the first element of gradient is modified and it is set to the function value.
Input File: speed/link_ode.cpp