Automatic Differentiation
 
Loading...
Searching...
No Matches
operator_unary_decrement.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_REV_CORE_OPERATOR_UNARY_DECREMENT_HPP
2#define STAN_MATH_REV_CORE_OPERATOR_UNARY_DECREMENT_HPP
3
9
10namespace stan {
11namespace math {
12
26inline var& operator--(var& a) {
27 a = make_callback_var(a.val() - 1.0, [a](auto& vi) { a.adj() += vi.adj(); });
28 return a;
29}
30
42inline var operator--(var& a, int /*dummy*/) {
43 var temp(a);
44 a = make_callback_var(a.val() - 1.0, [a](auto& vi) { a.adj() += vi.adj(); });
45 return temp;
46}
47
48} // namespace math
49} // namespace stan
50#endif
var & operator--(var &a)
Prefix decrement 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 ...