Stan Math Library
4.9.0
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
4
#include <
stan/math/prim/meta.hpp
>
5
#include <
stan/math/rev/core/var.hpp
>
6
#include <
stan/math/rev/core/callback_vari.hpp
>
7
#include <
stan/math/prim/fun/constants.hpp
>
8
#include <
stan/math/prim/fun/is_nan.hpp
>
9
10
namespace
stan
{
11
namespace
math {
12
26
inline
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
42
inline
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
callback_vari.hpp
stan::math::var_value< double >
constants.hpp
stan::math::operator--
var & operator--(var &a)
Prefix decrement operator for variables (C++).
Definition
operator_unary_decrement.hpp:26
stan::math::make_callback_var
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...
Definition
callback_vari.hpp:61
stan
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Definition
unit_vector_constrain.hpp:15
is_nan.hpp
meta.hpp
var.hpp
stan
math
rev
core
operator_unary_decrement.hpp
[
Stan Home Page
]
© 2011–2019, Stan Development Team.