1#ifndef DUNE_COMMON_SIMD_HH
2#define DUNE_COMMON_SIMD_HH
21#include <dune/common/conditional.hh>
30 struct SimdScalarTypeTraits
36 using SimdScalar =
typename SimdScalarTypeTraits<T>::type;
42 template<
typename T,
typename A>
43 struct SimdScalarTypeTraits< Vc::Vector<T,A> >
48 template<
typename T, std::
size_t N,
typename V, std::
size_t M>
49 struct SimdScalarTypeTraits< Vc::SimdArray<T,N,V,M> >
59 template<
typename T,
typename A>
60 Vc::Vector<T,A>
cond(
const Vc::Mask<T,A> & b,
61 const Vc::Vector<T,A> & v1,
62 const Vc::Vector<T,A> & v2)
64 return std::move(Vc::iif(b, v1, v2));
67 template<
typename T, std::
size_t N,
typename V, std::
size_t M>
68 Vc::SimdArray<T,N,V,M>
cond(
const typename Vc::SimdArray<T,N,V,M>::mask_type & b,
69 const Vc::SimdArray<T,N,V,M> & v1,
70 const Vc::SimdArray<T,N,V,M> & v2)
72 return std::move(Vc::iif(b, v1, v2));
82 template<
typename T,
typename A>
88 template<
typename T, std::
size_t N,
typename V, std::
size_t M>
89 double max_value(
const Vc::SimdArray<T,N,V,M> & v)
94 template<
typename T,
typename A>
100 template<
typename T, std::
size_t N,
typename V, std::
size_t M>
101 double min_value(
const Vc::SimdArray<T,N,V,M> & v)
106 template<
typename T,
typename A>
107 bool any_true(
const Vc::Mask<T,A> & v)
109 return Vc::any_of(v);
112 template<
typename T, std::
size_t N,
typename V, std::
size_t M>
113 bool any_true(
const Vc::SimdMaskArray<T,N,V,M> & v)
115 return Vc::any_of(v);
118 template<
typename T,
typename A>
119 bool all_true(
const Vc::Mask<T,A> & v)
121 return Vc::all_of(v);
124 template<
typename T, std::
size_t N,
typename V, std::
size_t M>
125 bool all_true(
const Vc::SimdMaskArray<T,N,V,M> & v)
127 return Vc::all_of(v);
bool any_true(const T &v)
similar to std::bitset<N>::any() return true, if any entries is true
Definition: rangeutilities.hh:66
bool all_true(const T &v)
similar to std::bitset<N>::all() return true, if any entries is true
Definition: rangeutilities.hh:90
T::value_type min_value(const T &v)
compute the minimum value over a range
Definition: rangeutilities.hh:50
T::value_type max_value(const T &v)
compute the maximum value over a range
Definition: rangeutilities.hh:33
Dune namespace.
Definition: alignment.hh:11
const T1 cond(bool b, const T1 &v1, const T2 &v2)
conditional evaluate
Definition: conditional.hh:26
Utilities for reduction like operations on ranges.