[arrayfire] 137/408: BUGFIX/TEST: Fixing not for C API. Added relevant tests.

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Sep 21 19:11:39 UTC 2015


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

ghisvail-guest pushed a commit to branch debian/sid
in repository arrayfire.

commit e7d75bec1b275023fcf216b1b8ca3008b9c8645e
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Mon Jul 13 13:37:12 2015 -0400

    BUGFIX/TEST: Fixing not for C API. Added relevant tests.
    
    - Made sure the CPP API is calling C API
---
 src/api/c/unary.cpp   |  2 +-
 src/api/cpp/array.cpp |  3 +--
 test/math.cpp         | 15 +++++++++++++++
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/api/c/unary.cpp b/src/api/c/unary.cpp
index f1e86ff..2b8cc1d 100644
--- a/src/api/c/unary.cpp
+++ b/src/api/c/unary.cpp
@@ -113,7 +113,7 @@ af_err af_not(af_array *out, const af_array in)
                              in_info.ndims(),
                              in_info.dims().get(), in_info.getType()));
 
-        AF_CHECK(af_neq(out, in, tmp, false));
+        AF_CHECK(af_eq(out, in, tmp, false));
 
         AF_CHECK(af_release_array(tmp));
     } CATCHALL;
diff --git a/src/api/cpp/array.cpp b/src/api/cpp/array.cpp
index 036db49..ba46f63 100644
--- a/src/api/cpp/array.cpp
+++ b/src/api/cpp/array.cpp
@@ -919,8 +919,7 @@ namespace af
     {
         af_array lhs = this->get();
         af_array out;
-        array cst = constant(0, this->dims(), this->type());
-        AF_THROW(af_eq(&out, cst.get(), lhs, gforGet()));
+        AF_THROW(af_not(&out, lhs));
         return array(out);
     }
 
diff --git a/test/math.cpp b/test/math.cpp
index e5dbe76..007054b 100644
--- a/test/math.cpp
+++ b/test/math.cpp
@@ -105,3 +105,18 @@ MATH_TESTS_DOUBLE(log2)
 MATH_TESTS_LIMITS(double, double, abs, dbl_err, -10, 10)
 MATH_TESTS_LIMITS(double, double, ceil, dbl_err, -10, 10)
 MATH_TESTS_LIMITS(double, double, floor, dbl_err, -10, 10)
+
+TEST(MathTests, Not)
+{
+    af::array a = af::randu(5, 5, b8);
+    af::array b = !a;
+    char *ha = a.host<char>();
+    char *hb = b.host<char>();
+
+    for(int i = 0; i < a.elements(); i++) {
+        ASSERT_EQ(ha[i] ^ hb[i], true);
+    }
+
+    delete[] ha;
+    delete[] hb;
+}

-- 
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