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