#ifndef included_FunctionTable #define included_FunctionTable #include "common/Array.h" #include /*! * Class FunctionTable is a serial function table class that defines * a series of operations that can be performed on the Array class. * Users can impliment additional versions of the function table that match * the interface to change the behavior of the array class. */ class FunctionTable final { public: /*! * Initialize the array with random values * @param[in] x The array to operate on */ template static void rand( Array &x ); /*! * Perform a reduce operator y = f(x) * @param[in] op The function operation * Note: the operator is a template parameter * (compared to a std::function to improve performance) * @param[in] A The array to operate on * @return The reduction */ template static inline TYPE reduce( LAMBDA &op, const Array &A ); /*! * Perform a element-wise operation y = f(x) * @param[in] fun The function operation * Note: the operator is a template parameter * (compared to a std::function to improve performance) * @param[in] x The input array to operate on * @param[out] y The output array */ template static inline void transform( LAMBDA &fun, const Array &x, Array &y ); /*! * Perform a element-wise operation z = f(x,y) * @param[in] fun The function operation * Note: the operator is a template parameter * (compared to a std::function to improve performance) * @param[in] x The first array * @param[in] y The second array * @param[out] z The result */ template static inline void transform( LAMBDA &fun, const Array &x, const Array &y, Array &z ); /*! * Multiply two arrays * @param[in] a The first array * @param[in] b The second array * @param[out] c The output array */ template static void multiply( const Array &a, const Array &b, Array &c ); private: FunctionTable(); template static inline void rand( size_t N, T *x ); }; #include "common/FunctionTable.hpp" #endif