Prev Next Index-> contents reference index search external Up-> CppAD AD ADValued atomic atomic_base atomic_ctor ADValued-> Arithmetic unary_standard_math binary_math CondExp Discrete numeric_limits atomic atomic-> checkpoint atomic_base atomic_base-> atomic_ctor atomic_option atomic_afun atomic_forward atomic_reverse atomic_for_sparse_jac atomic_rev_sparse_jac atomic_for_sparse_hes atomic_rev_sparse_hes atomic_base_clear atomic_get_started.cpp atomic_norm_sq.cpp atomic_reciprocal.cpp atomic_set_sparsity.cpp atomic_tangent.cpp atomic_eigen_mat_mul.cpp atomic_eigen_mat_inv.cpp atomic_eigen_cholesky.cpp atomic_mat_mul.cpp atomic_ctor Headings-> Syntax atomic_user ---..ctor_arg_list ---..afun ---..Implementation atomic_base ---..Restrictions ---..Base ---..name ---..sparsity Example ---..Define Constructor ---..Use Constructor

Atomic Function Constructor

Syntax
atomic_user afun(ctor_arg_list)  atomic_base<Base>(name, sparsity) 
atomic_user

ctor_arg_list
Is a list of arguments for the atomic_user constructor.

afun
The object afun must stay in scope for as long as the corresponding atomic function is used. This includes use by any ADFun<Base> that has this atomic_user operation in its operation sequence .

Implementation
The user defined atomic_user class is a publicly derived class of atomic_base<Base> . It should be declared as follows:       class atomic_user : public CppAD::atomic_base<Base> {      public:           atomic_user(ctor_arg_list) : atomic_base<Base>(name, sparsity)      ...      };  where ... denotes the rest of the implementation of the derived class. This includes completing the constructor and all the virtual functions that have their atomic_base implementations replaced by atomic_user implementations.

atomic_base

Restrictions
The atomic_base constructor cannot be called in parallel mode.

Base
The template parameter determines the Base type for this AD<Base> atomic operation.

name
This atomic_base constructor argument has the following prototype       const std::string& name  It is the name for this atomic function and is used for error reporting. The suggested value for name is afun or atomic_user , i.e., the name of the corresponding atomic object or class.

sparsity
This atomic_base constructor argument has prototype       atomic_base<Base>::option_enum sparsity  The current sparsity for an atomic_base object determines which type of sparsity patterns it uses and its value is one of the following:
 sparsity sparsity patterns atomic_base::pack_sparsity_enum    vectorBool atomic_base::bool_sparsity_enum    vector  atomic_base::set_sparsity_enum    vector  >
There is a default value for sparsity if it is not included in the constructor (which may be either the bool or set option).

Example

Define Constructor
The following is an example of a user atomic function constructor definitions: get_started.cpp .

Use Constructor
The following is an example using a user atomic function constructor: get_started.cpp .