\(\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}} }\)
atomic_four_ctor¶
View page sourceAtomic Function Constructor¶
Syntax¶
class
atomic_user : public CppAD::atomic_four<
Base > {public:
CppAD::atomic_four<
Base >( name )Prototype¶
template <class Base>
atomic_four<Base>::atomic_four(const std::string& name )
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> object that has this atomic_user operation in its operation sequence .
Implementation¶
The user defined atomic_user class is a publicly derived class of
atomic_four
< Base > .
It should be declared as follows:
class
atomic_user : public CppAD::atomic_four<
Base > {public:
atomic_four
< Base >( name )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_four
implementations replaced by
atomic_user implementations.
atomic_four¶
Restrictions¶
The atomic_four
constructor and destructor cannot be called in
parallel mode.
Base¶
The template parameter determines the
Base
type for this AD
< Base > atomic operation.
name¶
This atomic_four
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.
Example¶
The following is an example constructor definition taken from atomic_four_norm_sq.cpp :
class atomic_norm_sq : public CppAD::atomic_four<double> {
public:
atomic_norm_sq(const std::string& name) :
CppAD::atomic_four<double>(name)
{ }