From 299b51b99891008f22eb810767b18b82da3c12e0 Mon Sep 17 00:00:00 2001 From: AlexG31 Date: Fri, 4 Nov 2016 18:06:37 +0800 Subject: [PATCH] bug fix: arange (when step < 0) Previous arange function have bug when called like arange(10, 1, -1) --- smop/core.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/smop/core.py b/smop/core.py index 58bac9b8..4d694d5c 100644 --- a/smop/core.py +++ b/smop/core.py @@ -361,8 +361,9 @@ def arange(start,stop,step=1,**kwargs): >>> size(a) matlabarray([[ 1, 10]]) """ + expand_value = 1 if step > 0 else -1 return matlabarray(np.arange(start, - stop+1, + stop+expand_value, step, **kwargs).reshape(1,-1),**kwargs) def cat(*args):