1#ifndef STAN_MATH_OPENCL_KERNEL_GENERATOR_holder_cl__HPP
2#define STAN_MATH_OPENCL_KERNEL_GENERATOR_holder_cl__HPP
32template <
typename T,
typename... Ptrs>
35 typename std::remove_reference_t<T>::Scalar, T> {
37 using Scalar =
typename std::remove_reference_t<T>::Scalar;
65template <
typename T,
typename... Ptrs,
83template <
typename T, std::size_t... Is,
typename... Args>
85 const std::tuple<Args*...>& ptrs) {
86 return holder_cl(std::forward<T>(expr), std::get<Is>(ptrs)...);
98template <
typename T, std::size_t... Is,
typename... Args>
101 std::tuple<std::remove_reference_t<Args>*...> res;
102 auto ptrs = std::tuple_cat(
105 func(*std::get<Is>(res)...),
106 std::make_index_sequence<std::tuple_size<
decltype(ptrs)>::value>(), ptrs);
121template <
typename T,
typename... Args,
123 decltype(std::declval<T>()(std::declval<Args&>()...)),
127 func, std::make_index_sequence<
sizeof...(Args)>(),
128 std::forward<Args>(args)...);
typename std::remove_reference_t< T >::Scalar Scalar
std::tuple< std::unique_ptr< Ptrs >... > m_unique_ptrs
holder_cl_(T &&a, Ptrs *... ptrs)
Constructor.
Represents a no-op in kernel generator expressions.
Base for all kernel generator operations.
auto make_holder_cl(const T &func, Args &&... args)
Constructs an expression from given arguments using given functor.
auto holder_cl(T &&a, Ptrs *... ptrs)
Constructs a no-op operation that also holds pointer to some other expressions, allocated on heap.
require_all_t< is_kernel_expression< Types >... > require_all_kernel_expressions_t
Enables a template if all given types are are a valid kernel generator expressions.
T_operation && as_operation_cl(T_operation &&a)
Converts any valid kernel generator expression into an operation.
auto make_holder_cl_impl_step1(const T &func, std::index_sequence< Is... >, Args &&... args)
First step in implementation of construction holder_cl from a functor.
auto make_holder_cl_impl_step2(T &&expr, std::index_sequence< Is... >, const std::tuple< Args *... > &ptrs)
Second step in implementation of construction holder_cl from a functor.
auto holder_handle_element(T &a, T *&res)
Handles single element (moving rvalue non-expressions to heap) for construction of holder or holder_c...
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...