python NGT
Project description
python NGT
Install
Python binding with pybind11 (ngtpy) is installed as follows.
pip3 install ngt
You can install the python bindings from source code. You MUST install the NGT library according to the README before installing the python bindings as follows.
cd NGT_ROOT/python
pip3 install .
Please note that the search speed of the ngtpy packages from PyPI is slower than that of the ngtpy that is built on your computer so that the package can be run on older CPUs.
Documents
Simple samples
ngtpy (pybind11)
ngtpy(pybind11) can reduce the processing times than ngt(ctypes). It is more effective especially for the short search time.
import ngtpy
import random
dim = 10
nb = 100
vectors = [[random.random() for _ in range(dim)] for _ in range(nb)]
query = vectors[0]
ngtpy.create(b"tmp", dim)
index = ngtpy.Index(b"tmp")
index.batch_insert(vectors)
index.save()
results = index.search(query, 3)
for i, (id, distance) in enumerate(results) :
print(str(i) + ": " + str(id) + ", " + str(distance))
object = index.get_object(id)
print(object)
See also sample.py.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ngt-2.3.12-cp313-cp313-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: ngt-2.3.12-cp313-cp313-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 11.6 MB
- Tags: CPython 3.13, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6d2f410778291477d225b274baa3bc2994d23bbfae709b95fe66dcfc5522c2c
|
|
| MD5 |
81b13bc6db5d8494ca8b63ae7e86fd4c
|
|
| BLAKE2b-256 |
2f40b7d3b49e632bef187c922e4d207cecd216547af138836c5ec2254f74774f
|
File details
Details for the file ngt-2.3.12-cp313-cp313-macosx_13_0_arm64.whl.
File metadata
- Download URL: ngt-2.3.12-cp313-cp313-macosx_13_0_arm64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.13, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39caf9fef63113d294907822c2fafafc1bbc4a93375c7999b36fef6a97ebaf18
|
|
| MD5 |
524d762b1c3e6502ee84df9b9317a945
|
|
| BLAKE2b-256 |
f71bd1142fad447e2b47d38dd031dcab7a377c378a24d1661ea58c2a266bc841
|
File details
Details for the file ngt-2.3.12-cp312-cp312-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: ngt-2.3.12-cp312-cp312-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 11.6 MB
- Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d485e6129c4bdab2066154c84c7f7274ef719e1d1269953a8a705e0a15aa1037
|
|
| MD5 |
68a2ce840cead34c883c515117c7b30e
|
|
| BLAKE2b-256 |
e5b609d005b5dd57ef263478a122f1c12947328feba9418c489b301616c90a4f
|
File details
Details for the file ngt-2.3.12-cp312-cp312-macosx_13_0_arm64.whl.
File metadata
- Download URL: ngt-2.3.12-cp312-cp312-macosx_13_0_arm64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.12, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad968a53e2cee726fd4c37cfec9739eab359f0e99d3bbd986834647d0b8d0c85
|
|
| MD5 |
1bf839ea576bcc9ce6f2da012bfa2d93
|
|
| BLAKE2b-256 |
85e2178a98bb8516f49d55776dfce09e4c9cf9a6c8ecda3208af404fb3feaf4d
|
File details
Details for the file ngt-2.3.12-cp311-cp311-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: ngt-2.3.12-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 11.6 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15cc7b0df0b21e312736761236c9a85b6c9f202db77c67814aa6c0cdfd15e376
|
|
| MD5 |
6a4d2e79b42f048a3e523921e092a2f1
|
|
| BLAKE2b-256 |
856454c42398a96b3dfa9c1bd21705d82ffba4bcbabef46c7d36caac32504e53
|
File details
Details for the file ngt-2.3.12-cp311-cp311-macosx_13_0_arm64.whl.
File metadata
- Download URL: ngt-2.3.12-cp311-cp311-macosx_13_0_arm64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.11, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
002fe79fa13fb22a51151bfe55528f38ce8fa3d308dde25bd54360283d63f4f0
|
|
| MD5 |
1c05fa9a5de6d69004914a2c7a526876
|
|
| BLAKE2b-256 |
0e05287551747fdafc9038612381bfd70ec88927b2eb77dc8310df9159088fce
|
File details
Details for the file ngt-2.3.12-cp310-cp310-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: ngt-2.3.12-cp310-cp310-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 11.6 MB
- Tags: CPython 3.10, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf1b7980b32a119718a8496d582974b77fed3b9acccd04b774665370cfabcbed
|
|
| MD5 |
ad83458a4e7ebc89f58011b432a1cde9
|
|
| BLAKE2b-256 |
86026981d4f76c40079f15c2f645f75618f02e88df2fbc8ba17983c3632cff00
|
File details
Details for the file ngt-2.3.12-cp310-cp310-macosx_13_0_arm64.whl.
File metadata
- Download URL: ngt-2.3.12-cp310-cp310-macosx_13_0_arm64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.10, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
265186069721c397e807bf978dd5455e0e216e490233b8f0b96a96c0d8b149a0
|
|
| MD5 |
548851d9e286be4fe45fa059d53aaccd
|
|
| BLAKE2b-256 |
378d9c7ed271a26d1a6ad1ed85bc170799dbfd5d1c78c8a9d5e1f0259452b78a
|
File details
Details for the file ngt-2.3.12-cp39-cp39-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: ngt-2.3.12-cp39-cp39-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 11.6 MB
- Tags: CPython 3.9, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34d990cc1083f3aedb7429cc0c6a6529a07f58c7e243bd72c97cb177ba736296
|
|
| MD5 |
d69ff3a952ab884dee89c0319fdb9a1c
|
|
| BLAKE2b-256 |
b57fc5a00fefaf8244b01a6d1f9999831e23be07df69761c1502415d7c964f49
|
File details
Details for the file ngt-2.3.12-cp39-cp39-macosx_13_0_arm64.whl.
File metadata
- Download URL: ngt-2.3.12-cp39-cp39-macosx_13_0_arm64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.9, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1acfaf7c5e02611887a7ecbc1174e42d35ce758e178061fd86c3499b2bc1b832
|
|
| MD5 |
fce796988d332bd991083138d7c67613
|
|
| BLAKE2b-256 |
602e152b0997bb7c690829752e2e0837e66c5a8ff8d10a9bed8606fe21e75743
|
File details
Details for the file ngt-2.3.12-cp38-cp38-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: ngt-2.3.12-cp38-cp38-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 11.6 MB
- Tags: CPython 3.8, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82c3e8a4a609920619e106ee717cc788b52b6513251e5c9386457b9ee0c020e8
|
|
| MD5 |
66f5f58d5d0e4553ca4606d0f2005089
|
|
| BLAKE2b-256 |
276583ea7dfe8c41903acfa4d86268883c52ec51a62850e0fb77d961b782df4b
|
File details
Details for the file ngt-2.3.12-cp38-cp38-macosx_13_0_arm64.whl.
File metadata
- Download URL: ngt-2.3.12-cp38-cp38-macosx_13_0_arm64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.8, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9cb54fd60a9e27932fc03074bb14e2f79651ad018948aff4275de97e72db92c4
|
|
| MD5 |
1a4d5da042d56b81acf8c4e315340426
|
|
| BLAKE2b-256 |
3d60b0b24444d4874c04a5ef445fd64429c5aea04c864a8c37c9fee81220a6c9
|