[python-arrayfire] 82/250: BUGFIX: Comparing ctype ints was causing incorrect implicit types

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Mar 28 22:59:34 UTC 2016


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

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

commit 3075fe4991475a3f6be9fec9a2752ed3e5bb6d36
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Mon Aug 31 07:31:22 2015 -0400

    BUGFIX: Comparing ctype ints was causing incorrect implicit types
---
 arrayfire/array.py |  7 +++++--
 arrayfire/util.py  | 13 +++++++++++--
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/arrayfire/array.py b/arrayfire/array.py
index 21a6eb0..9657e72 100644
--- a/arrayfire/array.py
+++ b/arrayfire/array.py
@@ -196,10 +196,13 @@ class Array(BaseArray):
         safe_call(clib.af_get_elements(ct.pointer(num), self.arr))
         return num.value
 
-    def type(self):
+    def dtype(self):
         dty = ct.c_int(f32.value)
         safe_call(clib.af_get_type(ct.pointer(dty), self.arr))
-        return dty.value
+        return dty
+
+    def type(self):
+        return self.dtype().value
 
     def dims(self):
         d0 = ct.c_longlong(0)
diff --git a/arrayfire/util.py b/arrayfire/util.py
index c130959..04ac95d 100644
--- a/arrayfire/util.py
+++ b/arrayfire/util.py
@@ -36,10 +36,19 @@ def number_dtype(a):
 
 def implicit_dtype(number, a_dtype):
     n_dtype = number_dtype(number)
-    if n_dtype == f64 and (a_dtype == f32 or a_dtype == c32):
+    n_value = n_dtype.value
+
+    f64v = f64.value
+    f32v = f32.value
+    c32v = c32.value
+    c64v = c64.value
+
+    if n_value == f64v and (a_dtype == f32v or a_dtype == c32v):
         return f32
-    if n_dtype == c64 and (a_dtype == f32 or a_dtype == c32):
+
+    if n_value == c64v and (a_dtype == f32v or a_dtype == c32v):
         return c32
+
     return n_dtype
 
 def dim4_tuple(dims, default=1):

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



More information about the debian-science-commits mailing list