diff options
author | Cedric Nugteren <web@cedricnugteren.nl> | 2017-11-13 21:10:44 +0100 |
---|---|---|
committer | Cedric Nugteren <web@cedricnugteren.nl> | 2017-11-13 21:10:44 +0100 |
commit | 4bac1287f2d49bece72822bf6032e4da56a2dd2d (patch) | |
tree | 77fd5e9fad27179feabc80f97f9f8abf9bbc99d1 /test/correctness | |
parent | 677afd3b96b2cbd3d2aae77e90cab87d2cc1eaa2 (diff) |
Moved square-difference utility function for use in the tuners
Diffstat (limited to 'test/correctness')
-rw-r--r-- | test/correctness/tester.cpp | 31 | ||||
-rw-r--r-- | test/correctness/tester.hpp | 4 |
2 files changed, 0 insertions, 35 deletions
diff --git a/test/correctness/tester.cpp b/test/correctness/tester.cpp index a10736ea..d6a346a6 100644 --- a/test/correctness/tester.cpp +++ b/test/correctness/tester.cpp @@ -539,37 +539,6 @@ bool TestSimilarity(const half val1, const half val2) { // ================================================================================================= -// Retrieves the squared difference, used for example for computing the L2 error -template <typename T> -double SquaredDifference(const T val1, const T val2) { - const auto difference = (val1 - val2); - return static_cast<double>(difference * difference); -} - -// Compiles the default case for standard data-types -template double SquaredDifference<float>(const float, const float); -template double SquaredDifference<double>(const double, const double); - -// Specialisations for non-standard data-types -template <> -double SquaredDifference(const float2 val1, const float2 val2) { - const auto real = SquaredDifference(val1.real(), val2.real()); - const auto imag = SquaredDifference(val1.imag(), val2.imag()); - return real + imag; -} -template <> -double SquaredDifference(const double2 val1, const double2 val2) { - const auto real = SquaredDifference(val1.real(), val2.real()); - const auto imag = SquaredDifference(val1.imag(), val2.imag()); - return real + imag; -} -template <> -double SquaredDifference(const half val1, const half val2) { - return SquaredDifference(HalfToFloat(val1), HalfToFloat(val2)); -} - -// ================================================================================================= - // Retrieves a list of example scalar values, used for the alpha and beta arguments for the various // routines. This function is specialised for the different data-types. template <> const std::vector<float> GetExampleScalars(const bool full_test) { diff --git a/test/correctness/tester.hpp b/test/correctness/tester.hpp index 640f870a..7e17e53d 100644 --- a/test/correctness/tester.hpp +++ b/test/correctness/tester.hpp @@ -201,10 +201,6 @@ template <typename T> double getL2ErrorMargin(); template <typename T> bool TestSimilarity(const T val1, const T val2); -// Retrieves the squared difference, used for example for computing the L2 error -template <typename T> -double SquaredDifference(const T val1, const T val2); - // Retrieves a list of example scalar values, used for the alpha and beta arguments for the various // routines. This function is specialised for the different data-types. template <typename T> |