TMB Documentation
v1.9.11
|
Augmented AD type. More...
#include <global.hpp>
Public Member Functions | |
ad_aug () | |
Default CTOR. More... | |
ad_aug (Scalar x) | |
CTOR from scalar. More... | |
ad_aug (ad_plain x) | |
CTOR from ad_plain More... | |
void | addToTape () const |
Force this variable to be put on the tape. More... | |
bool | bothConstant (const ad_aug &other) const |
If true 'this' and 'other' are both constants. If false nothing can be concluded (they might be constants on the tape) | |
bool | constant () const |
Is this object guarantied to be a constant? More... | |
ad_aug | copy () const |
Deep copy existing ad_aug. Result will be last value of the current tape. | |
ad_aug | copy0 () const |
Deep copy existing ad_aug wihout derivatives. | |
void | Dependent () |
Set this ad_aug as dependent. | |
global * | glob () const |
Get the tape of this ad_aug. More... | |
bool | identical (const ad_aug &other) const |
If true 'this' and 'other' are identical. If false nothing can be concluded (they might be equal, but different, expressions on the tape) | |
bool | identicalOne () const |
If true this variable is identical one. If false nothing can be concluded. | |
bool | identicalZero () const |
If true this variable is identical zero. If false nothing can be concluded. | |
bool | in_context_stack (global *glob) const |
Check if 'glob' exists in the active context stack. | |
void | Independent () |
Set this ad_aug as independent. | |
bool | on_active_tape () const |
Is this object on the current active tape? | |
bool | on_some_tape () const |
Is this object on some (not necessarily active) tape? | |
bool | ontape () const |
Alias for on_some_tape() (for backward compatibility only) | |
ad_aug | operator* (const ad_aug &other) const |
Multiplication. More... | |
ad_aug & | operator*= (const ad_aug &other) |
Compound assignment taking advantage of operator* reductions. | |
ad_aug | operator+ (const ad_aug &other) const |
Addition. More... | |
ad_aug & | operator+= (const ad_aug &other) |
Compound assignment taking advantage of operator+ reductions. | |
ad_aug | operator- (const ad_aug &other) const |
Subtraction. More... | |
ad_aug | operator- () const |
Negation. | |
ad_aug & | operator-= (const ad_aug &other) |
Compound assignment taking advantage of operator- reductions. | |
ad_aug | operator/ (const ad_aug &other) const |
Division. More... | |
ad_aug & | operator/= (const ad_aug &other) |
Compound assignment taking advantage of operator/ reductions. | |
void | override_by (const ad_plain &x) const |
Override this ad_plain and set glob to get_glob() More... | |
Scalar | Value () const |
Return the underlying scalar value of this ad_aug . | |
Public Attributes | |
ad_plain | taped_value |
If taped_value is initialized (see ad_plain::initialize ) this is the value of ad_aug . | |
TMBAD_UNION_OR_STRUCT | |
If taped_value is not initialized then this is the value of ad_aug . Otherwise, value is un-defined, and glob is the tape on which this ad_aug resides. | |
Augmented AD type.
ad_aug
is an 'augmented' AD type which, in contrast to ad_plain
, knows on which tape it belongs. This facilitates some extra features:
Nested AD: An ad_aug
may refer to other variables on different tapes as long as they can be found in the 'active context stack' (defined here: TMBad::global
).
In addition, ad_aug
can keep tapes small by only adding operations when strictly necessary. For instance, it detects whether a variable is constant or identical zero to see if a reduction is possible to avoid adding the variable to the tape.
The downside of ad_aug
is that is takes up slightly more memory than ad_plain
.
Definition at line 2831 of file global.hpp.
TMBad::global::ad_aug::ad_aug | ( | ) |
Default CTOR.
Leaves taped_value
in uninitialized state to signify that this variable is constant.
Definition at line 2195 of file TMBad.cpp.
Referenced by Independent().
TMBad::global::ad_aug::ad_aug | ( | Scalar | x | ) |
TMBad::global::ad_aug::ad_aug | ( | ad_plain | x | ) |
void TMBad::global::ad_aug::addToTape | ( | ) | const |
Force this variable to be put on the tape.
If variable already is on the tape nothing happens. In particular the variable cannot be assumed to be the most recently added.
Definition at line 2201 of file TMBad.cpp.
Referenced by copy(), copy0(), and Dependent().
bool TMBad::global::ad_aug::constant | ( | ) | const |
Is this object guarantied to be a constant?
false
the object may or may not be constant. Definition at line 2180 of file TMBad.cpp.
Referenced by bothConstant(), identical(), identicalOne(), identicalZero(), Independent(), operator*(), and operator-().
global* TMBad::global::ad_aug::glob | ( | ) | const |
Get the tape of this ad_aug.
NULL
is returned. Referenced by TMBad::accumulation_tree_split(), constant(), and identical().
Multiplication.
Included reductions:
Definition at line 2290 of file TMBad.cpp.
Referenced by Independent().
Addition.
Included reductions:
Definition at line 2270 of file TMBad.cpp.
Referenced by Independent().
Division.
Included reductions:
Definition at line 2301 of file TMBad.cpp.
Referenced by Independent().
void TMBad::global::ad_aug::override_by | ( | const ad_plain & | x | ) | const |
Override this ad_plain and set glob to get_glob()