Stan Math Library  2.15.0
reverse mode automatic differentiation
Public Member Functions | Protected Attributes | List of all members
stan::math::precomputed_gradients_vari Class Reference

A variable implementation taking a sequence of operands and partial derivatives with respect to the operands. More...

#include <precomputed_gradients.hpp>

Inheritance diagram for stan::math::precomputed_gradients_vari:
stan::math::vari

Public Member Functions

 precomputed_gradients_vari (double val, size_t size, vari **varis, double *gradients)
 Construct a precomputed vari with the specified value, operands, and gradients. More...
 
 precomputed_gradients_vari (double val, const std::vector< var > &vars, const std::vector< double > &gradients)
 Construct a precomputed vari with the specified value, operands, and gradients. More...
 
void chain ()
 Implements the chain rule for this variable, using the prestored operands and gradient. More...
 
- Public Member Functions inherited from stan::math::vari
 vari (double x)
 Construct a variable implementation from a value. More...
 
 vari (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

const size_t size_
 
vari ** varis_
 
double * gradients_
 

Additional Inherited Members

- Static Public Member Functions inherited from stan::math::vari
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 variable implementation taking a sequence of operands and partial derivatives with respect to the operands.

Stan users should use function precomputed_gradients() directly.

Definition at line 20 of file precomputed_gradients.hpp.

Constructor & Destructor Documentation

§ precomputed_gradients_vari() [1/2]

stan::math::precomputed_gradients_vari::precomputed_gradients_vari ( double  val,
size_t  size,
vari **  varis,
double *  gradients 
)
inline

Construct a precomputed vari with the specified value, operands, and gradients.

Parameters
[in]valThe value of the variable.
[in]sizeSize of operands and gradients
[in]varisOperand implementations.
[in]gradientsGradients with respect to operands.

Definition at line 36 of file precomputed_gradients.hpp.

§ precomputed_gradients_vari() [2/2]

stan::math::precomputed_gradients_vari::precomputed_gradients_vari ( double  val,
const std::vector< var > &  vars,
const std::vector< double > &  gradients 
)
inline

Construct a precomputed vari with the specified value, operands, and gradients.

Parameters
[in]valThe value of the variable.
[in]varsVector of operands.
[in]gradientsVector of partial derivatives of value with respect to operands.
Exceptions
std::invalid_argumentif the sizes of the vectors don't match.

Definition at line 57 of file precomputed_gradients.hpp.

Member Function Documentation

§ chain()

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

Implements the chain rule for this variable, using the prestored operands and gradient.

Reimplemented from stan::math::vari.

Definition at line 77 of file precomputed_gradients.hpp.

Member Data Documentation

§ gradients_

double* stan::math::precomputed_gradients_vari::gradients_
protected

Definition at line 24 of file precomputed_gradients.hpp.

§ size_

const size_t stan::math::precomputed_gradients_vari::size_
protected

Definition at line 22 of file precomputed_gradients.hpp.

§ varis_

vari** stan::math::precomputed_gradients_vari::varis_
protected

Definition at line 23 of file precomputed_gradients.hpp.


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

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