fastquadtree 0.5.1__cp38-abi3-win_amd64.whl → 0.6.1__cp38-abi3-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fastquadtree/__init__.py +22 -26
- fastquadtree/__init__.pyi +0 -1
- fastquadtree/_native.pyd +0 -0
- {fastquadtree-0.5.1.dist-info → fastquadtree-0.6.1.dist-info}/METADATA +24 -14
- fastquadtree-0.6.1.dist-info/RECORD +10 -0
- {fastquadtree-0.5.1.dist-info → fastquadtree-0.6.1.dist-info}/WHEEL +1 -1
- fastquadtree-0.5.1.dist-info/RECORD +0 -10
- {fastquadtree-0.5.1.dist-info → fastquadtree-0.6.1.dist-info}/licenses/LICENSE +0 -0
fastquadtree/__init__.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
|
-
from typing import Any,
|
3
|
+
from typing import Any, Literal, Tuple, overload
|
4
4
|
|
5
5
|
from ._bimap import BiMap # type: ignore[attr-defined]
|
6
6
|
from ._item import Item
|
@@ -103,37 +103,33 @@ class QuadTree:
|
|
103
103
|
self._count += 1
|
104
104
|
return id_
|
105
105
|
|
106
|
-
def insert_many_points(self, points:
|
106
|
+
def insert_many_points(self, points: list[Point]) -> int:
|
107
107
|
"""
|
108
108
|
Bulk insert points with auto-assigned ids.
|
109
109
|
|
110
110
|
Args:
|
111
|
-
points:
|
111
|
+
points: List of (x, y) points.
|
112
112
|
|
113
113
|
Returns:
|
114
|
-
|
115
|
-
|
116
|
-
Raises:
|
117
|
-
ValueError: If any point is outside tree bounds.
|
114
|
+
The number of points inserted
|
118
115
|
"""
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
self._items.add(Item(id_,
|
134
|
-
|
135
|
-
|
136
|
-
return inserted
|
116
|
+
start_id = self._next_id
|
117
|
+
last_id = self._native.insert_many_points(start_id, points)
|
118
|
+
|
119
|
+
num_inserted = last_id - start_id + 1
|
120
|
+
|
121
|
+
if num_inserted < len(points):
|
122
|
+
raise ValueError("One or more points are outside tree bounds")
|
123
|
+
|
124
|
+
self._next_id = last_id + 1
|
125
|
+
|
126
|
+
# Update the item tracker if needed
|
127
|
+
if self._items is not None:
|
128
|
+
for i, id_ in enumerate(range(start_id, last_id + 1)):
|
129
|
+
x, y = points[i]
|
130
|
+
self._items.add(Item(id_, x, y, None))
|
131
|
+
|
132
|
+
return num_inserted
|
137
133
|
|
138
134
|
def attach(self, id_: int, obj: Any) -> None:
|
139
135
|
"""
|
@@ -263,7 +259,7 @@ class QuadTree:
|
|
263
259
|
|
264
260
|
if self._items is None:
|
265
261
|
raise ValueError("Cannot return result as item with track_objects=False")
|
266
|
-
id_,
|
262
|
+
id_, _x, _y = t
|
267
263
|
item = self._items.by_id(id_)
|
268
264
|
if item is None:
|
269
265
|
raise RuntimeError(
|
fastquadtree/__init__.pyi
CHANGED
@@ -31,7 +31,6 @@ class QuadTree:
|
|
31
31
|
# Inserts
|
32
32
|
def insert(self, xy: Point, *, id_: int | None = ..., obj: Any = ...) -> int: ...
|
33
33
|
def insert_many_points(self, points: Iterable[Point]) -> int: ...
|
34
|
-
def insert_many(self, items: Iterable[tuple[Point, Any]]) -> int: ...
|
35
34
|
def attach(self, id_: int, obj: Any) -> None: ...
|
36
35
|
|
37
36
|
# Deletions
|
fastquadtree/_native.pyd
CHANGED
Binary file
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: fastquadtree
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.6.1
|
4
4
|
Classifier: Programming Language :: Python :: 3
|
5
5
|
Classifier: Programming Language :: Python :: 3 :: Only
|
6
6
|
Classifier: Programming Language :: Rust
|
@@ -35,15 +35,14 @@ Project-URL: Issues, https://github.com/Elan456/fastquadtree/issues
|
|
35
35
|
[](https://pypi.org/project/fastquadtree/#files)
|
36
36
|
[](LICENSE)
|
37
37
|
|
38
|
-
[](https://pepy.tech/projects/fastquadtree)
|
38
|
+
[](https://pepy.tech/projects/fastquadtree)
|
40
39
|
|
41
40
|
[](https://github.com/Elan456/fastquadtree/actions/workflows/ci.yml)
|
42
41
|
[](https://codecov.io/gh/Elan456/fastquadtree)
|
43
42
|
|
44
43
|
[](https://pyo3.rs/)
|
45
44
|
[](https://www.maturin.rs/)
|
46
|
-
[](https://github.com/astral-sh/ruff)
|
47
46
|
|
48
47
|
|
49
48
|
|
@@ -66,18 +65,27 @@ fastquadtree **outperforms** all other quadtree Python packages, including the R
|
|
66
65
|

|
67
66
|
|
68
67
|
### Summary (largest dataset, PyQtree baseline)
|
69
|
-
- Points: **
|
68
|
+
- Points: **250,000**, Queries: **500**
|
70
69
|
--------------------
|
71
|
-
- Fastest total: **fastquadtree** at **
|
70
|
+
- Fastest total: **fastquadtree** at **0.120 s**
|
72
71
|
|
73
72
|
| Library | Build (s) | Query (s) | Total (s) | Speed vs PyQtree |
|
74
73
|
|---|---:|---:|---:|---:|
|
75
|
-
| fastquadtree | 0.
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
74
|
+
| fastquadtree | 0.031 | 0.089 | 0.120 | 14.64× |
|
75
|
+
| Shapely STRtree | 0.179 | 0.100 | 0.279 | 6.29× |
|
76
|
+
| nontree-QuadTree | 0.595 | 0.605 | 1.200 | 1.46× |
|
77
|
+
| Rtree | 0.961 | 0.300 | 1.261 | 1.39× |
|
78
|
+
| e-pyquadtree | 1.005 | 0.660 | 1.665 | 1.05× |
|
79
|
+
| PyQtree | 1.492 | 0.263 | 1.755 | 1.00× |
|
80
|
+
| quads | 1.407 | 0.484 | 1.890 | 0.93× |
|
81
|
+
|
82
|
+
#### Benchmark Configuration
|
83
|
+
| Parameter | Value |
|
84
|
+
|---|---:|
|
85
|
+
| Bounds | (0, 0, 1000, 1000) |
|
86
|
+
| Max points per node | 128 |
|
87
|
+
| Max depth | 16 |
|
88
|
+
| Queries per experiment | 500 |
|
81
89
|
|
82
90
|
## Install
|
83
91
|
|
@@ -281,7 +289,7 @@ MIT. See `LICENSE`.
|
|
281
289
|
|
282
290
|
## Acknowledgments
|
283
291
|
|
284
|
-
* Python libraries compared: [PyQtree], [e-pyquadtree], [Rtree], [nontree], [quads]
|
292
|
+
* Python libraries compared: [PyQtree], [e-pyquadtree], [Rtree], [nontree], [quads], [Shapely]
|
285
293
|
* Built with [PyO3] and [maturin]
|
286
294
|
|
287
295
|
[PyQtree]: https://pypi.org/project/pyqtree/
|
@@ -290,4 +298,6 @@ MIT. See `LICENSE`.
|
|
290
298
|
[maturin]: https://www.maturin.rs/
|
291
299
|
[Rtree]: https://pypi.org/project/Rtree/
|
292
300
|
[nontree]: https://pypi.org/project/nontree/
|
293
|
-
[quads]: https://pypi.org/project/quads/
|
301
|
+
[quads]: https://pypi.org/project/quads/
|
302
|
+
[Shapely]: https://pypi.org/project/Shapely/
|
303
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
fastquadtree-0.6.1.dist-info/METADATA,sha256=H8lkeuXlgH2BCxZSzEvFAKnLANM4H52NG78hT7AObUk,10746
|
2
|
+
fastquadtree-0.6.1.dist-info/WHEEL,sha256=F7HFsRl56IeLjGhxiHeG3IpurHNaGNHQJeIy7gdwTO4,94
|
3
|
+
fastquadtree-0.6.1.dist-info/licenses/LICENSE,sha256=46IVFhoCIwMo-ocq4olyEB1eBvvtaKic5yGLeKXnDuc,1092
|
4
|
+
fastquadtree/__init__.py,sha256=o7zH6lOu2lTxMafl9FNVZiecM0KVxqhC3FNSRbpaaqY,12435
|
5
|
+
fastquadtree/__init__.pyi,sha256=_HGJ9lpIZ9-JTSfMKSn8aif_tu60m2vgOXR4d0uXnRY,2062
|
6
|
+
fastquadtree/_bimap.py,sha256=SPFFw9hWAVRKZVXyDGYFFNw4MLV8qUlOq8gDbLcTqkg,3402
|
7
|
+
fastquadtree/_item.py,sha256=p-ymnE9S-c8Lc00KhNKN9Pt4bd05nZ6g-DB8q8D9zYk,533
|
8
|
+
fastquadtree/_native.pyd,sha256=OHlc3FG-kZbjt2YW2QM9I809C1FRQlV6RQXcPcQLNhM,254464
|
9
|
+
fastquadtree/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
|
+
fastquadtree-0.6.1.dist-info/RECORD,,
|
@@ -1,10 +0,0 @@
|
|
1
|
-
fastquadtree-0.5.1.dist-info/METADATA,sha256=3tYPbCeIMK_f0U0lR1_oeKPagw3M00sPO2GYq6us-xs,10443
|
2
|
-
fastquadtree-0.5.1.dist-info/WHEEL,sha256=7bfl5v0wbVhXZba613g0x-n2obNNfpQuN8I1cQ4oaU8,94
|
3
|
-
fastquadtree-0.5.1.dist-info/licenses/LICENSE,sha256=46IVFhoCIwMo-ocq4olyEB1eBvvtaKic5yGLeKXnDuc,1092
|
4
|
-
fastquadtree/__init__.py,sha256=NhKAMKyc9N6UV1BKpyF4ssGamLiZlwi-gqwx1znhDEw,12583
|
5
|
-
fastquadtree/__init__.pyi,sha256=hoX8-dibrH3Q9kv8M-h0Tac0BsJAoh1VYMd84vayhDE,2137
|
6
|
-
fastquadtree/_bimap.py,sha256=SPFFw9hWAVRKZVXyDGYFFNw4MLV8qUlOq8gDbLcTqkg,3402
|
7
|
-
fastquadtree/_item.py,sha256=p-ymnE9S-c8Lc00KhNKN9Pt4bd05nZ6g-DB8q8D9zYk,533
|
8
|
-
fastquadtree/_native.pyd,sha256=Wz9Z_lSFp6JCgOY5gCYeHl4RwzgCyoyB-ZAgvoWVVhA,247808
|
9
|
-
fastquadtree/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
|
-
fastquadtree-0.5.1.dist-info/RECORD,,
|
File without changes
|