Stan Math Library  2.6.3
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
Public Member Functions | Protected Attributes | List of all members
stan::math::stored_gradient_vari Class Reference

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>

Inheritance diagram for stan::math::stored_gradient_vari:
stan::math::vari stan::math::chainable

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...
 
- Public Member Functions inherited from stan::math::vari
 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...
 
virtual void init_dependent ()
 Initialize the adjoint for this (dependent) variable to 1. More...
 
virtual void set_zero_adjoint ()
 Set the adjoint value of this variable to 0. More...
 
- Public Member Functions inherited from stan::math::chainable
 chainable ()
 Construct a chainable object. More...
 
virtual ~chainable ()
 Chainables are not destructible and should go on the function call stack or be allocated with operator new. More...
 

Protected Attributes

size_t size_
 
vari ** dtrs_
 
double * partials_
 

Additional Inherited Members

- Static Public Member Functions inherited from stan::math::chainable
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...
 
- Public Attributes inherited from stan::math::vari
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...
 

Detailed Description

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.

Constructor & Destructor Documentation

stan::math::stored_gradient_vari::stored_gradient_vari ( double  value,
size_t  size,
vari **  dtrs,
double *  partials 
)
inline

Construct a stored gradient vari with the specified value, size, daughter varis, and partial derivatives.

Parameters
[in]valueValue of vari
[in]sizeNumber of daughters
[in]dtrsArray of pointers to daughters
[in]partialsPartial derivatives of value with respect to daughters.

Definition at line 35 of file stored_gradient_vari.hpp.

Member Function Documentation

void stan::math::stored_gradient_vari::chain ( )
inlinevirtual

Propagate derivatives through this vari with partial derivatives given for the daughter vari by the stored partials.

Reimplemented from stan::math::chainable.

Definition at line 49 of file stored_gradient_vari.hpp.

Member Data Documentation

vari** stan::math::stored_gradient_vari::dtrs_
protected

Definition at line 21 of file stored_gradient_vari.hpp.

double* stan::math::stored_gradient_vari::partials_
protected

Definition at line 22 of file stored_gradient_vari.hpp.

size_t stan::math::stored_gradient_vari::size_
protected

Definition at line 20 of file stored_gradient_vari.hpp.


The documentation for this class was generated from the following file:

     [ Stan Home Page ] © 2011–2015, Stan Development Team.