chkpoint_two_ctor

View page source

Checkpoint Function Constructor

Syntax

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

Prototype

template <class Base>
chkpoint_two<Base>::chkpoint_two(
      const ADFun<Base>& fun    ,
      const std::string& name   ,
      bool  internal_bool       ,
      bool  use_hes_sparsity    ,
      bool  use_base2ad         ,
      bool  use_in_parallel     )

Parallel

This constructor, and its corresponding destructor, must not be called in parallel mode. The object chk_fun should not be destructed for as long as there is an ADFun < Base > object the has chk_fun in its recording.

Base

The type Base specifies the base type for AD operations.

fun

This specifies the function \(g(x)\). Note that fun may or may not have been optimized before calling the constructor. This will determine if the internal representation for g ( x ) is optimized.

name

is the name used for reporting errors using this checkpoint function.

internal_bool

If true, sparsity calculations are done with sets represented by vectors of boolean values. Otherwise, vectors of sets are used for sparsity patterns.

use_hes_sparsity

If true, Hessian sparsity patterns can be calculated for ADFun < Base > objects that have uses of chk_fun in their recording. This requires some extra memory and extra computation during the constructor.

use_base2ad

If this is true, chk_fun can be used during the recording of ADFun < Base > objects that get converted to ADFun< AD< Base > > objects using base2ad . This requires some extra memory and extra computation during the constructor.

use_in_parallel

If this is true, chk_fun can be used in_parallel . This requires some extra memory for a constant copy of the fun information and a separate copy (that changes) for each thread.

chk_fun

This is a checkpoint function representation of \(g(x)\) that can be used during the recording of AD < Base > operations.