summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-05-10 04:08:34 +0000
committerCoprDistGit <infra@openeuler.org>2023-05-10 04:08:34 +0000
commitb2d906f18c667f9d6121a98ae17e039b93370947 (patch)
tree4d4b2d6f76fa1b8bf71d6d549796ee61d72e7bbc
parent95460ac0516cc3eeb3273a80f5a27c6bea8e286d (diff)
automatic import of python-numba-kdtreeopeneuler20.03
-rw-r--r--.gitignore1
-rw-r--r--python-numba-kdtree.spec257
-rw-r--r--sources1
3 files changed, 259 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..ad4cadd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/numba-kdtree-0.1.7.tar.gz
diff --git a/python-numba-kdtree.spec b/python-numba-kdtree.spec
new file mode 100644
index 0000000..c7cc41f
--- /dev/null
+++ b/python-numba-kdtree.spec
@@ -0,0 +1,257 @@
+%global _empty_manifest_terminate_build 0
+Name: python-numba-kdtree
+Version: 0.1.7
+Release: 1
+Summary: A kdtree implementation for numba.
+License: MIT
+URL: https://github.com/mortacious/numba-kdtree
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/d6/47/660d9f3fc314269777e25dc69650b422df4b356d4b2a3bb26cb42bf7b8fb/numba-kdtree-0.1.7.tar.gz
+
+
+%description
+# Numba-kdtree
+
+A simple KD-Tree for numba using a ctypes wrapper around the scipy `ckdtree` implementation.
+The KD-Tree is usable in both python and numba nopython functions.
+
+Once the query functions are compiled by numba, the implementation is just as fast as the original scipy version.
+
+Note: Currently only a basic subset of the original `ckdtree` interface is implemented.
+
+## Installation
+
+### Using pip
+```
+pip install numba-kdtree
+```
+
+### From source
+```
+git clone https://github.com/mortacious/numba-kdtree.git
+cd numba-kdtree
+python setup.py install
+```
+
+## Usage
+
+```python
+import numpy as np
+from numba_kdtree import KDTree
+data = np.random.random(3_000_000).reshape(-1, 3)
+kdtree = KDTree(data, leafsize=10)
+
+# query the nearest neighbors of the first 100 points
+distances, indices = kdtree.query(data[:100], k=30)
+
+# query all points in a radius around the first 100 points
+indices = kdtree.query_radius(data[:100], r=0.5, return_sorted=True)
+```
+
+The `KDTree` can also be used from within numba functions
+
+
+```python
+import numpy as np
+from numba import njit
+from numba_kdtree import KDTree
+
+def numba_function_with_kdtree(kdtree, data):
+ for i in range(data.shape[0]):
+ distances, indices = kdtree.query(data[0], k=30)
+ #<Use the computed neighbors
+
+data = np.random.random(3_000_000).reshape(-1, 3)
+kdtree = KDTree(data, leafsize=10)
+
+numba_function_with_kdtree(kdtree, data[:10000])
+```
+
+## TODOs
+
+- Implement all scipy `ckdtree` functions
+- Fix the parallel query functions
+
+
+%package -n python3-numba-kdtree
+Summary: A kdtree implementation for numba.
+Provides: python-numba-kdtree
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+BuildRequires: python3-cffi
+BuildRequires: gcc
+BuildRequires: gdb
+%description -n python3-numba-kdtree
+# Numba-kdtree
+
+A simple KD-Tree for numba using a ctypes wrapper around the scipy `ckdtree` implementation.
+The KD-Tree is usable in both python and numba nopython functions.
+
+Once the query functions are compiled by numba, the implementation is just as fast as the original scipy version.
+
+Note: Currently only a basic subset of the original `ckdtree` interface is implemented.
+
+## Installation
+
+### Using pip
+```
+pip install numba-kdtree
+```
+
+### From source
+```
+git clone https://github.com/mortacious/numba-kdtree.git
+cd numba-kdtree
+python setup.py install
+```
+
+## Usage
+
+```python
+import numpy as np
+from numba_kdtree import KDTree
+data = np.random.random(3_000_000).reshape(-1, 3)
+kdtree = KDTree(data, leafsize=10)
+
+# query the nearest neighbors of the first 100 points
+distances, indices = kdtree.query(data[:100], k=30)
+
+# query all points in a radius around the first 100 points
+indices = kdtree.query_radius(data[:100], r=0.5, return_sorted=True)
+```
+
+The `KDTree` can also be used from within numba functions
+
+
+```python
+import numpy as np
+from numba import njit
+from numba_kdtree import KDTree
+
+def numba_function_with_kdtree(kdtree, data):
+ for i in range(data.shape[0]):
+ distances, indices = kdtree.query(data[0], k=30)
+ #<Use the computed neighbors
+
+data = np.random.random(3_000_000).reshape(-1, 3)
+kdtree = KDTree(data, leafsize=10)
+
+numba_function_with_kdtree(kdtree, data[:10000])
+```
+
+## TODOs
+
+- Implement all scipy `ckdtree` functions
+- Fix the parallel query functions
+
+
+%package help
+Summary: Development documents and examples for numba-kdtree
+Provides: python3-numba-kdtree-doc
+%description help
+# Numba-kdtree
+
+A simple KD-Tree for numba using a ctypes wrapper around the scipy `ckdtree` implementation.
+The KD-Tree is usable in both python and numba nopython functions.
+
+Once the query functions are compiled by numba, the implementation is just as fast as the original scipy version.
+
+Note: Currently only a basic subset of the original `ckdtree` interface is implemented.
+
+## Installation
+
+### Using pip
+```
+pip install numba-kdtree
+```
+
+### From source
+```
+git clone https://github.com/mortacious/numba-kdtree.git
+cd numba-kdtree
+python setup.py install
+```
+
+## Usage
+
+```python
+import numpy as np
+from numba_kdtree import KDTree
+data = np.random.random(3_000_000).reshape(-1, 3)
+kdtree = KDTree(data, leafsize=10)
+
+# query the nearest neighbors of the first 100 points
+distances, indices = kdtree.query(data[:100], k=30)
+
+# query all points in a radius around the first 100 points
+indices = kdtree.query_radius(data[:100], r=0.5, return_sorted=True)
+```
+
+The `KDTree` can also be used from within numba functions
+
+
+```python
+import numpy as np
+from numba import njit
+from numba_kdtree import KDTree
+
+def numba_function_with_kdtree(kdtree, data):
+ for i in range(data.shape[0]):
+ distances, indices = kdtree.query(data[0], k=30)
+ #<Use the computed neighbors
+
+data = np.random.random(3_000_000).reshape(-1, 3)
+kdtree = KDTree(data, leafsize=10)
+
+numba_function_with_kdtree(kdtree, data[:10000])
+```
+
+## TODOs
+
+- Implement all scipy `ckdtree` functions
+- Fix the parallel query functions
+
+
+%prep
+%autosetup -n numba-kdtree-0.1.7
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-numba-kdtree -f filelist.lst
+%dir %{python3_sitearch}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Wed May 10 2023 Python_Bot <Python_Bot@openeuler.org> - 0.1.7-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..1034373
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+d457ebdfe24e9205b5903ba35893950a numba-kdtree-0.1.7.tar.gz