Metadata-Version: 2.1
Name: napf
Version: 0.0.5
Summary: nanoflann python bindings for kdtree.
Home-page: https://github.com/tataratat/napf
Author: Jaewook Lee
Author-email: jaewooklee042@gmail.com
License: MIT
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Natural Language :: English
Classifier: Topic :: Scientific/Engineering
Description-Content-Type: text/markdown
License-File: LICENSE

# napf
[`nanoflann`](https://github.com/jlblancoc/nanoflann) wrappers for python and maybe fortran.

## python
As `nanoflann` offers template classes, separate classes are implemented in `napf` for each ___{datatype, data dimension, distance metric}___. All the search functions are equipped with multi-thread execution. Uses [`numpy.ndarray`](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html) 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})_
- `data dimension`: {__1__, __2__, __3__, __4__, __5__, __6__, __7__, __8__, __9__, __10__, __11__, __12__, __13__, __14__, __15__, __16__, __17__, __18__, __19__, __20__}
- `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>`_

```python
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)

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

## fortran
maybe...
