-
Notifications
You must be signed in to change notification settings - Fork 110
/
Copy pathmove.py
94 lines (66 loc) · 2.98 KB
/
move.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import bottleneck as bn
from .reduce import get_cached_rand_array
class Time1DMove:
params = [
["int32", "int64", "float32", "float64"],
[(10 ** 3,), (10 ** 5,), (10 ** 7,)],
[10],
]
param_names = ["dtype", "shape", "window"]
def setup(self, dtype, shape, window):
self.arr = get_cached_rand_array(shape, dtype, "C")
def time_move_sum(self, dtype, shape, window):
bn.move_sum(self.arr, window)
def time_move_mean(self, dtype, shape, window):
bn.move_mean(self.arr, window)
def time_move_std(self, dtype, shape, window):
bn.move_std(self.arr, window)
def time_move_var(self, dtype, shape, window):
bn.move_var(self.arr, window)
def time_move_min(self, dtype, shape, window):
bn.move_min(self.arr, window)
def time_move_max(self, dtype, shape, window):
bn.move_max(self.arr, window)
def time_move_argmin(self, dtype, shape, window):
bn.move_argmin(self.arr, window)
def time_move_argmax(self, dtype, shape, window):
bn.move_argmax(self.arr, window)
def time_move_median(self, dtype, shape, window):
bn.move_median(self.arr, window)
def time_move_quantile(self, dtype, shape, window):
bn.move_quantile(self.arr, window, q=0.25)
def time_move_rank(self, dtype, shape, window):
bn.move_rank(self.arr, window)
class Time2DMove:
params = [
["int32", "int64", "float32", "float64"],
[(10 ** 3, 10 ** 3)],
["C", "F"],
[0, 1],
[10],
]
param_names = ["dtype", "shape", "order", "axis", "window"]
def setup(self, dtype, shape, order, axis, window):
self.arr = get_cached_rand_array(shape, dtype, order)
def time_move_sum(self, dtype, shape, order, axis, window):
bn.move_sum(self.arr, window, axis=axis)
def time_move_mean(self, dtype, shape, order, axis, window):
bn.move_mean(self.arr, window, axis=axis)
def time_move_std(self, dtype, shape, order, axis, window):
bn.move_std(self.arr, window, axis=axis)
def time_move_var(self, dtype, shape, order, axis, window):
bn.move_var(self.arr, window, axis=axis)
def time_move_min(self, dtype, shape, order, axis, window):
bn.move_min(self.arr, window, axis=axis)
def time_move_max(self, dtype, shape, order, axis, window):
bn.move_max(self.arr, window, axis=axis)
def time_move_argmin(self, dtype, shape, order, axis, window):
bn.move_argmin(self.arr, window, axis=axis)
def time_move_argmax(self, dtype, shape, order, axis, window):
bn.move_argmax(self.arr, window, axis=axis)
def time_move_median(self, dtype, shape, order, axis, window):
bn.move_median(self.arr, window, axis=axis)
def time_move_quantile(self, dtype, shape, order, axis, window):
bn.move_quantile(self.arr, window, axis=axis, q=0.25)
def time_move_rank(self, dtype, shape, order, axis, window):
bn.move_rank(self.arr, window, axis=axis)