Automatic Differentiation
 
Loading...
Searching...
No Matches
operator_unary_increment.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_REV_CORE_OPERATOR_UNARY_INCREMENT_HPP
2#define STAN_MATH_REV_CORE_OPERATOR_UNARY_INCREMENT_HPP
3
9
10namespace stan {
11namespace math {
12
22inline var& operator++(var& a) {
23 a = make_callback_var(a.val() + 1.0, [a](auto& vi) { a.adj() += vi.adj(); });
24 return a;
25}
26
38inline var operator++(var& a, int /*dummy*/) {
39 var temp(a);
40 a = make_callback_var(a.val() + 1.0, [a](auto& vi) { a.adj() += vi.adj(); });
41 return temp;
42}
43
44} // namespace math
45} // namespace stan
46#endif
var & operator++(var &a)
Prefix increment operator for variables (C++).
var_value< plain_type_t< T > > make_callback_var(T &&value, F &&functor)
Creates a new var initialized with a callback_vari with a given value and reverse-pass callback funct...
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...