Metadata-Version: 2.1
Name: napf
Version: 0.1.0
Summary: nanoflann python bindings for kdtree with multithreaded queries
Author-Email: Jaewook Lee <jaewooklee042@gmail.com>
License: MIT License
        
        Copyright (c) 2022 Jaewook Lee
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Natural Language :: English
Classifier: Topic :: Scientific/Engineering
Project-URL: Homepage, https://github.com/tataratat/napf
Requires-Python: >=3.7
Requires-Dist: numpy
Description-Content-Type: text/markdown

<p align="center"><img src="https://github.com/tataratat/napf/raw/main/docs/source/_static/napf.png" width="50%" title="nurbs"></p>

**napf - nanoflann wrappers for python and maybe fortran**

[![main](https://github.com/tataratat/napf/actions/workflows/main.yml/badge.svg)](https://github.com/tataratat/napf/actions/workflows/main.yml)
[![PyPI version](https://badge.fury.io/py/napf.svg)](https://badge.fury.io/py/napf)


## python
As [nanoflann](https://github.com/jlblancoc/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](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})_
- `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)

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](https://gthub.com/tataratat/napf/issues).

## Documentation
This package uses a `sphinx` based documentation. An online version of the documentation can be found at [napf - documentation](https://tataratat.github.io/napf/).

If you want to build the documentation yourself use the following commands in the package root directory.
```bash
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.
