36 #ifndef NEKTAR_LIB_LIBUTILITES_SIMDLIB_SCALAR_H
37 #define NEKTAR_LIB_LIBUTILITES_SIMDLIB_SCALAR_H
42 #include <type_traits>
53 template <
typename scalarType>
63 template<
typename T,
typename =
typename std::enable_if<
64 std::is_arithmetic<T>::value>::type>
88 template<
typename T,
typename>
91 static constexpr
unsigned int width = 1;
92 static constexpr
unsigned int alignment =
sizeof(T);
135 template<
typename U,
typename =
typename std::enable_if<
136 std::is_integral<U>::value>::type>
142 template<
typename U,
typename =
typename std::enable_if<
143 std::is_integral<U>::value>::type>
196 template<
typename T,
typename U,
typename =
typename std::enable_if<
197 std::is_arithmetic<U>::value>::type>
200 return lhs + rhs.
_data;
202 template<
typename T,
typename U,
typename =
typename std::enable_if<
203 std::is_arithmetic<U>::value>::type>
206 return lhs.
_data + rhs;
215 template<
typename T,
typename U,
typename =
typename std::enable_if<
216 std::is_arithmetic<U>::value>::type>
219 return lhs - rhs.
_data;
221 template<
typename T,
typename U,
typename =
typename std::enable_if<
222 std::is_arithmetic<U>::value>::type>
225 return lhs.
_data - rhs;
234 template<
typename T,
typename U,
typename =
typename std::enable_if<
235 std::is_arithmetic<U>::value>::type>
238 return lhs * rhs.
_data;
240 template<
typename T,
typename U,
typename =
typename std::enable_if<
241 std::is_arithmetic<U>::value>::type>
244 return lhs.
_data * rhs;
253 template<
typename T,
typename U,
typename =
typename std::enable_if<
254 std::is_arithmetic<U>::value>::type>
257 return lhs / rhs.
_data;
259 template<
typename T,
typename U,
typename =
typename std::enable_if<
260 std::is_arithmetic<U>::value>::type>
263 return lhs.
_data / rhs;
289 for (
size_t i = 0; i < dataLen; ++i)
301 for (
size_t i = 0; i < dataLen; ++i)
303 out[i] = in[i]._data;
331 return lhs.
_data && rhs;
scalarT< T > log(scalarT< T > in)
scalarT< T > operator+(scalarT< T > lhs, scalarT< T > rhs)
void deinterleave_store(const std::vector< scalarT< T >, allocator< scalarT< T >>> &in, size_t dataLen, T *out)
scalarT< T > operator-(scalarT< T > lhs, scalarT< T > rhs)
scalarT< T > abs(scalarT< T > in)
boost::alignment::aligned_allocator< T, T::alignment > allocator
scalarMask operator>(scalarT< double > lhs, scalarT< double > rhs)
void load_interleave(const T *in, size_t dataLen, std::vector< scalarT< T >, allocator< scalarT< T >>> &out)
bool operator&&(scalarMask lhs, bool rhs)
scalarT< T > sqrt(scalarT< T > in)
scalarT< T > operator/(scalarT< T > lhs, scalarT< T > rhs)
scalarT< T > operator*(scalarT< T > lhs, scalarT< T > rhs)
static constexpr scalarType false_v
static constexpr scalarType true_v
void store(scalarType *p) const
scalarT(const scalarT &rhs)=default
void gather(const scalarType *p, const scalarT< U > &indices)
static constexpr unsigned int alignment
void broadcast(const scalarType rhs)
scalarType & operator[](size_t)
scalarType operator[](size_t) const
void operator/=(scalarT< T > rhs)
scalarType[width] scalarArray
void load(const scalarType *p, flag)
void operator+=(scalarT< T > rhs)
scalarT(const vectorType &rhs)
static constexpr unsigned int width
void fma(const scalarT< T > &a, const scalarT< T > &b)
void operator-=(scalarT< T > rhs)
void load(const scalarType *p)
void operator*=(scalarT< T > rhs)
void store(scalarType *p, flag) const
void scatter(scalarType *p, const scalarT< U > &indices) const