Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
amrex::simd::stdx Namespace Reference

Functions

__host__ __device__ bool any_of (bool const v)
 
template<typename T >
__host__ __device__ detail::where_expression< T > where (bool const mask, T &value)
 
template<typename T >
__host__ __device__ T select (bool const mask, T const &true_val, T const &false_val)
 
template<typename T >
__host__ __device__ T reduce (T const &v)
 
template<typename T , typename BinaryOperation >
__host__ __device__ T reduce (T const &v, BinaryOperation const &)
 
template<typename T >
__host__ __device__ T hmin (T const &v)
 
template<typename T >
__host__ __device__ T hmax (T const &v)
 
template<typename T >
__host__ __device__ T min (T const &a, T const &b)
 
template<typename T >
__host__ __device__ T max (T const &a, T const &b)
 

Function Documentation

◆ any_of()

__host__ __device__ bool amrex::simd::stdx::any_of ( bool const  v)
inline

True if the boolean value is true (scalar identity fallback for simd any_of)

Example:

// Works for both simd_mask and scalar bool:
auto mask = a > b;
Array4< int const > mask
Definition AMReX_InterpFaceRegister.cpp:93
__host__ __device__ bool any_of(bool const v)
Definition AMReX_SIMD.H:84
See also
https://en.cppreference.com/w/cpp/experimental/simd/any_of

◆ hmax()

template<typename T >
__host__ __device__ T amrex::simd::stdx::hmax ( T const &  v)
inline

Largest element (scalar identity fallback for simd hmax)

See also
https://en.cppreference.com/w/cpp/experimental/simd/reduce_min_max

◆ hmin()

template<typename T >
__host__ __device__ T amrex::simd::stdx::hmin ( T const &  v)
inline

Smallest element (scalar identity fallback for simd hmin)

See also
https://en.cppreference.com/w/cpp/experimental/simd/reduce_min_max

◆ max()

template<typename T >
__host__ __device__ T amrex::simd::stdx::max ( T const &  a,
T const &  b 
)
inline

Element-wise maximum (scalar fallback for simd max)

See also
https://en.cppreference.com/w/cpp/experimental/simd/max

◆ min()

template<typename T >
__host__ __device__ T amrex::simd::stdx::min ( T const &  a,
T const &  b 
)
inline

Element-wise minimum (scalar fallback for simd min)

See also
https://en.cppreference.com/w/cpp/experimental/simd/min

◆ reduce() [1/2]

template<typename T >
__host__ __device__ T amrex::simd::stdx::reduce ( T const &  v)
inline

Horizontal reduction over all elements (scalar identity fallback for simd reduce)

For a scalar, the reduction over its single "element" is the value itself, independent of the (associative) binary operation.

Example:

// Works for both simd<T> and scalar T:
auto total = amrex::simd::stdx::reduce(v); // sum of all elements
__host__ __device__ T reduce(T const &v)
Definition AMReX_SIMD.H:152
See also
https://en.cppreference.com/w/cpp/experimental/simd/reduce

◆ reduce() [2/2]

template<typename T , typename BinaryOperation >
__host__ __device__ T amrex::simd::stdx::reduce ( T const &  v,
BinaryOperation const &   
)
inline

Horizontal reduction with an explicit binary operation (scalar identity fallback)

See also
reduce above

◆ select()

template<typename T >
__host__ __device__ T amrex::simd::stdx::select ( bool const  mask,
T const &  true_val,
T const &  false_val 
)
inline

Vectorized ternary operator (scalar fallback for simd select)

See also
select in the AMREX_USE_SIMD path above
C++26 std::simd select

◆ where()

template<typename T >
__host__ __device__ detail::where_expression< T > amrex::simd::stdx::where ( bool const  mask,
T &  value 
)
inline

Masked assignment expression (scalar fallback for simd where)

Returns an expression object whose assignment operator conditionally updates value only when mask is true.

Example:

// Works for both simd<T> and scalar T:
auto mask = b > T(0);
T result = T(0);
amrex::simd::stdx::where(mask, result) = a / b;
__host__ __device__ detail::where_expression< T > where(bool const mask, T &value)
Definition AMReX_SIMD.H:120
See also
https://en.cppreference.com/w/cpp/experimental/simd/where