Automatic Differentiation
 
Loading...
Searching...
No Matches
expm1.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_REV_FUN_EXPM1_HPP
2#define STAN_MATH_REV_FUN_EXPM1_HPP
3
7
8namespace stan {
9namespace math {
10
38inline var expm1(const var& a) {
39 return make_callback_var(expm1(a.val()), [a](auto& vi) mutable {
40 a.adj() += vi.adj() * (vi.val() + 1.0);
41 });
42}
43
44template <typename T, require_eigen_t<T>* = nullptr>
45inline auto expm1(const var_value<T>& a) {
46 return make_callback_var(expm1(a.val()), [a](auto& vi) mutable {
47 a.adj().array() += vi.adj().array() * (vi.val().array() + 1.0);
48 });
49}
50
51} // namespace math
52} // namespace stan
53#endif
fvar< T > expm1(const fvar< T > &x)
Definition expm1.hpp:13
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 ...