![]() |
Stan
1.3
probability, sampling & optimization
|
Abstract base class for variable implementations that handles memory management and applying the chain rule. More...
#include <chainable.hpp>
Public Member Functions | |
| chainable () | |
| Construct a chainable object. | |
| ~chainable () | |
| Chainables are not destructible and should go on the function call stack or be allocated with operator new. | |
| virtual void | chain () |
| Apply the chain rule to this variable based on the variables on which it depends. | |
| virtual void | init_dependent () |
| Initialize this chainable's adjoint value to make it the dependent variable in a gradient calculation. | |
| virtual void | set_zero_adjoint () |
| Set the value of the adjoint for this chainable to its initial value. | |
Static Public Member Functions | |
| static void * | operator new (size_t nbytes) |
| Allocate memory from the underlying memory pool. | |
Abstract base class for variable implementations that handles memory management and applying the chain rule.
Definition at line 14 of file chainable.hpp.
|
inline |
Construct a chainable object.
The implementation in this abstract base class is a no-op.
Definition at line 22 of file chainable.hpp.
|
inline |
Chainables are not destructible and should go on the function call stack or be allocated with operator new.
Definition at line 28 of file chainable.hpp.
|
inlinevirtual |
Apply the chain rule to this variable based on the variables on which it depends.
The base implementation in this class is a no-op.
Reimplemented in stan::agrad::vari, and stan::agrad::partials_vari.
Definition at line 37 of file chainable.hpp.
|
inlinevirtual |
Initialize this chainable's adjoint value to make it the dependent variable in a gradient calculation.
Reimplemented in stan::agrad::vari.
Definition at line 44 of file chainable.hpp.
|
inlinestatic |
Allocate memory from the underlying memory pool.
This memory is is managed by the gradient program and will be recovered as a whole. Classes should not be allocated with this operator if they have non-trivial destructors.
| nbytes | Number of bytes to allocate. |
Definition at line 63 of file chainable.hpp.
|
inlinevirtual |
Set the value of the adjoint for this chainable to its initial value.
Reimplemented in stan::agrad::vari.
Definition at line 51 of file chainable.hpp.