Prev Next

@(@\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}} }@)@ This is cppad-20221105 documentation. Here is a link to its current documentation .
Defining Atomic Functions: Second Generation

Deprecated 2019-01-01
Using the atomic_base class has been deprecated. Use atomic_three instead.

Syntax

atomic_user afun(ctor_arg_list)
afun(axay)
ok = afun.forward(pqvxvytxty)
ok = afun.reverse(qtxtypxpy)
ok = afun.for_sparse_jac(qrsx)
ok = afun.rev_sparse_jac(qrsx)
ok = afun.for_sparse_hes(vxrshx)
ok = afun.rev_sparse_hes(vxstqruvx)
atomic_base<
Base>::clear()


See Also
checkpoint

Purpose

Speed
In some cases, the user knows how to compute derivatives of a function @[@ y = f(x) \; {\rm where} \; f : \B{R}^n \rightarrow \B{R}^m @]@ more efficiently than by coding it using AD<Base> atomic_base operations and letting CppAD do the rest. In this case atomic_base<Base> can use the user code for @(@ f(x) @)@, and its derivatives, as AD<Base> atomic operations.

Reduce Memory
If the function @(@ f(x) @)@ is used often, using an atomic version of @(@ f(x) @)@ remove the need for repeated copies of the corresponding AD<Base> operations.

Virtual Functions
User defined derivatives are implemented by defining the following virtual functions in the atomic_base class: forward , reverse , for_sparse_jac , rev_sparse_jac , and rev_sparse_hes . These virtual functions have a default implementation that returns ok == false . The forward function, for the case q == 0 , must be implemented. Otherwise, only those functions required by the your calculations need to be implemented. For example, forward for the case q == 2 can just return ok == false unless you require forward mode calculation of second derivatives.

Examples
See atomic_two_example .

Contents
atomic_two_ctorAtomic Function Constructor
atomic_two_optionSet Atomic Function Options
atomic_two_afunUsing AD Version of Atomic Function
atomic_two_forwardAtomic Forward Mode
atomic_two_reverseAtomic Reverse Mode
atomic_two_for_sparse_jacAtomic Forward Jacobian Sparsity Patterns
atomic_two_rev_sparse_jacAtomic Reverse Jacobian Sparsity Patterns
atomic_two_for_sparse_hesAtomic Forward Hessian Sparsity Patterns
atomic_two_rev_sparse_hesAtomic Reverse Hessian Sparsity Patterns
atomic_two_clearFree Static Variables

Input File: include/cppad/core/atomic/two/atomic.hpp