From e993ee077b50d3a6134309d465a4174b5c749596 Mon Sep 17 00:00:00 2001 From: Cedric Nugteren Date: Sat, 4 Mar 2017 15:21:33 +0100 Subject: Added a proper data-preparation function for the TRSM tests --- src/utilities/utilities.hpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/utilities/utilities.hpp') diff --git a/src/utilities/utilities.hpp b/src/utilities/utilities.hpp index 044955ea..3c9be6a2 100644 --- a/src/utilities/utilities.hpp +++ b/src/utilities/utilities.hpp @@ -98,6 +98,13 @@ constexpr auto kArgNoAbbreviations = "no_abbrv"; // ================================================================================================= +// Converts a regular or complex type to it's base type (e.g. float2 to float) +template struct BaseType { using Type = T; }; +template <> struct BaseType { using Type = float; }; +template <> struct BaseType { using Type = double; }; + +// ================================================================================================= + // Returns a scalar with a default value template T GetScalar(); @@ -105,11 +112,11 @@ template T GetScalar(); template T ConstantZero(); template T ConstantOne(); template T ConstantNegOne(); -template T ConstantTwo(); +template T Constant(const double val); template T SmallConstant(); -// Returns the absolute value of a scalar -template T AbsoluteValue(const T value); +// Returns the absolute value of a scalar (modulus in case of complex numbers) +template typename BaseType::Type AbsoluteValue(const T value); // Returns whether a scalar is close to zero template bool IsCloseToZero(const T value); -- cgit v1.2.3