Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | List of all members
stan::math::internal::rising_factorial_vd_vari Class Reference

#include "stan/math/rev/scal/fun/rising_factorial.hpp"

Inheritance diagram for stan::math::internal::rising_factorial_vd_vari:
stan::math::op_vd_vari stan::math::vari

Public Member Functions

 rising_factorial_vd_vari (vari *avi, int b)
 
void chain ()
 
void init_dependent ()
 
void set_zero_adjoint ()
 

Static Public Member Functions

static voidoperator new (size_t nbytes)
 
static void operator delete (void *)
 

Public Attributes

const double val_
 
double adj_
 

Protected Attributes

variavi_
 
double bd_
 

Detailed Description

Definition at line 13 of file rising_factorial.hpp.

Constructor & Destructor Documentation

stan::math::internal::rising_factorial_vd_vari::rising_factorial_vd_vari ( vari avi,
int  b 
)
inline

Definition at line 15 of file rising_factorial.hpp.

16  : op_vd_vari(rising_factorial(avi->val_, b), avi, b) {}
op_vd_vari(double f, vari *avi, double b)
Definition: vd_vari.hpp:15
fvar< T > rising_factorial(const fvar< T > &x, int n)
const hit & b
Definition: hits.cxx:21

Member Function Documentation

void stan::math::internal::rising_factorial_vd_vari::chain ( )
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 from stan::math::vari.

Definition at line 17 of file rising_factorial.hpp.

References stan::math::vari::adj_, stan::math::op_vd_vari::avi_, stan::math::op_vd_vari::bd_, stan::math::digamma(), stan::math::rising_factorial(), and stan::math::vari::val_.

17  {
19  * (digamma(avi_->val_ + bd_) - digamma(avi_->val_));
20  }
const double val_
Definition: vari.hpp:38
fvar< T > rising_factorial(const fvar< T > &x, int n)
double adj_
Definition: vari.hpp:44
fvar< T > digamma(const fvar< T > &x)
Definition: digamma.hpp:22
void stan::math::vari::init_dependent ( )
inlineinherited

Initialize the adjoint for this (dependent) variable to 1. This operation is applied to the dependent variable before propagating derivatives, setting the derivative of the result with respect to itself to be 1.

Definition at line 93 of file vari.hpp.

Referenced by stan::math::grad().

93 { adj_ = 1.0; }
double adj_
Definition: vari.hpp:44
static void stan::math::vari::operator delete ( void )
inlinestaticinherited

Delete a pointer from the underlying memory pool.

This no-op implementation enables a subclass to throw exceptions in its constructor. An exception thrown in the constructor of a subclass will result in an error being raised, which is in turn caught and calls delete().

See the discussion of "plugging the memory leak" in: http://www.parashift.com/c++-faq/memory-pools.html

Definition at line 140 of file vari.hpp.

140  { /* no op */
141  }
static void* stan::math::vari::operator new ( size_t  nbytes)
inlinestaticinherited

Allocate memory from the underlying memory pool. This memory is is managed as a whole externally.

Warning: Classes should not be allocated with this operator if they have non-trivial destructors.

Parameters
nbytesNumber of bytes to allocate.
Returns
Pointer to allocated bytes.

Definition at line 125 of file vari.hpp.

References stan::math::stack_alloc::alloc(), stan::math::AutodiffStackSingleton< ChainableT, ChainableAllocT >::instance(), stan::math::AutodiffStackSingleton< ChainableT, ChainableAllocT >::AutodiffStackStorage::memalloc_, and nbytes.

125  {
127  }
Long64_t nbytes
static AutodiffStackStorage & instance()
void * alloc(size_t len)
void stan::math::vari::set_zero_adjoint ( )
inlineinherited

Set the adjoint value of this variable to 0. This is used to reset adjoints before propagating derivatives again (for example in a Jacobian calculation).

Definition at line 100 of file vari.hpp.

100 { adj_ = 0.0; }
double adj_
Definition: vari.hpp:44

Member Data Documentation

double stan::math::vari::adj_
inherited

The adjoint of this variable, which is the partial derivative of this variable with respect to the root variable.

Definition at line 44 of file vari.hpp.

Referenced by stan::math::var::adj(), stan::math::scal_squared_distance_vv_vari::chain(), chain(), stan::math::internal::falling_factorial_vd_vari::chain(), stan::math::precomp_v_vari::chain(), stan::math::precomp_vv_vari::chain(), stan::math::precomp_vvv_vari::chain(), stan::math::scal_squared_distance_vd_vari::chain(), stan::math::scal_squared_distance_dv_vari::chain(), stan::math::sum_v_vari::chain(), stan::math::stored_gradient_vari::chain(), stan::math::gevv_vvv_vari::chain(), stan::math::precomputed_gradients_vari::chain(), stan::math::algebra_solver_vari< Fs, F, T, Fx >::chain(), stan::math::cholesky_block::chain(), stan::math::cov_exp_quad_vari< T_x, T_sigma, T_l >::chain(), stan::math::multiply_mat_vari< Ta, Ra, Ca, Tb, Cb >::chain(), stan::math::gp_periodic_cov_vari< T_x, T_sigma, T_l, T_p >::chain(), stan::math::matrix_exp_action_vari< Ta, N, Tb, Cb >::chain(), stan::math::multiply_mat_vari< Ta, 1, Ca, Tb, 1 >::chain(), stan::math::cov_exp_quad_vari< T_x, double, T_l >::chain(), stan::math::cholesky_scalar::chain(), stan::math::matrix_exp_action_vari< double, N, Tb, Cb >::chain(), stan::math::gp_periodic_cov_vari< T_x, double, T_l, T_p >::chain(), stan::math::multiply_mat_vari< double, Ra, Ca, Tb, Cb >::chain(), stan::math::multiply_mat_vari< double, 1, Ca, Tb, 1 >::chain(), stan::math::matrix_exp_action_vari< Ta, N, double, Cb >::chain(), stan::math::multiply_mat_vari< Ta, Ra, Ca, double, Cb >::chain(), stan::math::multiply_mat_vari< Ta, 1, Ca, double, 1 >::chain(), and stan::math::var::grad().

vari* stan::math::op_vd_vari::avi_
protectedinherited

Definition at line 11 of file vd_vari.hpp.

Referenced by stan::math::internal::falling_factorial_vd_vari::chain(), and chain().

double stan::math::op_vd_vari::bd_
protectedinherited

Definition at line 12 of file vd_vari.hpp.

Referenced by stan::math::internal::falling_factorial_vd_vari::chain(), and chain().

const double stan::math::vari::val_
inherited

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