Skip to content

Commit ec7d9c1

Browse files
committed
bugfix: use heapq also at init step
1 parent ff42483 commit ec7d9c1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ot/partial/partial_cython.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def compute_costs(np.ndarray[np.float64_t, ndim=1] sorted_z,
124124
else:
125125
cost = get_cost_wp(sorted_z, sorted_distrib_indicator, idx_start, idx_end, p)
126126
if idx_end == idx_start + 1:
127-
l_costs.append((abs(cost), idx_start, idx_end))
127+
heapq.heappush(l_costs, (abs(cost), idx_start, idx_end))
128128
minimal_chain_ending_at[idx_end] = (idx_start, abs(cost))
129129
return l_costs, precompute_chain_costs_cumsum(minimal_chain_ending_at, n)
130130

0 commit comments

Comments
 (0)