Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ ADD_UNARY_FUNCTION_WITH_INCLUDES

#define ADD_UNARY_FUNCTION_WITH_INCLUDES (   fun,
  ... 
)
Value:
template <typename T> \
class fun##_ : public elt_function_cl<fun##_<T>, double, T> { \
using base = elt_function_cl<fun##_<T>, double, T>; \
using base::arguments_; \
\
public: \
using base::rows; \
using base::cols; \
static const std::vector<const char*> includes; \
explicit fun##_(T&& a) : base(#fun, std::forward<T>(a)) {} \
inline auto deep_copy() const { \
auto&& arg_copy = this->template get_arg<0>().deep_copy(); \
return fun##_<std::remove_reference_t<decltype(arg_copy)>>{ \
std::move(arg_copy)}; \
} \
inline std::pair<int, int> extreme_diagonals() const { \
return {-rows() + 1, cols() - 1}; \
} \
}; \
\
template <typename T, typename Cond \
= require_all_kernel_expressions_and_none_scalar_t<T>> \
inline fun##_<as_operation_cl_t<T>> fun(T&& a) { \
return fun##_<as_operation_cl_t<T>>(as_operation_cl(std::forward<T>(a))); \
} \
template <typename T> \
const std::vector<const char*> fun##_<T>::includes{__VA_ARGS__};
T_operation && as_operation_cl(T_operation &&a)
Converts any valid kernel generator expression into an operation.
int rows(const T_x &x)
Returns the number of rows in the specified kernel generator expression.
Definition rows.hpp:21
int cols(const T_x &x)
Returns the number of columns in the specified kernel generator expression.
Definition cols.hpp:20
STL namespace.

Generates a class and function for a general unary function that is defined by OpenCL or in the included code.

Parameters
funfunction
...function sources to include into kernel

Definition at line 155 of file elt_function_cl.hpp.