lines 8-75 of file: include/cppad/example/atomic_four/lin_ode/hes_sparsity.hpp

{xrst_begin atomic_four_lin_ode_hes_sparsity.hpp}
{xrst_spell
   wk
}

Atomic Linear ODE Hessian Sparsity Pattern: Example Implementation
##################################################################

Purpose
*******
The ``hes_sparsity`` routine overrides the virtual functions
used by the atomic_four base class for Hessian sparsity calculations; see
:ref:`hes_sparsity<atomic_four_hes_sparsity-name>` .

Notation
********
We use the notation:
:ref:`atomic_four_lin_ode@call_id`
:ref:`atomic_four_lin_ode@r`
:ref:`atomic_four_lin_ode@pattern`
:ref:`atomic_four_lin_ode@transpose`
:ref:`atomic_four_lin_ode@pattern@nnz` ,
:ref:`atomic_four_lin_ode@pattern@row` ,
:ref:`atomic_four_lin_ode@pattern@col` ,
:ref:`atomic_four_lin_ode@x` ,
:ref:`atomic_four_lin_ode@x@n` ,
:ref:`atomic_four_lin_ode@x@A(x)` ,
:ref:`atomic_four_lin_ode@x@b(x)` ,
:ref:`atomic_four_lin_ode@y(x)` ,
:ref:`atomic_four_lin_ode@y(x)@m` ,
:ref:`atomic_four_lin_ode@vk(x)` ,
and the following additional notation:

wk(x)
=====
Because we are using the :ref:`Rosen34-name` solver, our actual sequence
of operations is only fourth order accurate.
So it suffices to compute the sparsity pattern for

.. math::

   \tilde{y} (x) = \sum_{k=0}^4 v^k (x)

Note that the factor :math:`r / k`,
in the definition of :math:`v^k (x)`,
is constant (with respect to the variables).
Hence it suffices to compute the sparsity pattern for

.. math::

   h (x) = \sum_{k=0}^4 w^k (x)

where :math:`w^0 (x) = b(x)` and for :math:`k = 1, 2, \ldots`,
:math:`w^k (x) = A(x) w^{k-1} (x)`.

Example
*******
The file :ref:`atomic_four_lin_ode_sparsity.cpp-name`
contains an example and test using this operator.

Source
******
{xrst_literal
   // BEGIN C++
   // END C++
}

{xrst_end atomic_four_lin_ode_hes_sparsity.hpp}
