Automatic Differentiation
 
Loading...
Searching...
No Matches
to_arena.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_OPENCL_REV_TO_ARENA_HPP
2#define STAN_MATH_OPENCL_REV_TO_ARENA_HPP
3#ifdef STAN_OPENCL
4
8
9namespace stan {
10namespace math {
11
24template <typename T, require_matrix_cl_t<T>* = nullptr>
25arena_t<T> to_arena(const T& a) {
26 arena_t<T> res(a.buffer(), a.rows(), a.cols(), a.view());
27 for (cl::Event e : a.read_events()) {
28 res.add_read_event(e);
29 }
30 for (cl::Event e : a.write_events()) {
31 res.add_write_event(e);
32 }
33 return res;
34}
35
36} // namespace math
37} // namespace stan
38
39#endif
40#endif
static constexpr double e()
Return the base of the natural logarithm.
Definition constants.hpp:20
arena_t< T > to_arena(const T &a)
Converts given argument into a type that either has any dynamic allocation on AD stack or schedules i...
Definition to_arena.hpp:25
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 ...