dune-common  2.7.0
Classes | Namespaces | Macros | Functions
loop.hh File Reference
#include <array>
#include <cmath>
#include <cstddef>
#include <cstdlib>
#include <ostream>
#include <dune/common/math.hh>
#include <dune/common/simd/simd.hh>
#include <dune/common/typetraits.hh>

Go to the source code of this file.

Classes

class  Dune::LoopSIMD< T, S >
 
struct  Dune::Simd::Overloads::ScalarType< LoopSIMD< T, S > >
 
struct  Dune::Simd::Overloads::RebindType< U, LoopSIMD< T, S > >
 
struct  Dune::Simd::Overloads::LaneCount< LoopSIMD< T, S > >
 
struct  Dune::IsNumber< LoopSIMD< T, S > >
 

Namespaces

 Dune
 Dune namespace.
 
 Dune::Simd
 Namespace for vectorization interface functions used by library developers.
 
 Dune::Simd::Overloads
 Namespace for the overloads and specializations that make up a SIMD implementation.
 
 Dune::MathOverloads
 namespace for customization of math functions with Dune-Semantics
 

Macros

#define DUNE_SIMD_LOOP_PREFIX_OP(SYMBOL)
 
#define DUNE_SIMD_LOOP_UNARY_OP(SYMBOL)
 
#define DUNE_SIMD_LOOP_POSTFIX_OP(SYMBOL)
 
#define DUNE_SIMD_LOOP_ASSIGNMENT_OP(SYMBOL)
 
#define DUNE_SIMD_LOOP_BINARY_OP(SYMBOL)
 
#define DUNE_SIMD_LOOP_BITSHIFT_OP(SYMBOL)
 
#define DUNE_SIMD_LOOP_COMPARISON_OP(SYMBOL)
 
#define DUNE_SIMD_LOOP_BOOLEAN_OP(SYMBOL)
 
#define DUNE_SIMD_LOOP_CMATH_UNARY_OP(expr)
 
#define DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN(expr, returnType)
 
#define DUNE_SIMD_LOOP_STD_UNARY_OP(expr)
 
#define DUNE_SIMD_LOOP_STD_BINARY_OP(expr)
 

Functions

 Dune::DUNE_SIMD_LOOP_BINARY_OP (+)
 
 Dune::DUNE_SIMD_LOOP_BINARY_OP (-)
 
DUNE_SIMD_LOOP_BINARY_OP * Dune::DUNE_SIMD_LOOP_BINARY_OP (/);DUNE_SIMD_LOOP_BINARY_OP(%
 
DUNE_SIMD_LOOP_BINARY_OP & Dune::DUNE_SIMD_LOOP_BINARY_OP (|);DUNE_SIMD_LOOP_BINARY_OP(^
 
 Dune::DUNE_SIMD_LOOP_BITSHIFT_OP (<<)
 
 Dune::DUNE_SIMD_LOOP_BITSHIFT_OP (>>)
 
 Dune::DUNE_SIMD_LOOP_COMPARISON_OP (<)
 
 Dune::DUNE_SIMD_LOOP_COMPARISON_OP (<=)
 
 Dune::DUNE_SIMD_LOOP_COMPARISON_OP (>=)
 
 Dune::DUNE_SIMD_LOOP_COMPARISON_OP (!=)
 
DUNE_SIMD_LOOP_BOOLEAN_OP && Dune::DUNE_SIMD_LOOP_BOOLEAN_OP (||);template< class T, std::size_t S > std::ostream &operator<<(std::ostream &os, const LoopSIMD< T, S > &v
 
template<class T , std::size_t S>
T && Dune::Simd::Overloads::lane (ADLTag< 5 >, std::size_t l, LoopSIMD< T, S > &&v)
 
template<class T , std::size_t S>
const T & Dune::Simd::Overloads::lane (ADLTag< 5 >, std::size_t l, const LoopSIMD< T, S > &v)
 
template<class T , std::size_t S>
T & Dune::Simd::Overloads::lane (ADLTag< 5 >, std::size_t l, LoopSIMD< T, S > &v)
 
template<class T , std::size_t S>
auto Dune::Simd::Overloads::cond (ADLTag< 5 >, LoopSIMD< bool, S > mask, LoopSIMD< T, S > ifTrue, LoopSIMD< T, S > ifFalse)
 
template<class M , class T >
auto Dune::Simd::Overloads::cond (ADLTag< 5, std::is_same< bool, Scalar< M > >::value >, M mask, LoopSIMD< T, Simd::lanes< M >()> ifTrue, LoopSIMD< T, Simd::lanes< M >()> ifFalse)
 
template<std::size_t S>
bool Dune::Simd::Overloads::anyTrue (ADLTag< 5 >, LoopSIMD< bool, S > mask)
 
template<std::size_t S>
bool Dune::Simd::Overloads::allTrue (ADLTag< 5 >, LoopSIMD< bool, S > mask)
 
template<std::size_t S>
bool Dune::Simd::Overloads::anyFalse (ADLTag< 5 >, LoopSIMD< bool, S > mask)
 
template<std::size_t S>
bool Dune::Simd::Overloads::allFalse (ADLTag< 5 >, LoopSIMD< bool, S > mask)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (cos)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (sin)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (tan)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (acos)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (asin)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (atan)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (cosh)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (sinh)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (tanh)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (acosh)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (asinh)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (atanh)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (exp)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (log)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (log10)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (exp2)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (expm1)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN (ilogb, int)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (log1p)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (log2)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (logb)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (sqrt)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (cbrt)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (erf)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (erfc)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (tgamma)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (lgamma)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (ceil)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (floor)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (trunc)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (round)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN (lround, long)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN (llround, long long)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (rint)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN (lrint, long)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN (llrint, long long)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (nearbyint)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (fabs)
 
 Dune::DUNE_SIMD_LOOP_CMATH_UNARY_OP (abs)
 
 Dune::DUNE_SIMD_LOOP_STD_UNARY_OP (real)
 
 Dune::DUNE_SIMD_LOOP_STD_UNARY_OP (imag)
 
 Dune::DUNE_SIMD_LOOP_STD_BINARY_OP (max)
 
 Dune::DUNE_SIMD_LOOP_STD_BINARY_OP (min)
 
template<class T , std::size_t S>
auto Dune::MathOverloads::isNaN (const LoopSIMD< T, S > &v, PriorityTag< 3 >, ADLTag)
 
template<class T , std::size_t S>
auto Dune::MathOverloads::isInf (const LoopSIMD< T, S > &v, PriorityTag< 3 >, ADLTag)
 
template<class T , std::size_t S>
auto Dune::MathOverloads::isFinite (const LoopSIMD< T, S > &v, PriorityTag< 3 >, ADLTag)
 

Macro Definition Documentation

◆ DUNE_SIMD_LOOP_ASSIGNMENT_OP

#define DUNE_SIMD_LOOP_ASSIGNMENT_OP (   SYMBOL)
Value:
auto operator SYMBOL(const T s) { \
for(std::size_t i=0; i<S; i++){ \
(*this)[i] SYMBOL s; \
} \
return *this; \
} \
auto operator SYMBOL(const LoopSIMD<T,S> &v) { \
for(std::size_t i=0; i<S; i++){ \
(*this)[i] SYMBOL v[i]; \
} \
return *this; \
} \
static_assert(true, "expecting ;")

◆ DUNE_SIMD_LOOP_BINARY_OP

#define DUNE_SIMD_LOOP_BINARY_OP (   SYMBOL)
Value:
template<class T, std::size_t S> \
auto operator SYMBOL(const LoopSIMD<T,S> &v, const T s) { \
LoopSIMD<T,S> out; \
for(std::size_t i=0; i<S; i++){ \
out[i] = v[i] SYMBOL s; \
} \
return out; \
} \
template<class T, std::size_t S> \
auto operator SYMBOL(const T s, const LoopSIMD<T,S> &v) { \
LoopSIMD<T,S> out; \
for(std::size_t i=0; i<S; i++){ \
out[i] = s SYMBOL v[i]; \
} \
return out; \
} \
template<class T, std::size_t S> \
auto operator SYMBOL(const LoopSIMD<T,S> &v, \
const LoopSIMD<T,S> &w) { \
LoopSIMD<T,S> out; \
for(std::size_t i=0; i<S; i++){ \
out[i] = v[i] SYMBOL w[i]; \
} \
return out; \
} \
static_assert(true, "expecting ;")

◆ DUNE_SIMD_LOOP_BITSHIFT_OP

#define DUNE_SIMD_LOOP_BITSHIFT_OP (   SYMBOL)
Value:
template<class T, std::size_t S, class U> \
auto operator SYMBOL(const LoopSIMD<T,S> &v, const U s) { \
LoopSIMD<T,S> out; \
for(std::size_t i=0; i<S; i++){ \
out[i] = v[i] SYMBOL s; \
} \
return out; \
} \
template<class T, std::size_t S, class U> \
auto operator SYMBOL(const LoopSIMD<T,S> &v, \
const LoopSIMD<U,S> &w) { \
LoopSIMD<T,S> out; \
for(std::size_t i=0; i<S; i++){ \
out[i] = v[i] SYMBOL w[i]; \
} \
return out; \
} \
static_assert(true, "expecting ;")

◆ DUNE_SIMD_LOOP_BOOLEAN_OP

#define DUNE_SIMD_LOOP_BOOLEAN_OP (   SYMBOL)
Value:
template<class T, std::size_t S> \
auto operator SYMBOL(const LoopSIMD<T,S> &v, const T s) { \
LoopSIMD<bool,S> out; \
for(std::size_t i=0; i<S; i++){ \
out[i] = v[i] SYMBOL s; \
} \
return out; \
} \
template<class T, std::size_t S> \
auto operator SYMBOL(const bool s, const LoopSIMD<T,S> &v) { \
LoopSIMD<bool,S> out; \
for(std::size_t i=0; i<S; i++){ \
out[i] = s SYMBOL v[i]; \
} \
return out; \
} \
template<class T, std::size_t S> \
auto operator SYMBOL(const LoopSIMD<T,S> &v, \
const LoopSIMD<T,S> &w) { \
LoopSIMD<bool,S> out; \
for(std::size_t i=0; i<S; i++){ \
out[i] = v[i] SYMBOL w[i]; \
} \
return out; \
} \
static_assert(true, "expecting ;")

◆ DUNE_SIMD_LOOP_CMATH_UNARY_OP

#define DUNE_SIMD_LOOP_CMATH_UNARY_OP (   expr)
Value:
template<class T, std::size_t S, typename Sfinae = \
typename std::enable_if_t<!std::is_integral<T>::value> > \
auto expr(const LoopSIMD<T,S> &v) { \
using std::expr; \
LoopSIMD<T,S> out; \
for(std::size_t i=0; i<S; i++) { \
out[i] = expr(v[i]); \
} \
return out; \
} \
static_assert(true, "expecting ;")

◆ DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN

#define DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN (   expr,
  returnType 
)
Value:
template<class T, std::size_t S, typename Sfinae = \
typename std::enable_if_t<!std::is_integral<T>::value> > \
auto expr(const LoopSIMD<T,S> &v) { \
using std::expr; \
LoopSIMD<returnType,S> out; \
for(std::size_t i=0; i<S; i++) { \
out[i] = expr(v[i]); \
} \
return out; \
} \
static_assert(true, "expecting ;")

◆ DUNE_SIMD_LOOP_COMPARISON_OP

#define DUNE_SIMD_LOOP_COMPARISON_OP (   SYMBOL)
Value:
template<class T, std::size_t S, class U> \
auto operator SYMBOL(const LoopSIMD<T,S> &v, const U s) { \
LoopSIMD<bool,S> out; \
for(std::size_t i=0; i<S; i++){ \
out[i] = v[i] SYMBOL s; \
} \
return out; \
} \
template<class T, std::size_t S> \
auto operator SYMBOL(const T s, const LoopSIMD<T,S> &v) { \
LoopSIMD<bool,S> out; \
for(std::size_t i=0; i<S; i++){ \
out[i] = s SYMBOL v[i]; \
} \
return out; \
} \
template<class T, std::size_t S> \
auto operator SYMBOL(const LoopSIMD<T,S> &v, \
const LoopSIMD<T,S> &w) { \
LoopSIMD<bool,S> out; \
for(std::size_t i=0; i<S; i++){ \
out[i] = v[i] SYMBOL w[i]; \
} \
return out; \
} \
static_assert(true, "expecting ;")

◆ DUNE_SIMD_LOOP_POSTFIX_OP

#define DUNE_SIMD_LOOP_POSTFIX_OP (   SYMBOL)
Value:
auto operator SYMBOL(int){ \
LoopSIMD<T,S> out = *this; \
SYMBOL(*this); \
return out; \
} \
static_assert(true, "expecting ;")

◆ DUNE_SIMD_LOOP_PREFIX_OP

#define DUNE_SIMD_LOOP_PREFIX_OP (   SYMBOL)
Value:
auto operator SYMBOL() { \
for(std::size_t i=0; i<S; i++){ \
SYMBOL(*this)[i]; \
} \
return *this; \
} \
static_assert(true, "expecting ;")

◆ DUNE_SIMD_LOOP_STD_BINARY_OP

#define DUNE_SIMD_LOOP_STD_BINARY_OP (   expr)
Value:
template<class T, std::size_t S> \
auto expr(const LoopSIMD<T,S> &v, const LoopSIMD<T,S> &w) { \
using std::expr; \
LoopSIMD<T,S> out; \
for(std::size_t i=0; i<S; i++) { \
out[i] = expr(v[i],w[i]); \
} \
return out; \
} \
static_assert(true, "expecting ;")

◆ DUNE_SIMD_LOOP_STD_UNARY_OP

#define DUNE_SIMD_LOOP_STD_UNARY_OP (   expr)
Value:
template<class T, std::size_t S> \
auto expr(const LoopSIMD<T,S> &v) { \
using std::expr; \
LoopSIMD<T,S> out; \
for(std::size_t i=0; i<S; i++) { \
out[i] = expr(v[i]); \
} \
return out; \
} \
\
template<class T, std::size_t S> \
auto expr(const LoopSIMD<std::complex<T>,S> &v) { \
using std::expr; \
LoopSIMD<T,S> out; \
for(std::size_t i=0; i<S; i++) { \
out[i] = expr(v[i]); \
} \
return out; \
} \
static_assert(true, "expecting ;")

◆ DUNE_SIMD_LOOP_UNARY_OP

#define DUNE_SIMD_LOOP_UNARY_OP (   SYMBOL)
Value:
auto operator SYMBOL() const { \
LoopSIMD<T,S> out; \
for(std::size_t i=0; i<S; i++){ \
out[i] = SYMBOL((*this)[i]); \
} \
return out; \
} \
static_assert(true, "expecting ;")