diff options
author | Cedric Nugteren <web@cedricnugteren.nl> | 2017-03-04 15:21:33 +0100 |
---|---|---|
committer | Cedric Nugteren <web@cedricnugteren.nl> | 2017-03-04 15:21:33 +0100 |
commit | e993ee077b50d3a6134309d465a4174b5c749596 (patch) | |
tree | b967f2702b90d8080a3e3cb41b9cbc01ab9eddc3 /src/utilities/utilities.hpp | |
parent | 3fc73851f7ed885335940eb85e53069638567323 (diff) |
Added a proper data-preparation function for the TRSM tests
Diffstat (limited to 'src/utilities/utilities.hpp')
-rw-r--r-- | src/utilities/utilities.hpp | 13 |
1 files changed, 10 insertions, 3 deletions
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 <typename T> struct BaseType { using Type = T; }; +template <> struct BaseType<float2> { using Type = float; }; +template <> struct BaseType<double2> { using Type = double; }; + +// ================================================================================================= + // Returns a scalar with a default value template <typename T> T GetScalar(); @@ -105,11 +112,11 @@ template <typename T> T GetScalar(); template <typename T> T ConstantZero(); template <typename T> T ConstantOne(); template <typename T> T ConstantNegOne(); -template <typename T> T ConstantTwo(); +template <typename T> T Constant(const double val); template <typename T> T SmallConstant(); -// Returns the absolute value of a scalar -template <typename T> T AbsoluteValue(const T value); +// Returns the absolute value of a scalar (modulus in case of complex numbers) +template <typename T> typename BaseType<T>::Type AbsoluteValue(const T value); // Returns whether a scalar is close to zero template <typename T> bool IsCloseToZero(const T value); |