Skip to content

Commit

Permalink
ENH remove redundant expr in min_max_dist (scikit-learn#25262)
Browse files Browse the repository at this point in the history
  • Loading branch information
cache-missing committed Dec 31, 2022
1 parent a7728f6 commit 96a0bc8
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions sklearn/neighbors/_kd_tree.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,8 @@ cdef inline int min_max_dist(BinaryTree tree, ITYPE_t i_node, DTYPE_t* pt,
d_hi = pt[j] - tree.node_bounds[1, i_node, j]
d = (d_lo + fabs(d_lo)) + (d_hi + fabs(d_hi))
min_dist[0] = fmax(min_dist[0], 0.5 * d)
max_dist[0] = fmax(max_dist[0],
fabs(pt[j] - tree.node_bounds[0, i_node, j]))
max_dist[0] = fmax(max_dist[0],
fabs(pt[j] - tree.node_bounds[1, i_node, j]))
max_dist[0] = fmax(max_dist[0], fabs(d_lo))
max_dist[0] = fmax(max_dist[0], fabs(d_hi))
else:
# as above, use the fact that x + abs(x) = 2 * max(x, 0)
for j in range(n_features):
Expand Down

0 comments on commit 96a0bc8

Please sign in to comment.