[python-arrayfire] 59/250: Derive the dtype directly from the number

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Mar 28 22:59:31 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 9706463555284cfd5f3174a3a3ddb3cc1453c69c
Author: Filipe Maia <filipe.c.maia at gmail.com>
Date:   Thu Aug 27 22:40:17 2015 +0200

    Derive the dtype directly from the number
---
 arrayfire/arith.py | 8 ++++----
 arrayfire/array.py | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arrayfire/arith.py b/arrayfire/arith.py
index 960ed17..5a0fb47 100644
--- a/arrayfire/arith.py
+++ b/arrayfire/arith.py
@@ -25,16 +25,16 @@ def arith_binary_func(lhs, rhs, c_func):
 
     elif (is_number(rhs)):
         ldims = dim4_tuple(lhs.dims())
-        lty = lhs.type()
+        rty = number_dtype(rhs)
         other = array()
-        other.arr = constant_array(rhs, ldims[0], ldims[1], ldims[2], ldims[3], lty)
+        other.arr = constant_array(rhs, ldims[0], ldims[1], ldims[2], ldims[3], rty)
         safe_call(c_func(ct.pointer(out.arr), lhs.arr, other.arr, bcast.get()))
 
     else:
         rdims = dim4_tuple(rhs.dims())
-        rty = rhs.type()
+        lty = number_dtype(lhs)
         other = array()
-        other.arr = constant_array(lhs, rdims[0], rdims[1], rdims[2], rdims[3], rty)
+        other.arr = constant_array(lhs, rdims[0], rdims[1], rdims[2], rdims[3], lty)
         safe_call(c_func(ct.pointer(out.arr), other.arr, rhs.arr, bcast.get()))
 
     return out
diff --git a/arrayfire/array.py b/arrayfire/array.py
index 6dc626e..39addab 100644
--- a/arrayfire/array.py
+++ b/arrayfire/array.py
@@ -60,9 +60,9 @@ def binary_func(lhs, rhs, c_func):
 
     if (is_number(rhs)):
         ldims = dim4_tuple(lhs.dims())
-        lty = lhs.type()
+        rty = number_dtype(rhs)
         other = array()
-        other.arr = constant_array(rhs, ldims[0], ldims[1], ldims[2], ldims[3], lty)
+        other.arr = constant_array(rhs, ldims[0], ldims[1], ldims[2], ldims[3], rty)
     elif not isinstance(rhs, array):
         raise TypeError("Invalid parameter to binary function")
 
@@ -76,9 +76,9 @@ def binary_funcr(lhs, rhs, c_func):
 
     if (is_number(lhs)):
         rdims = dim4_tuple(rhs.dims())
-        rty = rhs.type()
+        lty = number_dtype(lhs)
         other = array()
-        other.arr = constant_array(lhs, rdims[0], rdims[1], rdims[2], rdims[3], rty)
+        other.arr = constant_array(lhs, rdims[0], rdims[1], rdims[2], rdims[3], lty)
     elif not isinstance(lhs, array):
         raise TypeError("Invalid parameter to binary function")
 

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