Expression Templates Library (ETL)
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
etl::clip_scalar_op< T, S > Struct Template Reference

Unary operation that clips all values between two scalars. More...

#include <clip.hpp>

Public Types

template<typename V = default_vec>
using vec_type = typename V::template vec_type< T >
 

Public Member Functions

 clip_scalar_op (S min, S max)
 Builds a new operator. More...
 
constexpr T apply (const T &x) const noexcept
 Apply the unary operator on x. More...
 
template<typename X , typename Y >
auto gpu_compute_hint (const X &x, Y &y) const noexcept
 Compute the result of the operation using the GPU. More...
 
template<typename X , typename Y >
Y & gpu_compute (const X &x, Y &y) const noexcept
 Compute the result of the operation using the GPU. More...
 

Static Public Member Functions

static constexpr int complexity ()
 Estimate the complexity of operator. More...
 
static std::string desc () noexcept
 Returns a textual representation of the operator. More...
 

Public Attributes

min
 The minimum for clipping.
 
max
 The maximum for clipping.
 

Static Public Attributes

static constexpr bool linear = true
 Indicates if the operator is linear or not.
 
static constexpr bool thread_safe = true
 Indicates if the operator is thread safe or not.
 
template<vector_mode_t V>
static constexpr bool vectorizable = intel_compiler && !is_complex_t<T>
 Indicates if the expression is vectorizable using the given vector mode. More...
 
template<typename E >
static constexpr bool gpu_computable
 Indicates if the operator can be computed on GPU. More...
 

Detailed Description

template<typename T, typename S>
struct etl::clip_scalar_op< T, S >

Unary operation that clips all values between two scalars.

Template Parameters
Tthe type of value
Sthe type of scalar

Member Typedef Documentation

◆ vec_type

template<typename T , typename S >
template<typename V = default_vec>
using etl::clip_scalar_op< T, S >::vec_type = typename V::template vec_type<T>

The vectorization type for V

Constructor & Destructor Documentation

◆ clip_scalar_op()

template<typename T , typename S >
etl::clip_scalar_op< T, S >::clip_scalar_op ( min,
max 
)
inline

Builds a new operator.

Parameters
minThe minimum for clipping
maxThe maximum for clipping

Member Function Documentation

◆ apply()

template<typename T , typename S >
constexpr T etl::clip_scalar_op< T, S >::apply ( const T &  x) const
inlinenoexcept

Apply the unary operator on x.

Parameters
xThe value on which to apply the operator
Returns
The result of applying the unary operator on x

◆ complexity()

template<typename T , typename S >
static constexpr int etl::clip_scalar_op< T, S >::complexity ( )
inlinestatic

Estimate the complexity of operator.

Returns
An estimation of the complexity of the operator

◆ desc()

template<typename T , typename S >
static std::string etl::clip_scalar_op< T, S >::desc ( )
inlinestaticnoexcept

Returns a textual representation of the operator.

Returns
a string representing the operator

◆ gpu_compute()

template<typename T , typename S >
template<typename X , typename Y >
Y& etl::clip_scalar_op< T, S >::gpu_compute ( const X &  x,
Y &  y 
) const
inlinenoexcept

Compute the result of the operation using the GPU.

Parameters
xThe expression of the unary operation
yThe expression into which to store the reuslt

◆ gpu_compute_hint()

template<typename T , typename S >
template<typename X , typename Y >
auto etl::clip_scalar_op< T, S >::gpu_compute_hint ( const X &  x,
Y &  y 
) const
inlinenoexcept

Compute the result of the operation using the GPU.

Parameters
xThe expression of the unary operation
Returns
The result of applying the unary operator on x. The result must be a GPU computed expression.

Member Data Documentation

◆ gpu_computable

template<typename T , typename S >
template<typename E >
constexpr bool etl::clip_scalar_op< T, S >::gpu_computable
static
Initial value:
= (is_single_precision_t<T> && impl::egblas::has_sclip_value)
|| (is_double_precision_t<T> && impl::egblas::has_dclip_value)
|| (is_complex_single_t<T> && impl::egblas::has_cclip_value)
|| (is_complex_double_t<T> && impl::egblas::has_zclip_value)

Indicates if the operator can be computed on GPU.

◆ vectorizable

template<typename T , typename S >
template<vector_mode_t V>
constexpr bool etl::clip_scalar_op< T, S >::vectorizable = intel_compiler && !is_complex_t<T>
static

Indicates if the expression is vectorizable using the given vector mode.

Template Parameters
VThe vector mode

The documentation for this struct was generated from the following file: