[python-arrayfire] 23/250: Simplifying the array constructor using python maps
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Mon Mar 28 22:59:26 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 80ab970189b03520b4a56a717f51d0bb402ea41b
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date: Mon Jun 22 13:16:22 2015 -0400
Simplifying the array constructor using python maps
---
arrayfire/array.py | 17 +----------------
arrayfire/util.py | 10 ++++++++++
2 files changed, 11 insertions(+), 16 deletions(-)
diff --git a/arrayfire/array.py b/arrayfire/array.py
index 99e1e38..7ba83dc 100644
--- a/arrayfire/array.py
+++ b/arrayfire/array.py
@@ -105,22 +105,7 @@ class array(object):
idims = [buf_len, 1, 1, 1]
numdims = 1
- if type_char == 'f':
- dtype = f32
- elif type_char == 'd':
- dtype = f64
- elif type_char == 'b':
- dtype = b8
- elif type_char == 'B':
- dtype = u8
- elif type_char == 'i':
- dtype = s32
- elif type_char == 'I':
- dtype = u32
- elif type_char == 'l':
- dtype = s64
- elif type_char == 'L':
- dtype = u64
+ dtype = to_dtype[type_char]
self.arr = create_array(buf, numdims, idims, dtype)
diff --git a/arrayfire/util.py b/arrayfire/util.py
index 01d0020..a1b8586 100644
--- a/arrayfire/util.py
+++ b/arrayfire/util.py
@@ -30,3 +30,13 @@ def safe_call(af_error):
c_err_len = c_longlong(0)
clib.af_get_last_error(pointer(c_err_str), pointer(c_err_len))
raise RuntimeError(to_str(c_err_str), af_error)
+
+
+to_dtype = {'f' : f32,
+ 'd' : f64,
+ 'b' : b8,
+ 'B' : u8,
+ 'i' : s32,
+ 'I' : u32,
+ 'l' : s64,
+ 'L' : u64}
--
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