![]() |
Prev | Next | link_ode |
extern bool link_ode(
size_t size ,
size_t repeat ,
bool retape ,
CppAD::vector<double> &x ,
CppAD::vector<double> &gradient
);
f : \R^n \rightarrow \R
that is define and computed by
evaluating ode_evaluate
.
package
,
the corresponding return value for link_ode
should be false
.
size
is the number of variables in the ordinary differential equation;
i.e.,
n = size
.
repeat
is the number of different functions
f(x)
that the gradient is computed for.
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.
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
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
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 ]
\]
package
is double
,
only the first element of
gradient
is modified and it is set to the function value.