Prev Next Index-> contents reference index search external Up-> CppAD Headings-> Algorithmic Differentiation Features ---..Operator Overloading ---..Base Type ---..Recording Operations ---..Multi-Threading ---..Optimizing Operations Sequences ---..Dynamic Parameters ---..Derivative Calculations ---..Sparsity ---..Recording Derivative Operations ---..Atomic Functions ---..Logical Comparisons ---..Vectors Software Engineering Testing ---..Correctness ---..Speed Utilities Release Notes Example

cppad-20190618: A C++ Algorithmic Differentiation Package
 releases , 20190200.3 , github , travis , appveyor , cppad.spec
 
 install , get_started , whats_new , addon , research , project manager
 CppAD is distributed by COIN-OR with the Eclipse Public License EPL-2.0 or the GNU General Public License GPL-2.0 or later.

Algorithmic Differentiation
We refer to the automatic creation of an algorithm that computes derivative values from an algorithm that computes function values as Algorithmic Differentiation, also referred to as Automatic Differentiation or just AD. A brief introduction to AD can be found in wikipedia . The web site autodiff.org is dedicated to research about, and promoting the use of, AD.

Features

CppAD uses operator overloading of the C++ template class AD to compute derivatives of algorithms defined using AD objects; see the introduction for a description of how this is accomplished.

Base Type
The operator overloading uses a templated base type that can be user defined; see base_require . The required definitions for AD<float> and AD<double> are included as part of CppAD.

Recording Operations
A sequence of AD<Base> operations can be recorded and stored in an AD function object object. This object can then be used to evaluate function values and arbitrary order derivatives, and sparsity patterns of derivative values using the Base type.

Optimizing Operations Sequences
During the recording of a function, the Independent variables are know and a forward dependency analysis is used to determine which operations should be recorded. Once the Dependent variables are determined, a reverse dependency analysis can be preformed. This optimize routine uses a reverse dependency analysis, and other techniques, to remove unnecessary operations.

Dynamic Parameters
CppAD enables one to specify a vector of dynamic parameters. The value of the function and derivatives can depend on these parameters, but no derivatives are taken with respect to these parameters. This enables CppAD to reduce the derivative calculations; e.g., the derivative of variable times a variable has two terms while a variable times a parameter only has one.

Derivative Calculations
Arbitrary order forward and reverse mode derivative calculations can be preformed using an ADFun object. Easy to user drivers that compute the entire Jacobian and a specific Hessian are included.

Sparsity
Both forward and reverse mode can be used to calculation the sparsity pattern for Jacobians and Hessians; see sparsity_pattern . Where a Jacobian or Hessian is sparse, both forward and reverse mode can be combined with the sparsity pattern to speed up the calculation of sparse derivatives . In addition, a subgraph method, that does not require a sparsity pattern, can be used to speed up these derivative calculations.

Recording Derivative Operations
A ADFun object can be converted into an object that evaluates derivatives using the type AD<Base> ; see base2ad . This enables one to record new functions that are expressed using derivatives of other functions.

Atomic Functions
User defined derivative calculations for arbitrary functions can also be included in a recording using atomic functions functions. A special checkpoint class is included which allows one to record a function and reuse it as an atomic operation in other functions. There also is a special interface for user defined unary discrete functions functions; i.e., functions that depend on the independent variables but which have identically zero derivatives (e.g., a step function).

Logical Comparisons
Logical comparisons can be included in an operation sequence using AD conditional expressions .

Vectors
The CppAD API allows one to use any SimpleVector class. The preprocessor symbol CPPAD_TESTVECTOR is template vector class which is used for correctness testing. Many of the correctness tests use this template vector class which you can choose during the cmake configuration command.

Software Engineering
CppAD is developed using the software engineering procedures described on the project manager's software web page.

Testing

Correctness
There is an extensive set of correctness tests; see cmake_check .

Speed