|
ADOL-C: Automatic Differentiation in C/C++ 2.7.3
|
Taped active scalar for reusable forward and reverse differentiation. More...
#include <adtb_types.h>
Public Member Functions | |
| ~adouble ()=default | |
| Default destructor. | |
| adouble () | |
| Allocate an active-value location on the current tape. | |
| adouble (double coval) | |
| Allocate a location on the current tape and initialize its value. | |
| adouble (const adouble &a) | |
| Copy constructor. | |
| adouble (adouble &&other) noexcept | |
| Move constructor. | |
| size_t | release_loc () |
| Releases ownership of this adouble's location. | |
| bool | is_valid () const |
| adouble & | operator= (const double coval) |
| Assign a passive value and record the assignment while tracing. | |
| adouble & | operator= (const adouble &a) |
| Copy an active value and record the assignment while tracing. | |
| adouble & | operator= (adouble &&other) noexcept |
| Move assignment. | |
| adouble & | operator= (const pdouble &p) |
Registers the assignment of the pdouble to the adouble. | |
| double | value () const |
| Retrieves the current value stored at the tape location. | |
| size_t | loc () const |
Retrieves the location of the adouble on the tape. | |
| void | value (const double coval) |
| Updates the value stored at the tape location. | |
| operator double () const | |
Converts the adouble to a double by returning its corresponding double value from the tape. | |
| adouble & | operator+= (const double coval) |
| adouble & | operator+= (const adouble &a) |
| adouble & | operator+= (adouble &&a) |
| adouble & | operator+= (const pdouble &p) |
| adouble & | operator-= (const double coval) |
| adouble & | operator-= (const adouble &a) |
| adouble & | operator-= (adouble &&a) |
| adouble & | operator-= (const pdouble &p) |
| adouble & | operator*= (const double coval) |
| adouble & | operator*= (const adouble &a) |
| adouble & | operator*= (const pdouble &p) |
| adouble & | operator/= (const double coval) |
| adouble & | operator/= (const adouble &a) |
| adouble & | operator/= (adouble &&a) |
| adouble & | operator/= (const pdouble &p) |
| adouble | operator++ (int) |
| adouble | operator-- (int) |
| adouble & | operator++ () |
| adouble & | operator-- () |
| adouble & | operator<<= (const double input) |
Registers the assignment of the input value to the adouble and marks the adouble as an independent variable. | |
| adouble & | operator>>= (double &out) |
Stores the value of adouble in the provided reference and marks the adouble as a dependent variable. | |
| void | declareIndependent () |
Declares the adouble as an independent variable on the tape. | |
| void | declareDependent () |
Declares the adouble as a dependent variable on the tape. | |
Static Public Member Functions | |
| static adouble | borrow_location (size_t loc) |
| Constructs an adouble borrowing an existing tape location. | |
Taped active scalar for reusable forward and reverse differentiation.
Each adouble owns or borrows a location in the current ValueTape. Double-like overloads compute the primal result immediately and, while tracing, append the operation and its operand/result locations to the tape. The recorded function can later be evaluated by first- or higher-order forward and reverse sweeps.
|
default |
Default destructor.
| adouble::adouble | ( | ) |
Allocate an active-value location on the current tape.
If ADOLC_ADOUBLE_STDCZERO is defined, initialize its value to zero. Otherwise, assign a value before reading it.
| adouble::adouble | ( | double | coval | ) |
Allocate a location on the current tape and initialize its value.
| coval | Value that is stored on the tape at the new location. |
| adouble::adouble | ( | const adouble & | a | ) |
Copy constructor.
Allocate a location on the current tape and copy the source value. Record the assignment while tracing. The source must belong to this tape.
| a | The adouble to copy. |
|
inlinenoexcept |
Move constructor.
Transfers the location from the input adouble.
| other | The adouble to transfer. |
|
inlinestatic |
Constructs an adouble borrowing an existing tape location.
The resulting adouble does not own the location and therefore does not free it on destruction.
| void adouble::declareDependent | ( | ) |
Declares the adouble as a dependent variable on the tape.
| void adouble::declareIndependent | ( | ) |
Declares the adouble as an independent variable on the tape.
|
inline |
|
inline |
Retrieves the location of the adouble on the tape.
|
inlineexplicit |
Converts the adouble to a double by returning its corresponding double value from the tape.
adouble at the tape location. | adouble & adouble::operator*= | ( | const double | coval | ) |
| adouble & adouble::operator++ | ( | ) |
| adouble adouble::operator++ | ( | int | ) |
| adouble & adouble::operator+= | ( | const double | coval | ) |
| adouble & adouble::operator-- | ( | ) |
| adouble adouble::operator-- | ( | int | ) |
| adouble & adouble::operator-= | ( | const double | coval | ) |
| adouble & adouble::operator<<= | ( | const double | input | ) |
Registers the assignment of the input value to the adouble and marks the adouble as an independent variable.
Use the span overload below to register several contiguous independent variables in one call while preserving their order on the tape.
| input | Value that is assigned to the adouble. |
adouble. Move assignment.
Transfers the location from the input adouble.
| other | The adouble to transfer. |
*this. Copy an active value and record the assignment while tracing.
| a | The adouble to assign. |
*this. | adouble & adouble::operator= | ( | const double | coval | ) |
Assign a passive value and record the assignment while tracing.
| coval | The value to assign. |
*this. Registers the assignment of the pdouble to the adouble.
| p | The pdouble to assign. |
*this. | adouble & adouble::operator>>= | ( | double & | out | ) |
Stores the value of adouble in the provided reference and marks the adouble as a dependent variable.
Use the span overload below to register several contiguous dependent variables in one call while preserving their order on the tape.
| out | Receives the dependent value. |
adouble.
|
inline |
Releases ownership of this adouble's location.
The returned location can be re-wrapped via borrow_location(). The source adouble is invalid after this call.
|
inline |
Retrieves the current value stored at the tape location.
adouble from the tape.Central validity guard: operator implementations call value()/loc(), so we keep validity assertions here instead of duplicating checks per operator.
|
inline |
Updates the value stored at the tape location.
| coval | the new value to assign. |