[arrayfire] 95/248: Specilization for Binary functor for cdouble type in cpu backend

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Tue Nov 17 15:54:08 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch dfsg-clean
in repository arrayfire.

commit 5c012ec4051dfb2cd5c7b4d5b77d939fdeef4a99
Author: pradeep <pradeep at arrayfire.com>
Date:   Wed Sep 30 11:55:49 2015 -0400

    Specilization for Binary functor for cdouble type in cpu backend
    
    Lack of this specilization is resulting in SEH access violation
    exception on Windows platform. For some reason, non-member function
    operator+ for std::complex<double> is causing this SEH exception.
---
 src/backend/cpu/reduce.cpp | 14 ++++++++++++++
 test/mean.cpp              |  2 +-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/backend/cpu/reduce.cpp b/src/backend/cpu/reduce.cpp
index 30dee5c..a38d061 100644
--- a/src/backend/cpu/reduce.cpp
+++ b/src/backend/cpu/reduce.cpp
@@ -18,6 +18,20 @@
 
 using af::dim4;
 
+template<>
+struct Binary<cdouble, af_add_t>
+{
+    cdouble init()
+    {
+        return cdouble(0,0);
+    }
+
+    cdouble operator()(cdouble lhs, cdouble rhs)
+    {
+        return cdouble(real(lhs)+real(rhs), imag(lhs)+imag(rhs));
+    }
+};
+
 namespace cpu
 {
     template<af_op_t op, typename Ti, typename To, int D>
diff --git a/test/mean.cpp b/test/mean.cpp
index a39f540..e3f7031 100644
--- a/test/mean.cpp
+++ b/test/mean.cpp
@@ -305,5 +305,5 @@ void weightedMeanAllTest(af::dim4 dims)
 
 TYPED_TEST(WeightedMean, Basic)
 {
-    weightedMeanAllTest<TypeParam, float>(af::dim4(66, 66, 31, 17));
+    weightedMeanAllTest<TypeParam, float>(af::dim4(32, 30, 33, 17));
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git



More information about the debian-science-commits mailing list