Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update scipy import #66

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions fastpair/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from collections import defaultdict
from itertools import combinations, cycle

import scipy.spatial.distance as dist
import scipy.spatial.distance

__all__ = ["FastPair", "dist"]
__all__ = ["FastPair"]


class AttrDict(dict):
Expand Down Expand Up @@ -50,7 +50,7 @@ class FastPair:
https://doi.org/10.1145/351827.351829
"""

def __init__(self, min_points=10, dist=dist.euclidean):
def __init__(self, min_points=10, dist=scipy.spatial.distance.euclidean):
"""Initialize an empty FastPair data-structure.

Parameters
Expand All @@ -59,7 +59,7 @@ def __init__(self, min_points=10, dist=dist.euclidean):
The minimum number of points to add before initializing the
data-structure. Queries _before_ `min_points` have been added to
the data-structure will be brute-force.
dist : function, default=scipy.spatial.distance.euclidean
dist : function, default scipy.spatial.distance.euclidean
Can be any Python function that returns a distance (float) between
between two vectors (tuples) `u` and `v`. Any distance function
from `scipy.spatial.distance` will do the trick. By default, the
Expand Down Expand Up @@ -265,7 +265,7 @@ def _update_point(self, old, new):
# return self._update_point(a, c)


def _closest_pair_brute_force(pts, dst=dist.euclidean):
def _closest_pair_brute_force(pts, dst=scipy.spatial.distance.euclidean):
"""Compute closest pair of points using brute-force algorithm.

Notes
Expand Down