![]() |
Stan Math Library
2.11.0
reverse mode automatic differentiation
|
A var implementation that stores the daughter variable implementation pointers and the partial derivative with respect to the result explicitly in arrays constructed on the auto-diff memory stack. More...
#include <stored_gradient_vari.hpp>
Public Member Functions | |
stored_gradient_vari (double value, size_t size, vari **dtrs, double *partials) | |
Construct a stored gradient vari with the specified value, size, daughter varis, and partial derivatives. More... | |
void | chain () |
Propagate derivatives through this vari with partial derivatives given for the daughter vari by the stored partials. More... | |
![]() | |
vari (const double x) | |
Construct a variable implementation from a value. More... | |
vari (const double x, bool stacked) | |
virtual | ~vari () |
Throw an illegal argument exception. More... | |
void | init_dependent () |
Initialize the adjoint for this (dependent) variable to 1. More... | |
void | set_zero_adjoint () |
Set the adjoint value of this variable to 0. More... | |
Protected Attributes | |
size_t | size_ |
vari ** | dtrs_ |
double * | partials_ |
Additional Inherited Members | |
![]() | |
static void * | operator new (size_t nbytes) |
Allocate memory from the underlying memory pool. More... | |
static void | operator delete (void *) |
Delete a pointer from the underlying memory pool. More... | |
![]() | |
const double | val_ |
The value of this variable. More... | |
double | adj_ |
The adjoint of this variable, which is the partial derivative of this variable with respect to the root variable. More... | |
A var implementation that stores the daughter variable implementation pointers and the partial derivative with respect to the result explicitly in arrays constructed on the auto-diff memory stack.
Like a simplified version of OperandsAndPartials.
Definition at line 18 of file stored_gradient_vari.hpp.
|
inline |
Construct a stored gradient vari with the specified value, size, daughter varis, and partial derivatives.
[in] | value | Value of vari |
[in] | size | Number of daughters |
[in] | dtrs | Array of pointers to daughters |
[in] | partials | Partial derivatives of value with respect to daughters. |
Definition at line 35 of file stored_gradient_vari.hpp.
|
inlinevirtual |
Propagate derivatives through this vari with partial derivatives given for the daughter vari by the stored partials.
Reimplemented from stan::math::vari.
Definition at line 49 of file stored_gradient_vari.hpp.
|
protected |
Definition at line 21 of file stored_gradient_vari.hpp.
|
protected |
Definition at line 22 of file stored_gradient_vari.hpp.
|
protected |
Definition at line 20 of file stored_gradient_vari.hpp.