summaryrefslogtreecommitdiff
path: root/src/kernels
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2017-02-26 10:18:45 +0100
committerCedric Nugteren <web@cedricnugteren.nl>2017-02-26 10:18:45 +0100
commita433987441e09684fb7b6f6c75962fd128cbfdbd (patch)
tree62d01f4d57ad67d0f90fd4a5e70b8c78505ef9c1 /src/kernels
parentccac957f1735354fc1ad06a6e329c1cdabbad969 (diff)
Fixes division in the kernel for inversion of complex numbers
Diffstat (limited to 'src/kernels')
-rw-r--r--src/kernels/common.opencl7
-rw-r--r--src/kernels/level3/invert_diagonal_blocks.opencl2
2 files changed, 1 insertions, 8 deletions
diff --git a/src/kernels/common.opencl b/src/kernels/common.opencl
index 0ce4f367..32e3fbb9 100644
--- a/src/kernels/common.opencl
+++ b/src/kernels/common.opencl
@@ -212,13 +212,6 @@ R"(
#define MultiplySubtract(c, a, b) c -= a * b
#endif
-// The scalar division function: real-value only
-#if PRECISION == 3232 || PRECISION == 6464
- #define DivideReal(c, a, b) c.x = a.x / b.x; c.y = a.y
-#else
- #define DivideReal(c, a, b) c = a / b
-#endif
-
// The scalar division function: full division
#if PRECISION == 3232 || PRECISION == 6464
#define DivideFull(c, a, b) singlereal num_x = (a.x * b.x) + (a.y * b.y); singlereal num_y = (a.y * b.x) - (a.x * b.y); singlereal denom = (b.x * b.x) + (b.y * b.y); c.x = num_x / denom; c.y = num_y / denom
diff --git a/src/kernels/level3/invert_diagonal_blocks.opencl b/src/kernels/level3/invert_diagonal_blocks.opencl
index d43b9b7c..c59bcbcb 100644
--- a/src/kernels/level3/invert_diagonal_blocks.opencl
+++ b/src/kernels/level3/invert_diagonal_blocks.opencl
@@ -102,7 +102,7 @@ void InvertDiagonalBlock(int n, __global const real* restrict src, const int src
if (!IsZero(diagonal_value)) { // Only for non-singular values and values inside the matrix
real constant_one;
SetToOne(constant_one);
- DivideReal(inverted_diagonal, constant_one, diagonal_value);
+ DivideFull(inverted_diagonal, constant_one, diagonal_value);
}
}
lm[thread_index][thread_index] = inverted_diagonal;