chkpoint_two

View page source

Checkpoint Functions: Second Generation

Syntax

Constructor

chkpoint_two < Base > chk_fun ( fun , name ,
      internal_bool , use_hes_sparsity , use_base2ad , use_in_parallel
)

Use Checkpoint Function

chk_fun ( ax , ay )

new_dynamic

chk_fun . new_dynamic ( dynamic )

Reduce Memory

You can reduce the size of the tape and memory required for AD using a checkpoint representation of a function \(g : \B{R}^n \rightarrow \B{R}^m\).

Faster Recording

It may also reduce the time to make a recording if the same \(g(x)\) is used many times (with different values) during the recording of an ADFun < Base > object.

Repeating Forward

Normally, CppAD stores Forward mode results, until they freed using capacity_order , or the corresponding ADFun object is deleted. This is not true for chkpoint_two functions because the same checkpoint function may be used repeatedly with different arguments during a single forward mode operation. Thus, forward mode results are computed for each use of chk_fun in a forward mode sweep.

Operation Sequence

The operation sequence representing \(g(x)\) is fixed; i.e., it cannot depend on the value of \(x\).

atomic_three

The chkpoint_two class is derived from atomic_three , hence some of its error message will refer to atomic operations. The chkpoint_two class implements all the Virtual Functions and hence its source code,

include/cppad/core/chkpoint_two/chkpoint_two.hpp

provides an example for atomic_three operations. The difference is that chkpoint_two.hpp uses AD instead of user provided derivatives.

Base

The type Base specifies the base type for AD operations; i.e., chk_fun can be used during the recording of AD < Base > operations.

Contents