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

Possible alternative to 'add' #10

Open
apiszcz opened this issue Aug 1, 2021 · 2 comments
Open

Possible alternative to 'add' #10

apiszcz opened this issue Aug 1, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@apiszcz
Copy link

apiszcz commented Aug 1, 2021

The current index add method adds a single vector. Is it possible to add 2D numpy array of vectors and use the array row position as the index.

# proposal for consideration
a = np.array([[1,2,3],[4,5,6]]
index.add(a)
# currently
for i in a:
   index.add(sample, i).unwrap();
@salamer
Copy link
Contributor

salamer commented Aug 1, 2021

great advice, I would add it next version as soon as possible!

@apiszcz
Copy link
Author

apiszcz commented Aug 1, 2021

Thanks that will save one loop through the data.
SCIKIT KDtree uses the full arrayby default. https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.KDTree.html

@salamer salamer added the enhancement New feature or request label Aug 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants