Skip to main content

nanoflann python bindings for kdtree with multithreaded queries

Project description

napf - nanoflann wrappers for python and maybe fortran

main PyPI version

python

As nanoflann offers template classes, separate classes are implemented in napf for each {datatype, distance metric}. All the search functions are equipped with multi-thread execution. Uses numpy.ndarray for data input and output. Currently, the combinations of following options are supported:

  • data type: {double, float, int, long} (corresponds to {np.float64, np.float32, np.int32, np.int64})
  • distance metric: {L1, L2} Note that functions return squared distances, when you use the L2 metric.

quick start

install with pip:

pip install --upgrade pip
pip install napf

Note: in case your system requires a dynamic build, you need a c++11 compatible c++ compiler. To make sure a correct compiler is chosen, set export CC=<your-c-compiler> CXX=<your-c++-compiler>

import napf
import numpy as np

data = <data in 2D array>
queries = <query points in 2D array>

kdt = napf.KDT(tree_data=data, metric=1)

distances, indices = kdt.knn_search(
    queries=queries,
    kneighbors=3,
    nthread=4,
)
...

fortran

If you need fortran bindings, please let us know by creating an issue.

Documentation

This package uses a sphinx based documentation. An online version of the documentation can be found at napf - documentation.

If you want to build the documentation yourself use the following commands in the package root directory.

pip install -r ./docs/requirements.txt
sphinx-build -W -b html docs/source docs/build

You will find the documentation in the docs/build folder.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

napf-0.1.0.tar.gz (594.9 kB view hashes)

Uploaded Source

Built Distributions

napf-0.1.0-cp312-cp312-win_arm64.whl (286.6 kB view hashes)

Uploaded CPython 3.12 Windows ARM64

napf-0.1.0-cp312-cp312-win_amd64.whl (293.8 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

napf-0.1.0-cp312-cp312-win32.whl (243.9 kB view hashes)

Uploaded CPython 3.12 Windows x86

napf-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (489.4 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

napf-0.1.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (541.2 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ppc64le

napf-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (460.5 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARM64

napf-0.1.0-cp312-cp312-macosx_11_0_arm64.whl (393.8 kB view hashes)

Uploaded CPython 3.12 macOS 11.0+ ARM64

napf-0.1.0-cp312-cp312-macosx_10_9_x86_64.whl (440.1 kB view hashes)

Uploaded CPython 3.12 macOS 10.9+ x86-64

napf-0.1.0-cp311-cp311-win_arm64.whl (286.2 kB view hashes)

Uploaded CPython 3.11 Windows ARM64

napf-0.1.0-cp311-cp311-win_amd64.whl (294.0 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

napf-0.1.0-cp311-cp311-win32.whl (242.1 kB view hashes)

Uploaded CPython 3.11 Windows x86

napf-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (491.7 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

napf-0.1.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (542.3 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ppc64le

napf-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (463.7 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

napf-0.1.0-cp311-cp311-macosx_11_0_arm64.whl (391.4 kB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

napf-0.1.0-cp311-cp311-macosx_10_9_x86_64.whl (436.9 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

napf-0.1.0-cp310-cp310-win_arm64.whl (285.2 kB view hashes)

Uploaded CPython 3.10 Windows ARM64

napf-0.1.0-cp310-cp310-win_amd64.whl (292.7 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

napf-0.1.0-cp310-cp310-win32.whl (241.2 kB view hashes)

Uploaded CPython 3.10 Windows x86

napf-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (488.2 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

napf-0.1.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (540.0 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ppc64le

napf-0.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (460.7 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

napf-0.1.0-cp310-cp310-macosx_11_0_arm64.whl (390.0 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

napf-0.1.0-cp310-cp310-macosx_10_9_x86_64.whl (435.5 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

napf-0.1.0-cp39-cp39-win_arm64.whl (288.4 kB view hashes)

Uploaded CPython 3.9 Windows ARM64

napf-0.1.0-cp39-cp39-win_amd64.whl (293.0 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

napf-0.1.0-cp39-cp39-win32.whl (241.4 kB view hashes)

Uploaded CPython 3.9 Windows x86

napf-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (488.7 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

napf-0.1.0-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (541.3 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ppc64le

napf-0.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (461.4 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

napf-0.1.0-cp39-cp39-macosx_11_0_arm64.whl (390.1 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

napf-0.1.0-cp39-cp39-macosx_10_9_x86_64.whl (435.5 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

napf-0.1.0-cp38-cp38-win_amd64.whl (293.0 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

napf-0.1.0-cp38-cp38-win32.whl (241.3 kB view hashes)

Uploaded CPython 3.8 Windows x86

napf-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (488.5 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

napf-0.1.0-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (540.3 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ppc64le

napf-0.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (460.4 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

napf-0.1.0-cp38-cp38-macosx_11_0_arm64.whl (389.8 kB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

napf-0.1.0-cp38-cp38-macosx_10_9_x86_64.whl (435.4 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

napf-0.1.0-cp37-cp37m-win_amd64.whl (289.6 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

napf-0.1.0-cp37-cp37m-win32.whl (245.3 kB view hashes)

Uploaded CPython 3.7m Windows x86

napf-0.1.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (498.2 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

napf-0.1.0-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (549.1 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ ppc64le

napf-0.1.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (468.4 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ ARM64

napf-0.1.0-cp37-cp37m-macosx_10_9_x86_64.whl (426.0 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page