[python-arrayfire] 43/250: BUGFIX: Fixing the dimension lengths when negative indices are used

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Mar 28 22:59:29 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 b8d1ae38596a9dffcb3c3b589b57b571b32202f5
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Fri Jul 17 12:30:26 2015 -0400

    BUGFIX: Fixing the dimension lengths when negative indices are used
---
 arrayfire/array.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arrayfire/array.py b/arrayfire/array.py
index 42b5dec..c2450bb 100644
--- a/arrayfire/array.py
+++ b/arrayfire/array.py
@@ -102,7 +102,7 @@ class seq(ct.Structure):
             if (S.start is not None):
                 self.begin = ct.c_double(S.start)
             if (S.stop is not None):
-                self.end   = ct.c_double(S.stop - 1) if S.stop >= 0 else ct.c_double(S.stop)
+                self.end   = ct.c_double(S.stop - 1)
             if (S.step is not None):
                 self.step  = ct.c_double(S.step)
         else:
@@ -134,12 +134,12 @@ def get_indices(key, n_dims):
     inds = index_vec()
 
     for n in range(n_dims):
-        inds[n] = index(slice(0, -1))
+        inds[n] = index(slice(None))
 
     if isinstance(key, tuple):
-        num_idx = len(key)
-        for n in range(n_dims):
-            inds[n] = index(key[n]) if (n < num_idx) else index(slice(0, -1))
+        n_idx = len(key)
+        for n in range(n_idx):
+            inds[n] = index(key[n])
     else:
         inds[0] = index(key)
 

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