Automatic Differentiation
 
Loading...
Searching...
No Matches
ldexp.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_OPENCL_REV_LDEXP_HPP
2#define STAN_MATH_OPENCL_REV_LDEXP_HPP
3#ifdef STAN_OPENCL
4
9
10namespace stan {
11namespace math {
12
23template <typename T_a, typename T_b,
24 require_all_kernel_expressions_t<T_a, T_b>* = nullptr,
25 require_st_integral<T_b>* = nullptr>
27 arena_t<T_b> b_arena = std::forward<T_b>(b);
28
29 return make_callback_var(
30 ldexp(a.val(), b),
31 [a, b_arena](vari_value<matrix_cl<double>>& res) mutable {
32 adjoint_results(a) += expressions(ldexp(res.adj(), b_arena));
33 });
34}
35
36} // namespace math
37} // namespace stan
38
39#endif
40#endif
Represents an arithmetic matrix on the OpenCL device.
Definition matrix_cl.hpp:47
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...
fvar< T > ldexp(const fvar< T > &a, int b)
Returns the product of a (the significand) times 2 to power b (the exponent).
Definition ldexp.hpp:21
typename internal::arena_type_impl< std::decay_t< T > >::type arena_t
Determines a type that can be used in place of T that does any dynamic allocations on the AD stack.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...