lines 20-106 of file: speed/src/link_ode.cpp

{xrst_begin link_ode}
{xrst_spell
   fp
}

Speed Testing the Jacobian of Ode Solution
##########################################

Prototype
*********
{xrst_literal
   // BEGIN PROTOTYPE
   // END PROTOTYPE
}

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

Method
******
The same template routine :ref:`ode_evaluate-name` is used
by th different AD packages.

f
*
The function
:math:`f : \B{R}^n \rightarrow \B{R}^n` that is defined and computed by
evaluating :ref:`ode_evaluate-name` 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.

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 equations
which is also equal to :math:`n`.

repeat
******
The argument *repeat* is the number of times the
Jacobian is computed.

x
*
The argument *x* is a vector with :math:`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.

jacobian
********
The argument *jacobian* is a vector with :math:`n^2` elements.
The input value of its elements does not matter.
The output value of its elements is the Jacobian of the function :math:`f(x)`
that corresponds to output value of *x* .
To be more specific, for
:math:`i = 0 , \ldots , n-1` and :math:`j = 0 , \ldots , n-1`,

.. math::

   \D{f[i]}{x[j]} (x) = jacobian [ i \cdot n + j ]

double
======
In the case where *package* is ``double`` ,
only the first :math:`n` element of *jacobian*
are modified and they are to the function value
:math:`f(x)` corresponding to the output value of *x* .

{xrst_end link_ode}
