28 template <vector_mode_t V>
35 static constexpr
bool gpu_computable = (is_single_precision_t<T> && impl::egblas::has_sabs) || (is_double_precision_t<T> && impl::egblas::has_dabs)
36 || (is_complex_single_t<T> && impl::egblas::has_cabs) || (is_complex_double_t<T> && impl::egblas::has_zabs);
49 template <
typename V = default_vec>
57 static constexpr T
apply(
const T& x) noexcept {
67 template <
typename V = default_vec>
69 return V::max(x, V::sub(V::template zero<T>(), x));
79 template <
typename X,
typename Y>
86 impl::egblas::abs(
etl::size(y), alpha, t1.gpu_memory(), 1, t2.gpu_memory(), 1);
97 template <
typename X,
typename Y>
102 impl::egblas::abs(
etl::size(y), alpha, t1.gpu_memory(), 1, y.gpu_memory(), 1);
114 static std::string
desc() noexcept {
static std::string desc() noexcept
Returns a textual representation of the operator.
Definition: abs.hpp:114
auto max(L &&lhs, R &&rhs)
Create an expression with the max value of lhs or rhs.
Definition: expression_builder.hpp:65
typename V::template vec_type< T > vec_type
Definition: abs.hpp:50
static auto gpu_compute_hint(const X &x, Y &y) noexcept
Compute the result of the operation using the GPU.
Definition: abs.hpp:80
static constexpr int complexity()
Estimate the complexity of operator.
Definition: abs.hpp:42
decltype(auto) select_smart_gpu_compute(X &x, Y &y)
Compute the expression into a representation that is GPU up to date and possibly store this represent...
Definition: helpers.hpp:434
static constexpr bool vectorizable
Indicates if the expression is vectorizable using the given vector mode.
Definition: abs.hpp:29
Root namespace for the ETL library.
Definition: adapter.hpp:15
static Y & gpu_compute(const X &x, Y &y) noexcept
Compute the result of the operation using the GPU.
Definition: abs.hpp:98
static constexpr bool thread_safe
Indicates if the operator is thread safe or not.
Definition: abs.hpp:21
decltype(auto) force_temporary_gpu_dim_only(E &&expr)
Force a temporary out of the expression, without copying its content.
Definition: temporary.hpp:223
constexpr size_t size(const E &expr) noexcept
Returns the size of the given ETL expression.
Definition: helpers.hpp:108
static constexpr T apply(const T &x) noexcept
Apply the unary operator on x.
Definition: abs.hpp:57
static vec_type< V > load(const vec_type< V > &x) noexcept
Compute several applications of the operator at a time.
Definition: abs.hpp:68
Unary operation taking the absolute value.
Definition: abs.hpp:19
static constexpr bool gpu_computable
Indicates if the operator can be computed on GPU.
Definition: abs.hpp:35
decltype(auto) smart_gpu_compute_hint(E &expr, Y &y)
Compute the expression into a representation that is GPU up to date.
Definition: helpers.hpp:368
EGBLAS wrappers for the abs operation.
static constexpr bool linear
Indicates if the operator is linear.
Definition: abs.hpp:20