summaryrefslogtreecommitdiff
path: root/src/utilities
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2017-01-18 21:29:59 +0100
committerCedric Nugteren <web@cedricnugteren.nl>2017-01-18 21:29:59 +0100
commitdf9a77d74d87fb8832264e9e9a37336001873151 (patch)
tree516e113140164daa0d918803dee64b94b685afb6 /src/utilities
parent4b3ffd998904f5c848edc5917308f5942fa71da3 (diff)
Added first version of the TRSM routine based on the diagonal invert kernel
Diffstat (limited to 'src/utilities')
-rw-r--r--src/utilities/utilities.cpp24
-rw-r--r--src/utilities/utilities.hpp4
2 files changed, 28 insertions, 0 deletions
diff --git a/src/utilities/utilities.cpp b/src/utilities/utilities.cpp
index b8e011c5..663fdffa 100644
--- a/src/utilities/utilities.cpp
+++ b/src/utilities/utilities.cpp
@@ -94,6 +94,30 @@ double2 ConstantOne() {
return {1.0, 0.0};
}
+// Returns a scalar of value -1
+template <typename T>
+T ConstantNegOne() {
+ return static_cast<T>(-1.0);
+}
+template float ConstantNegOne<float>();
+template double ConstantNegOne<double>();
+
+// Specialized version of the above for half-precision
+template <>
+half ConstantNegOne() {
+ return FloatToHalf(-1.0f);
+}
+
+// Specialized versions of the above for complex data-types
+template <>
+float2 ConstantNegOne() {
+ return {-1.0f, 0.0f};
+}
+template <>
+double2 ConstantNegOne() {
+ return {-1.0, 0.0};
+}
+
// =================================================================================================
// Implements the string conversion using std::to_string if possible
diff --git a/src/utilities/utilities.hpp b/src/utilities/utilities.hpp
index 26dee23b..3e408bb7 100644
--- a/src/utilities/utilities.hpp
+++ b/src/utilities/utilities.hpp
@@ -110,6 +110,10 @@ T ConstantZero();
template <typename T>
T ConstantOne();
+// Returns a scalar of value -1
+template <typename T>
+T ConstantNegOne();
+
// =================================================================================================
// Structure containing all possible arguments for test clients, including their default values