Skip to content

Commit e543379

Browse files
committed
replaced hardcoded fastmath value with config var
1 parent f17f92d commit e543379

File tree

7 files changed

+22
-22
lines changed

7 files changed

+22
-22
lines changed

stumpy/aamp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
@njit(
1414
# "(f8[:], f8[:], i8, b1[:], b1[:], f8, i8[:], i8, i8, i8, f8[:, :, :],"
1515
# "f8[:, :], f8[:, :], i8[:, :, :], i8[:, :], i8[:, :], b1)",
16-
fastmath=True,
16+
fastmath=config.STUMPY_FASTMATH,
1717
)
1818
def _compute_diagonal(
1919
T_A,
@@ -186,7 +186,7 @@ def _compute_diagonal(
186186
@njit(
187187
# "(f8[:], f8[:], i8, b1[:], b1[:], i8[:], b1, i8)",
188188
parallel=True,
189-
fastmath=True,
189+
fastmath=config.STUMPY_FASTMATH,
190190
)
191191
def _aamp(
192192
T_A,

stumpy/core.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ def check_window_size(m, max_size=None):
589589
raise ValueError(f"The window size must be less than or equal to {max_size}")
590590

591591

592-
@njit(fastmath=True)
592+
@njit(fastmath=config.STUMPY_FASTMATH)
593593
def _sliding_dot_product(Q, T):
594594
"""
595595
A Numba JIT-compiled implementation of the sliding window dot product.
@@ -657,7 +657,7 @@ def sliding_dot_product(Q, T):
657657

658658
@njit(
659659
# "f8[:](f8[:], i8, b1[:])",
660-
fastmath={"nsz", "arcp", "contract", "afn", "reassoc"}
660+
fastmath=config.STUMPY_FASTMATH_FLAGS
661661
)
662662
def _welford_nanvar(a, w, a_subseq_isfinite):
663663
"""
@@ -771,7 +771,7 @@ def welford_nanstd(a, w=None):
771771
return np.sqrt(np.clip(welford_nanvar(a, w), a_min=0, a_max=None))
772772

773773

774-
@njit(parallel=True, fastmath={"nsz", "arcp", "contract", "afn", "reassoc"})
774+
@njit(parallel=True, fastmath=config.STUMPY_FASTMATH_FLAGS)
775775
def _rolling_nanstd_1d(a, w):
776776
"""
777777
A Numba JIT-compiled and parallelized function for computing the rolling standard
@@ -1110,7 +1110,7 @@ def _calculate_squared_distance(
11101110

11111111
@njit(
11121112
# "f8[:](i8, f8[:], f8, f8, f8[:], f8[:])",
1113-
fastmath=True,
1113+
fastmath=config.STUMPY_FASTMATH,
11141114
)
11151115
def _calculate_squared_distance_profile(
11161116
m, QT, μ_Q, σ_Q, M_T, Σ_T, Q_subseq_isconstant, T_subseq_isconstant
@@ -1176,7 +1176,7 @@ def _calculate_squared_distance_profile(
11761176

11771177
@njit(
11781178
# "f8[:](i8, f8[:], f8, f8, f8[:], f8[:])",
1179-
fastmath=True,
1179+
fastmath=config.STUMPY_FASTMATH,
11801180
)
11811181
def calculate_distance_profile(
11821182
m, QT, μ_Q, σ_Q, M_T, Σ_T, Q_subseq_isconstant, T_subseq_isconstant
@@ -1229,7 +1229,7 @@ def calculate_distance_profile(
12291229
return np.sqrt(D_squared)
12301230

12311231

1232-
@njit(fastmath=True)
1232+
@njit(fastmath=config.STUMPY_FASTMATH)
12331233
def _p_norm_distance_profile(Q, T, p=2.0):
12341234
"""
12351235
A Numba JIT-compiled and parallelized function for computing the p-normalized
@@ -1505,7 +1505,7 @@ def mueen_calculate_distance_profile(Q, T):
15051505

15061506
@njit(
15071507
# "f8[:](f8[:], f8[:], f8[:], f8, f8, f8[:], f8[:])",
1508-
fastmath=True
1508+
fastmath=config.STUMPY_FASTMATH
15091509
)
15101510
def _mass(Q, T, QT, μ_Q, σ_Q, M_T, Σ_T, Q_subseq_isconstant, T_subseq_isconstant):
15111511
"""
@@ -1978,7 +1978,7 @@ def _get_QT(start, T_A, T_B, m):
19781978

19791979
@njit(
19801980
# ["(f8[:], i8, i8)", "(f8[:, :], i8, i8)"],
1981-
fastmath=True
1981+
fastmath=config.STUMPY_FASTMATH
19821982
)
19831983
def _apply_exclusion_zone(a, idx, excl_zone, val):
19841984
"""
@@ -2308,7 +2308,7 @@ def array_to_temp_file(a):
23082308

23092309
@njit(
23102310
# "i8[:](i8[:], i8, i8, i8)",
2311-
fastmath=True,
2311+
fastmath=config.STUMPY_FASTMATH,
23122312
)
23132313
def _count_diagonal_ndist(diags, m, n_A, n_B):
23142314
"""
@@ -2505,7 +2505,7 @@ def rolling_isfinite(a, w):
25052505
)
25062506

25072507

2508-
@njit(parallel=True, fastmath={"nsz", "arcp", "contract", "afn", "reassoc"})
2508+
@njit(parallel=True, fastmath=config.STUMPY_FASTMATH_FLAGS)
25092509
def _rolling_isconstant(a, w):
25102510
"""
25112511
Compute the rolling isconstant for 1-D array.
@@ -2842,7 +2842,7 @@ def _idx_to_mp(
28422842
return P
28432843

28442844

2845-
@njit(fastmath=True)
2845+
@njit(fastmath=config.STUMPY_FASTMATH)
28462846
def _total_diagonal_ndists(tile_lower_diag, tile_upper_diag, tile_height, tile_width):
28472847
"""
28482848
Count the total number of distances covered by a range of diagonals
@@ -3970,7 +3970,7 @@ def _mdl(disc_subseqs, disc_neighbors, S, n_bit=8):
39703970

39713971
@njit(
39723972
# "(i8, i8, f8[:, :], f8[:], i8, f8[:, :], i8[:, :], f8)",
3973-
fastmath={"nsz", "arcp", "contract", "afn", "reassoc"},
3973+
fastmath=config.STUMPY_FASTMATH_FLAGS,
39743974
)
39753975
def _compute_multi_PI(d, idx, D, D_prime, range_start, P, I, p=2.0):
39763976
"""

stumpy/maamp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ def _get_multi_p_norm(start, T, m, p=2.0):
592592
# "(i8, i8, i8, f8[:, :], f8[:, :], i8, i8, b1[:, :], b1[:, :], f8,"
593593
# "f8[:, :], f8[:, :], f8[:, :])",
594594
parallel=True,
595-
fastmath=True,
595+
fastmath=config.STUMPY_FASTMATH,
596596
)
597597
def _compute_multi_p_norm(
598598
d,

stumpy/mstump.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ def _get_multi_QT(start, T, m):
811811
# "(i8, i8, i8, f8[:, :], f8[:, :], i8, i8, f8[:, :], f8[:, :], f8[:, :],"
812812
# "f8[:, :], f8[:, :], f8[:, :], f8[:, :])",
813813
parallel=True,
814-
fastmath=True,
814+
fastmath=config.STUMPY_FASTMATH,
815815
)
816816
def _compute_multi_D(
817817
d,

stumpy/scraamp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def _preprocess_prescraamp(T_A, m, T_B=None, s=None):
8383
return (T_A, T_B, T_A_subseq_isfinite, T_B_subseq_isfinite, indices, s, excl_zone)
8484

8585

86-
@njit(fastmath=True)
86+
@njit(fastmath=config.STUMPY_FASTMATH)
8787
def _compute_PI(
8888
T_A,
8989
T_B,
@@ -286,7 +286,7 @@ def _compute_PI(
286286
# "(f8[:], f8[:], i8, b1[:], b1[:], f8, i8, i8, f8[:], f8[:],"
287287
# "i8[:], optional(i8))",
288288
parallel=True,
289-
fastmath=True,
289+
fastmath=config.STUMPY_FASTMATH,
290290
)
291291
def _prescraamp(
292292
T_A,

stumpy/scrump.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def _preprocess_prescrump(
133133
)
134134

135135

136-
@njit(fastmath=True)
136+
@njit(fastmath=config.STUMPY_FASTMATH)
137137
def _compute_PI(
138138
T_A,
139139
T_B,
@@ -384,7 +384,7 @@ def _compute_PI(
384384
# "(f8[:], f8[:], i8, f8[:], f8[:], f8[:], f8[:], f8[:], i8, i8, f8[:], f8[:],"
385385
# "i8[:], optional(i8))",
386386
parallel=True,
387-
fastmath=True,
387+
fastmath=config.STUMPY_FASTMATH,
388388
)
389389
def _prescrump(
390390
T_A,

stumpy/stump.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# "(f8[:], f8[:], i8, f8[:], f8[:], f8[:], f8[:], f8[:], f8[:], f8[:], f8[:],"
1616
# "b1[:], b1[:], b1[:], b1[:], i8[:], i8, i8, i8, f8[:, :, :], f8[:, :],"
1717
# "f8[:, :], i8[:, :, :], i8[:, :], i8[:, :], b1)",
18-
fastmath=True,
18+
fastmath=config.STUMPY_FASTMATH,
1919
)
2020
def _compute_diagonal(
2121
T_A,
@@ -247,7 +247,7 @@ def _compute_diagonal(
247247
# "(f8[:], f8[:], i8, f8[:], f8[:], f8[:], f8[:], f8[:], f8[:], b1[:], b1[:],"
248248
# "b1[:], b1[:], i8[:], b1, i8)",
249249
parallel=True,
250-
fastmath=True,
250+
fastmath=config.STUMPY_FASTMATH,
251251
)
252252
def _stump(
253253
T_A,

0 commit comments

Comments
 (0)