summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2018-07-31 21:44:28 +0200
committerCedric Nugteren <web@cedricnugteren.nl>2018-07-31 21:44:28 +0200
commit391e5757bdfbd37b7d15b6834a90749813a93369 (patch)
treeb0fb245b03523adfaef6c71b307cde9b5026b9b5 /test
parent713d0f96b3dda04cbd9a2c5da3cb283a2d2719e0 (diff)
Fixed the tests of OMATCOPY to include proper complex conjugation
Diffstat (limited to 'test')
-rw-r--r--test/routines/levelx/xomatcopy.hpp4
-rw-r--r--test/test_utilities.cpp10
-rw-r--r--test/test_utilities.hpp4
3 files changed, 17 insertions, 1 deletions
diff --git a/test/routines/levelx/xomatcopy.hpp b/test/routines/levelx/xomatcopy.hpp
index ea35dbe2..4a93b29d 100644
--- a/test/routines/levelx/xomatcopy.hpp
+++ b/test/routines/levelx/xomatcopy.hpp
@@ -45,7 +45,9 @@ StatusCode RunReference(const Arguments<T> &args, BuffersHost<T> &buffers_host)
const auto b_two = (b_rotated) ? id1 : id2;
const auto a_index = a_two * args.a_ld + a_one + args.a_offset;
const auto b_index = b_two * args.b_ld + b_one + args.b_offset;
- buffers_host.b_mat[b_index] = args.alpha * buffers_host.a_mat[a_index];
+ auto a_value = buffers_host.a_mat[a_index];
+ if (args.a_transpose == Transpose::kConjugate) { a_value = ComplexConjugate(a_value); }
+ buffers_host.b_mat[b_index] = args.alpha * a_value;
}
}
return StatusCode::kSuccess;
diff --git a/test/test_utilities.cpp b/test/test_utilities.cpp
index 59ec949d..c43200b9 100644
--- a/test/test_utilities.cpp
+++ b/test/test_utilities.cpp
@@ -31,6 +31,16 @@ template <> bool IsCloseToZero(const double2 value) { return IsCloseToZero(value
// =================================================================================================
+// Performs a complex conjugate if complex
+template <typename T> T ComplexConjugate(const T value) { return value; }
+template half ComplexConjugate(const half);
+template float ComplexConjugate(const float);
+template double ComplexConjugate(const double);
+template <> float2 ComplexConjugate(const float2 value) { return float2{value.real(), -value.imag()}; }
+template <> double2 ComplexConjugate(const double2 value) { return double2{value.real(), -value.imag()}; }
+
+// =================================================================================================
+
template <typename T, typename U>
void DeviceToHost(const Arguments<U> &args, Buffers<T> &buffers, BuffersHost<T> &buffers_host,
Queue &queue, const std::vector<std::string> &names) {
diff --git a/test/test_utilities.hpp b/test/test_utilities.hpp
index 42660bdb..7bf5e65f 100644
--- a/test/test_utilities.hpp
+++ b/test/test_utilities.hpp
@@ -70,6 +70,10 @@ struct BuffersHost {
// =================================================================================================
+template <typename T> T ComplexConjugate(const T value);
+
+// =================================================================================================
+
// Converts a value (e.g. an integer) to a string. This also covers special cases for CLBlast
// data-types such as the Layout and Transpose data-types.
template <typename T>