// -*- C++ -*- /** @file */ #pragma once /** \addtogroup ARCHALG Architecture specific algorithm * \ingroup DSPPP * \addtogroup SCALARALG Scalar algorithm * \ingroup ARCHALG * @{ */ #define SCALAR_UNROLL 2 /** * @brief Fill evaluator for scalar architecture * * @param v Destination vector * @param[in] val Initialization value * @param[in] l Length of vector * * @tparam T Scalar datatype * @tparam DST VEctor / Matrix datatype * @tparam Test to restrict to vector addressing * and compatible datatype * */ template::value && SameElementType::value,bool>::type = true> inline void _Fill(DST &v, const T val, vector_length_t l, const Scalar* = nullptr) { constexpr unsigned int U = SCALAR_UNROLL; index_t i; UNROLL_LOOP for(i=0 ; i <= l-(1< Check DST has matrix indexing only */ template() && SameElementType::value,bool>::type = true> inline void _Fill2D(DST &v, const T val, const vector_length_t rows, const vector_length_t cols, const Scalar* = nullptr) { constexpr unsigned int U = SCALAR_UNROLL; index_t row=0; for(; row <= rows-(1< Check vectors are compatible */ template(),bool>::type = true> inline void eval(DA &v, const DB& other, const vector_length_t l, const Scalar* = nullptr) { constexpr unsigned int U = SCALAR_UNROLL; index_t i=0; for(i=0 ; i <= l-(1< Check only support matrix indexing */ template(),bool>::type = true> inline void eval2D(DA &v, const DB& other, const vector_length_t rows, const vector_length_t cols, const Scalar* = nullptr) { constexpr unsigned int U = SCALAR_UNROLL; index_t row=0; for(; row <= rows-(1< Check vector expressions are compatible * * @return Dot product result */ template(),bool>::type = true> inline DotResult _dot(const DA& a, const DB& b, const vector_length_t l, const Scalar* = nullptr) { using Acc = DotResult; constexpr unsigned int U = SCALAR_UNROLL; index_t i; Acc acc = Acc{}; for(i=0 ; i <= l-(1< Check vectors are compatible */ template(),bool>::type = true> inline void _swap(DA&& a, DB&& b, const vector_length_t l, const Scalar* = nullptr) { for(index_t i=0;i