| Stan Math Library 2.6.3 probability, sampling & optimization

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
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:

## 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 (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
const size_t | size_
vari ** | varis_
double * | gradients_

## 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 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 21 of file precomputed_gradients.hpp.

## Constructor & Destructor Documentation

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] | val | The value of the variable.
  [in] | size | Size of operands and gradients
  [in] | varis | Operand implementations.
  [in] | gradients | Gradients with respect to operands.

Definition at line 37 of file precomputed_gradients.hpp.

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] | val | The value of the variable.
  [in] | vars | Vector of operands.
  [in] | gradients | Vector of partial derivatives of value with respect to operands.

Exceptions

  std::invalid_argument | if the sizes of the vectors don't match.

Definition at line 58 of file precomputed_gradients.hpp.

## Member Function Documentation

void stan::math::precomputed_gradients_vari::chain | ( |  | ) |
| inline virtual

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

Reimplemented from stan::math::chainable.

Definition at line 79 of file precomputed_gradients.hpp.

## Member Data Documentation

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

Definition at line 25 of file precomputed_gradients.hpp.

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

Definition at line 23 of file precomputed_gradients.hpp.

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

Definition at line 24 of file precomputed_gradients.hpp.

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

- stan/math/rev/core/precomputed_gradients.hpp

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