summaryrefslogtreecommitdiff
path: root/src/utilities/utilities.cpp
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2017-01-15 17:30:00 +0100
committerCedric Nugteren <web@cedricnugteren.nl>2017-01-15 17:30:00 +0100
commit4b3ffd998904f5c848edc5917308f5942fa71da3 (patch)
treef264f9e0fe241fdbe25b623c4208da222a99d973 /src/utilities/utilities.cpp
parent4a4be0c3a5e603a9c0c4c7aebcb660b5e62b99ad (diff)
Added a first version of the diagonal block invert routine in preparation of TRSM
Diffstat (limited to 'src/utilities/utilities.cpp')
-rw-r--r--src/utilities/utilities.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/utilities/utilities.cpp b/src/utilities/utilities.cpp
index 5e445bb9..b8e011c5 100644
--- a/src/utilities/utilities.cpp
+++ b/src/utilities/utilities.cpp
@@ -46,6 +46,30 @@ double2 GetScalar() {
return {2.0, 0.5};
}
+// Returns a scalar of value 0
+template <typename T>
+T ConstantZero() {
+ return static_cast<T>(0.0);
+}
+template float ConstantZero<float>();
+template double ConstantZero<double>();
+
+// Specialized version of the above for half-precision
+template <>
+half ConstantZero() {
+ return FloatToHalf(0.0f);
+}
+
+// Specialized versions of the above for complex data-types
+template <>
+float2 ConstantZero() {
+ return {0.0f, 0.0f};
+}
+template <>
+double2 ConstantZero() {
+ return {0.0, 0.0};
+}
+
// Returns a scalar of value 1
template <typename T>
T ConstantOne() {