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

adding & subtracting multiple points after calling build() #68

Open
jGaboardi opened this issue Jul 8, 2024 · 2 comments
Open

adding & subtracting multiple points after calling build() #68

jGaboardi opened this issue Jul 8, 2024 · 2 comments
Assignees

Comments

@jGaboardi
Copy link
Collaborator

Currently with FastPair.__add__() only a single point can be added at time after calling build():

def __add__(self, p):
    self.points.append(p)
    if self.initialized:
        self._find_neighbor(p)
    elif len(self) >= self.min_points:
        self.build()
    return self

With some modification, a collection of points could be added to the data structure:

def __add__(self, p):
    if isinstance(p, list):
        for _p in p:
            self._add_1_point(_p)
    else:
        self._add_1_point(p)
    return self

def _add_1_point(self, p):
    self.points.append(p)
    if self.initialized:
        self._find_neighbor(p)
    elif len(self) >= self.min_points:
        self.build()
    return self

Seems like the same could go for FastPair.__sub__()

Thoughts?

cc @gegen07

@jGaboardi jGaboardi self-assigned this Jul 8, 2024
@gegen07
Copy link

gegen07 commented Jul 11, 2024

Nice catch!

If we pass other types like geoSeries or np.array? Assuming that we will only support list, it is up to the user to pass the argument correctly. I mean, if the user has a geoSeries, it has to convert geoSeries to list.

I think we should support at least np.array, to provide a "medium-level" API. What are your thoughts?

@jGaboardi
Copy link
Collaborator Author

I think we should support at least np.array, to provide a "medium-level" API. What are your thoughts?

I agree, and this would probably play nicely with numba & jit decorators for improved performance (in the future, of course).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants