Prev | Next | link_ode |

@(@\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}} }@)@

`extern bool link_ode(`

size_t *size* ,

size_t *repeat* ,

CppAD::vector<double> &*x* ,

CppAD::vector<double> &*jacobian*

);

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.

The same template routine ode_evaluate is used by th different AD packages.

The function @(@ f : \B{R}^n \rightarrow \B{R}^n @)@ that is defined and computed by evaluating ode_evaluate with a call of the form

ode_evaluate(*x*, *p*, *fp*)

with
*p*

equal to zero.
Calls with the value
*p*

equal to one are used to check
the derivative values.
If this speed test is not yet supported by a particular

*package*

,
the corresponding return value for `link_ode`

should be `false`

.
The argument

*size*

is the number of variables in the ordinary differential equations
which is also equal to @(@
n
@)@.
The argument

*repeat*

is the number of times the
Jacobian is computed.
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.
The argument

*jacobian*

is a vector with @(@
n^2
@)@ elements.
The input value of its elements does not matter.
The output value of its elements is the Jacobian of the function @(@
f(x)
@)@
that corresponds to output value of
*x*

.
To be more specific, for
@(@
i = 0 , \ldots , n-1
@)@ and @(@
j = 0 , \ldots , n-1
@)@,
@[@
\D{f[i]}{x[j]} (x) = jacobian [ i \cdot n + j ]
@]@
In the case where

*package*

is `double`

,
only the first @(@
n
@)@ element of
*jacobian*

are modified and they are to the function value
@(@
f(x)
@)@ corresponding to the output value of
*x*

.
Input File: speed/src/link_ode.cpp