Stan Math Library  2.11.0
reverse mode automatic differentiation
precomp_v_vari.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_REV_CORE_PRECOMP_V_VARI_HPP
2 #define STAN_MATH_REV_CORE_PRECOMP_V_VARI_HPP
3 
6 
7 namespace stan {
8  namespace math {
9 
10  // use for single precomputed partials
11  class precomp_v_vari : public op_v_vari {
12  protected:
13  double da_;
14  public:
15  precomp_v_vari(double val, vari* avi, double da)
16  : op_v_vari(val, avi),
17  da_(da) {
18  }
19  void chain() {
20  avi_->adj_ += adj_ * da_;
21  }
22  };
23 
24  }
25 }
26 #endif
The variable implementation base class.
Definition: vari.hpp:30
double adj_
The adjoint of this variable, which is the partial derivative of this variable with respect to the ro...
Definition: vari.hpp:44
void chain()
Apply the chain rule to this variable based on the variables on which it depends. ...
precomp_v_vari(double val, vari *avi, double da)

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