Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

napf

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

napf

nanoflann python bindings for kdtree with multithreaded queries

  • 0.1.0
  • PyPI
  • Socket score

Maintainers
1

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.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc