@@ -58,20 +58,23 @@ def getitem(x, key):
58
58
count += 1
59
59
60
60
reordered_key = [key [i ] for i in x .axis_order ]
61
-
61
+
62
+ # prepare for converting to flat indices
63
+ for i , ind in enumerate (reordered_key [:x .axisptr ]):
64
+ if isinstance (ind ,slice ):
65
+ reordered_key [i ] = range (ind .start ,ind .stop ,ind .step )
66
+ for i , ind in enumerate (reordered_key [x .axisptr :]):
67
+ if isinstance (ind , Integral ):
68
+ reordered_key [i + x .axisptr ] = [ind ]
69
+ elif isinstance (ind , slice ):
70
+ reordered_key [i + x .axisptr ] = np .arange (ind .start , ind .stop , ind .step )
71
+
62
72
# find starts and ends of rows
63
73
a = x .indptr [:- 1 ].reshape (x .reordered_shape [:x .axisptr ])
64
74
b = x .indptr [1 :].reshape (x .reordered_shape [:x .axisptr ])
65
75
starts = a [tuple (reordered_key [:x .axisptr ])].flatten ()
66
76
ends = b [tuple (reordered_key [:x .axisptr ])].flatten ()
67
77
68
- # prepare for converting to flat indices
69
- for i , ind in enumerate (reordered_key ):
70
- if isinstance (ind , Integral ):
71
- reordered_key [i ] = [ind ]
72
- elif isinstance (ind , slice ):
73
- reordered_key [i ] = np .arange (ind .start , ind .stop , ind .step )
74
-
75
78
shape = np .array (shape )
76
79
77
80
cols = convert_to_flat (reordered_key , x .reordered_shape , x .axisptr )
0 commit comments