Stan Math Library
4.9.0
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
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
22
inline
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
38
inline
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
callback_vari.hpp
stan::math::var_value< double >
constants.hpp
stan::math::operator++
var & operator++(var &a)
Prefix increment operator for variables (C++).
Definition
operator_unary_increment.hpp:22
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_increment.hpp
[
Stan Home Page
]
© 2011–2019, Stan Development Team.