Stan Math Library  2.20.0
reverse mode automatic differentiation
operator_plus_equal.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_REV_CORE_OPERATOR_PLUS_EQUAL_HPP
2 #define STAN_MATH_REV_CORE_OPERATOR_PLUS_EQUAL_HPP
3 
6 
7 namespace stan {
8 namespace math {
9 
10 inline var& var::operator+=(const var& b) {
11  vi_ = new internal::add_vv_vari(vi_, b.vi_);
12  return *this;
13 }
14 
15 inline var& var::operator+=(double b) {
16  if (b == 0.0)
17  return *this;
18  vi_ = new internal::add_vd_vari(vi_, b);
19  return *this;
20 }
21 
22 } // namespace math
23 } // namespace stan
24 #endif
var & operator+=(const var &b)
The compound add/assignment operator for variables (C++).
Independent (input) and dependent (output) variables for gradients.
Definition: var.hpp:33
vari * vi_
Pointer to the implementation of this variable.
Definition: var.hpp:45

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