lines 6-71 of file: example/atomic_four/forward.cpp {xrst_begin atomic_four_forward.cpp} Atomic Functions and Forward Mode: Example and Test ################################################### Purpose ******* This example demonstrates forward mode derivative calculation using an :ref:`atomic_four-name` function. Function ******** For this example, the atomic function :math:`g : \B{R}^3 \rightarrow \B{R}^2` is defined by .. math:: g(x) = \left( \begin{array}{c} x_2 * x_2 \\ x_0 * x_1 \end{array} \right) Jacobian ******** The corresponding Jacobian is .. math:: g^{(1)} (x) = \left( \begin{array}{ccc} 0 & 0 & 2 x_2 \\ x_1 & x_0 & 0 \end{array} \right) Hessian ******* The Hessians of the component functions are .. math:: g_0^{(2)} ( x ) = \left( \begin{array}{ccc} 0 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 2 \end{array} \right) \W{,} g_1^{(2)} ( x ) = \left( \begin{array}{ccc} 0 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 0 \end{array} \right) Define Atomic Function ********************** {xrst_literal // BEGIN_DEFINE_ATOMIC_FUNCTION // END_DEFINE_ATOMIC_FUNCTION } Use Atomic Function ******************* {xrst_literal // BEGIN_USE_ATOMIC_FUNCTION // END_USE_ATOMIC_FUNCTION } {xrst_end atomic_four_forward.cpp}