4747 ##########################
4848 # isocut zone
4949
50- @numba .jit (nopython = True )
50+ @numba .jit (nopython = True , nogil = True )
5151 def jisotonic5 (x , weights ):
5252 N = x .shape [0 ]
5353
@@ -100,7 +100,7 @@ def jisotonic5(x, weights):
100100
101101 return y , MSE
102102
103- @numba .jit (nopython = True )
103+ @numba .jit (nopython = True , nogil = True )
104104 def updown_arange (num_bins , dtype = np .int_ ):
105105 num_bins_1 = int (np .ceil (num_bins / 2 ))
106106 num_bins_2 = num_bins - num_bins_1
@@ -111,7 +111,7 @@ def updown_arange(num_bins, dtype=np.int_):
111111 )
112112 )
113113
114- @numba .jit (nopython = True )
114+ @numba .jit (nopython = True , nogil = True )
115115 def compute_ks4 (counts1 , counts2 ):
116116 c1s = counts1 .sum ()
117117 c2s = counts2 .sum ()
@@ -123,7 +123,7 @@ def compute_ks4(counts1, counts2):
123123 ks *= np .sqrt ((c1s + c2s ) / 2 )
124124 return ks
125125
126- @numba .jit (nopython = True )
126+ @numba .jit (nopython = True , nogil = True )
127127 def compute_ks5 (counts1 , counts2 ):
128128 best_ks = - np .inf
129129 length = counts1 .size
@@ -138,7 +138,7 @@ def compute_ks5(counts1, counts2):
138138
139139 return best_ks , best_length
140140
141- @numba .jit (nopython = True )
141+ @numba .jit (nopython = True , nogil = True )
142142 def up_down_isotonic_regression (x , weights = None ):
143143 # determine switch point
144144 _ , mse1 = jisotonic5 (x , weights )
@@ -153,14 +153,14 @@ def up_down_isotonic_regression(x, weights=None):
153153
154154 return np .hstack ((y1 , y2 ))
155155
156- @numba .jit (nopython = True )
156+ @numba .jit (nopython = True , nogil = True )
157157 def down_up_isotonic_regression (x , weights = None ):
158158 return - up_down_isotonic_regression (- x , weights = weights )
159159
160160 # num_bins_factor = 1
161161 float_0 = np .array ([0.0 ])
162162
163- @numba .jit (nopython = True )
163+ @numba .jit (nopython = True , nogil = True )
164164 def isocut (samples ): # , sample_weights=None isosplit6 not handle weight anymore
165165 """
166166 Compute a dip-test to check if 1-d samples are unimodal or not.
@@ -464,7 +464,7 @@ def ensure_continuous_labels(labels):
464464
465465if HAVE_NUMBA :
466466
467- @numba .jit (nopython = True )
467+ @numba .jit (nopython = True , nogil = True )
468468 def compute_centroids_and_covmats (X , centroids , covmats , labels , label_set , to_compute_mask ):
469469 ## manual loop with numba to be faster
470470
@@ -498,7 +498,7 @@ def compute_centroids_and_covmats(X, centroids, covmats, labels, label_set, to_c
498498 if to_compute_mask [i ] and count [i ] > 0 :
499499 covmats [i , :, :] /= count [i ]
500500
501- @numba .jit (nopython = True )
501+ @numba .jit (nopython = True , nogil = True )
502502 def get_pairs_to_compare (centroids , comparisons_made , active_labels_mask ):
503503 n = centroids .shape [0 ]
504504
@@ -526,7 +526,7 @@ def get_pairs_to_compare(centroids, comparisons_made, active_labels_mask):
526526
527527 return pairs
528528
529- @numba .jit (nopython = True )
529+ @numba .jit (nopython = True , nogil = True )
530530 def compute_distances (centroids , comparisons_made , active_labels_mask ):
531531 n = centroids .shape [0 ]
532532 dists = np .zeros ((n , n ), dtype = centroids .dtype )
@@ -548,7 +548,7 @@ def compute_distances(centroids, comparisons_made, active_labels_mask):
548548
549549 return dists
550550
551- @numba .jit (nopython = True )
551+ @numba .jit (nopython = True , nogil = True )
552552 def merge_test (X1 , X2 , centroid1 , centroid2 , covmat1 , covmat2 , isocut_threshold ):
553553
554554 if X1 .size == 0 or X2 .size == 0 :
@@ -584,7 +584,7 @@ def merge_test(X1, X2, centroid1, centroid2, covmat1, covmat2, isocut_threshold)
584584
585585 return do_merge , L12
586586
587- @numba .jit (nopython = True )
587+ @numba .jit (nopython = True , nogil = True )
588588 def compare_pairs (X , labels , pairs , centroids , covmats , min_cluster_size , isocut_threshold ):
589589
590590 clusters_changed_mask = np .zeros (centroids .shape [0 ], dtype = "bool" )
0 commit comments