@@ -169,18 +169,19 @@ def time_count_nonzero_multi_axis(self, numaxes, size, dtype):
169
169
np .count_nonzero (self .x , axis = (
170
170
self .x .ndim - 1 , self .x .ndim - 2 ))
171
171
172
+
172
173
class Nonzero (Benchmark ):
173
174
params = [
174
- [bool , np .uint8 , np .uint64 , np .int64 , np .float32 , np .float64 ],
175
- [(1_000_000 ,), (1000 , 1000 ), (100 , ), (2 , )]
175
+ [bool , np .uint8 , np .uint64 , np .int64 , np .float32 , np .float64 ],
176
+ [(1_000_000 ,), (1000 , 1000 ), (100 , ), (2 , )]
176
177
]
177
178
param_names = ["dtype" , "shape" ]
178
179
179
180
def setup (self , dtype , size ):
180
181
self .x = np .random .randint (0 , 3 , size = size ).astype (dtype )
181
182
self .x_sparse = np .zeros (size = size ).astype (dtype )
182
- self .x_sparse [1 ] = 1
183
- self .x_sparse [- 1 ] = 1
183
+ self .x_sparse [1 ] = 1
184
+ self .x_sparse [- 1 ] = 1
184
185
self .x_dense = np .ones (size = size ).astype (dtype )
185
186
186
187
def time_nonzero (self , dtype , size ):
@@ -192,9 +193,11 @@ def time_nonzero_sparse(self, dtype, size):
192
193
def time_nonzero_dense (self , dtype , size ):
193
194
np .nonzero (self .x_dense )
194
195
196
+
195
197
class PackBits (Benchmark ):
196
198
param_names = ['dtype' ]
197
199
params = [[bool , np .uintp ]]
200
+
198
201
def setup (self , dtype ):
199
202
self .d = np .ones (10000 , dtype = dtype )
200
203
self .d2 = np .ones ((200 , 1000 ), dtype = dtype )
0 commit comments