wavelet-matrix 2.0.1__cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.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.
@@ -0,0 +1,5 @@
1
+ from .wavelet_matrix import *
2
+
3
+ __doc__ = wavelet_matrix.__doc__
4
+ if hasattr(wavelet_matrix, "__all__"):
5
+ __all__ = wavelet_matrix.__all__
@@ -0,0 +1,63 @@
1
+ from typing import Iterable
2
+
3
+ class WaveletMatrix:
4
+ def __init__(self, data: Iterable[int]) -> None: ...
5
+ def __getitem__(self, index: int) -> int: ...
6
+ def __len__(self) -> int: ...
7
+ def __str__(self) -> str: ...
8
+ def __repr__(self) -> str: ...
9
+ def __copy__(self) -> WaveletMatrix: ...
10
+ def __deepcopy__(self, memo) -> WaveletMatrix: ...
11
+ def values(self) -> list[int]: ...
12
+ def access(self, index: int) -> int: ...
13
+ def rank(self, value: int, end: int) -> int: ...
14
+ def select(self, value: int, kth: int) -> int | None: ...
15
+ def quantile(self, start: int, end: int, kth: int) -> int: ...
16
+ def topk(self, start: int, end: int, k: int | None = None) -> list[dict[str, int]]: ...
17
+ def range_sum(self, start: int, end: int) -> int: ...
18
+ def range_intersection(
19
+ self, start1: int, end1: int, start2: int, end2: int
20
+ ) -> list[dict[str, int]]: ...
21
+ def range_freq(
22
+ self, start: int, end: int, lower: int | None = None, upper: int | None = None
23
+ ) -> int: ...
24
+ def range_list(
25
+ self, start: int, end: int, lower: int | None = None, upper: int | None = None
26
+ ) -> list[dict[str, int]]: ...
27
+ def range_maxk(self, start: int, end: int, k: int | None = None) -> list[dict[str, int]]: ...
28
+ def range_mink(self, start: int, end: int, k: int | None = None) -> list[dict[str, int]]: ...
29
+ def prev_value(self, start: int, end: int, upper: int | None = None) -> int | None: ...
30
+ def next_value(self, start: int, end: int, lower: int | None = None) -> int | None: ...
31
+
32
+ class DynamicWaveletMatrix:
33
+ def __init__(self, data: Iterable[int], max_bit: int | None = None) -> None: ...
34
+ def __getitem__(self, index: int) -> int: ...
35
+ def __len__(self) -> int: ...
36
+ def __str__(self) -> str: ...
37
+ def __repr__(self) -> str: ...
38
+ def __copy__(self) -> DynamicWaveletMatrix: ...
39
+ def __deepcopy__(self, memo) -> DynamicWaveletMatrix: ...
40
+ def values(self) -> list[int]: ...
41
+ def access(self, index: int) -> int: ...
42
+ def rank(self, value: int, end: int) -> int: ...
43
+ def select(self, value: int, kth: int) -> int | None: ...
44
+ def quantile(self, start: int, end: int, kth: int) -> int: ...
45
+ def topk(self, start: int, end: int, k: int | None = None) -> list[dict[str, int]]: ...
46
+ def range_sum(self, start: int, end: int) -> int: ...
47
+ def range_intersection(
48
+ self, start1: int, end1: int, start2: int, end2: int
49
+ ) -> list[dict[str, int]]: ...
50
+ def range_freq(
51
+ self, start: int, end: int, lower: int | None = None, upper: int | None = None
52
+ ) -> int: ...
53
+ def range_list(
54
+ self, start: int, end: int, lower: int | None = None, upper: int | None = None
55
+ ) -> list[dict[str, int]]: ...
56
+ def range_maxk(self, start: int, end: int, k: int | None = None) -> list[dict[str, int]]: ...
57
+ def range_mink(self, start: int, end: int, k: int | None = None) -> list[dict[str, int]]: ...
58
+ def prev_value(self, start: int, end: int, upper: int | None = None) -> int | None: ...
59
+ def next_value(self, start: int, end: int, lower: int | None = None) -> int | None: ...
60
+ def max_bit(self) -> int: ...
61
+ def insert(self, index: int, value: int) -> None: ...
62
+ def remove(self, index: int) -> int: ...
63
+ def update(self, index: int, value: int) -> int: ...
File without changes
@@ -0,0 +1,214 @@
1
+ Metadata-Version: 2.4
2
+ Name: wavelet-matrix
3
+ Version: 2.0.1
4
+ Classifier: Intended Audience :: Developers
5
+ Classifier: Intended Audience :: Science/Research
6
+ Classifier: Intended Audience :: Information Technology
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.9
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Programming Language :: Python :: 3.14
15
+ Classifier: Programming Language :: Python :: Implementation :: CPython
16
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
19
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
20
+ Requires-Dist: maturin>=1.9,<2.0 ; extra == 'dev'
21
+ Requires-Dist: pdoc>=16.0 ; extra == 'dev'
22
+ Requires-Dist: pytest>=7.0 ; extra == 'dev'
23
+ Requires-Dist: pytest-benchmark>=4.0 ; extra == 'dev'
24
+ Requires-Dist: ruff>=0.14 ; extra == 'dev'
25
+ Provides-Extra: dev
26
+ License-File: LICENSE
27
+ Summary: High-performance indexed sequence data structure powered by Rust, supporting fast rank/select and range queries.
28
+ Keywords: wavelet matrix,data structure,algorithm,sequence index,rank,select,quantile,top-k,range query,dynamic update,indexing,succinct
29
+ Author: Koki Watanabe
30
+ Requires-Python: >=3.9
31
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
32
+ Project-URL: homepage, https://github.com/math-hiyoko/wavelet-matrix
33
+ Project-URL: documentation, https://math-hiyoko.github.io/wavelet-matrix
34
+ Project-URL: repository, https://github.com/math-hiyoko/wavelet-matrix
35
+
36
+ # Wavelet Matrix
37
+
38
+ High-performance indexed sequence data structure powered by Rust, supporting fast rank/select and range queries.
39
+
40
+ - Document: https://math-hiyoko.github.io/wavelet-matrix
41
+ - Repository: https://github.com/math-hiyoko/wavelet-matrix
42
+
43
+
44
+ ## Quick Start
45
+
46
+ ### WaveletMatrix
47
+ ```python
48
+ >>> from wavelet_matrix import WaveletMatrix
49
+ >>>
50
+ >>> # Create a WaveletMatrix
51
+ >>> data = [5, 4, 5, 5, 2, 1, 5, 6, 1, 3, 5, 0]
52
+ >>> wm = WaveletMatrix(data)
53
+ >>> wm
54
+ WaveletMatrix([5, 4, 5, 5, 2, 1, 5, 6, 1, 3, 5, 0])
55
+ ```
56
+
57
+ #### Count occurrences (rank)
58
+ ```python
59
+ >>> # Count of 5 in the range [0, 9)
60
+ >>> wm.rank(value=5, end=9)
61
+ 4
62
+ ```
63
+
64
+ #### Find position (select)
65
+ ```python
66
+ >>> # Find the index of 4th occurrence of value 5
67
+ >>> wm.select(value=5, kth=4)
68
+ 6
69
+ ```
70
+
71
+ #### Find k-th smallest (quantile)
72
+ ```python
73
+ >>> # Find 8th smallest value in the range [2, 12)
74
+ >>> wm.quantile(start=2, end=12, kth=8)
75
+ 5
76
+ ```
77
+
78
+ #### List top-k highest frequent values (topk)
79
+ ```python
80
+ >>> # List values in [1, 10) with the top-2 highest frequencies.
81
+ >>> wm.topk(start=1, end=10, k=2)
82
+ [{'value': 5, 'count': 3}, {'value': 1, 'count': 2}]
83
+ ```
84
+
85
+ #### Sum values in a range (range_sum)
86
+ ```python
87
+ >>> # Sum of elements in the range [2, 8).
88
+ >>> wm.range_sum(start=2, end=8)
89
+ 24
90
+ ```
91
+
92
+ #### List intersection of two ranges (range_intersection)
93
+ ```python
94
+ >>> # List the intersection of two ranges [0, 6) and [6, 11).
95
+ >>> wm.range_intersection(start1=0, end1=6, start2=6, end2=11)
96
+ [{'value': 1, 'count1': 1, 'count2': 1}, {'value': 5, 'count1': 3, 'count2': 2}]
97
+ ```
98
+
99
+ #### Count values in a range (range_freq)
100
+ ```python
101
+ >>> # Count values c in the range [1, 9) such that 4 <= c < 6.
102
+ >>> wm.range_freq(start=1, end=9, lower=4, upper=6)
103
+ 4
104
+ ```
105
+
106
+ #### List values in a range (range_list)
107
+ ```python
108
+ >>> # List values c in the range [1, 9) such that 4 <= c < 6.
109
+ >>> wm.range_list(start=1, end=9, lower=4, upper=6)
110
+ [{'value': 4, 'count': 1}, {'value': 5, 'count': 3}]
111
+ ```
112
+
113
+ #### List top-k maximum values (range_maxk)
114
+ ```python
115
+ >>> # List values in [1, 9) with the top-2 maximum values.
116
+ >>> wm.range_maxk(start=1, end=9, k=2)
117
+ [{'value': 6, 'count': 1}, {'value': 5, 'count': 3}]
118
+ ```
119
+
120
+ #### List top-k minimum values (range_mink)
121
+ ```python
122
+ >>> # List values in [1, 9) with the top-2 minimum values.
123
+ >>> wm.range_mink(start=1, end=9, k=2)
124
+ [{'value': 1, 'count': 2}, {'value': 2, 'count': 1}]
125
+ ```
126
+
127
+ #### Get the maximun value (prev_value)
128
+ ```python
129
+ >>> # Get the maximum value c in the range [1, 9) such that c < 7.
130
+ >>> wm.prev_value(start=1, end=9, upper=7)
131
+ 6
132
+ ```
133
+
134
+ #### Get the minimun value (next_value)
135
+ ```python
136
+ >>> # Get the minimum value c in the range [1, 9) such that 4 <= c.
137
+ >>> wm.next_value(start=1, end=9, lower=4)
138
+ 4
139
+ ```
140
+
141
+ ### Dynamic Wavelet Matrix
142
+ ```python
143
+ >>> from wavelet_matrix import DynamicWaveletMatrix
144
+ >>>
145
+ >>> # Create a DynamicWaveletMatrix
146
+ >>> # max_bit sets the maximum bit-width of stored values (auto-inferred if omitted).
147
+ >>> data = [5, 4, 5, 5, 2, 1, 5, 6, 1, 3, 5, 0]
148
+ >>> dwm = DynamicWaveletMatrix(data, max_bit=4)
149
+ >>> dwm
150
+ DynamicWaveletMatrix([5, 4, 5, 5, 2, 1, 5, 6, 1, 3, 5, 0], max_bit=4)
151
+ ```
152
+
153
+ #### Insert value (insert)
154
+ ```python
155
+ >>> dwm
156
+ DynamicWaveletMatrix([5, 4, 5, 5, 2, 1, 5, 6, 1, 3, 5, 0], max_bit=4)
157
+ >>> # Inserts 8 at index 4.
158
+ >>> # The bit width of the new value must not exceed max_bit.
159
+ >>> dwm.insert(index=4, value=8)
160
+ >>> dwm
161
+ DynamicWaveletMatrix([5, 4, 5, 5, 8, 2, 1, 5, 6, 1, 3, 5, 0], max_bit=4)
162
+ ```
163
+
164
+ #### Remove value (remove)
165
+ ```python
166
+ >>> dwm
167
+ DynamicWaveletMatrix([5, 4, 5, 5, 8, 2, 1, 5, 6, 1, 3, 5, 0], max_bit=4)
168
+ >>> # Remove the value at index 4.
169
+ >>> dwm.remove(index=4)
170
+ 8
171
+ >>> dwm
172
+ DynamicWaveletMatrix([5, 4, 5, 5, 2, 1, 5, 6, 1, 3, 5, 0], max_bit=4)
173
+ ```
174
+
175
+ #### Update value (update)
176
+ ```python
177
+ >>> dwm
178
+ DynamicWaveletMatrix([5, 4, 5, 5, 2, 1, 5, 6, 1, 3, 5, 0], max_bit=4)
179
+ >>> # Update the value at index 4 to 5
180
+ >>> # The bit width of the new value must not exceed max_bit.
181
+ >>> dwm.update(index=4, value=5)
182
+ 2
183
+ >>> dwm
184
+ DynamicWaveletMatrix([5, 4, 5, 5, 5, 1, 5, 6, 1, 3, 5, 0], max_bit=4)
185
+ ```
186
+
187
+ ## Development
188
+
189
+ ### Running Tests
190
+
191
+ ```bash
192
+ $ pip install -e ".[dev]"
193
+
194
+ # Cargo test
195
+ $ cargo test --all --release
196
+
197
+ # Run tests
198
+ $ pytest --benchmark-skip
199
+
200
+ # Run benchmarks
201
+ $ pytest --benchmark-only
202
+ ```
203
+
204
+ ## References
205
+
206
+ - Francisco Claude, Gonzalo Navarro, Alberto Ordóñez,
207
+ The wavelet matrix: An efficient wavelet tree for large alphabets,
208
+ Information Systems,
209
+ Volume 47,
210
+ 2015,
211
+ Pages 15-32,
212
+ ISSN 0306-4379,
213
+ https://doi.org/10.1016/j.is.2014.06.002.
214
+
@@ -0,0 +1,8 @@
1
+ wavelet_matrix-2.0.1.dist-info/METADATA,sha256=Qrb1gc_Gam7Krcoj58K1EZcMdk7ZpDBN5J0-7GyPG3I,6263
2
+ wavelet_matrix-2.0.1.dist-info/WHEEL,sha256=2IDlv-zwrdhNo5yIhN9Z6LFfXMwNY8Z9N7ZBX4JgDAk,149
3
+ wavelet_matrix-2.0.1.dist-info/licenses/LICENSE,sha256=RLItjifD2pjpecDwt0BdQ7bFR6517amHYtkEENvrPac,1060
4
+ wavelet_matrix/__init__.py,sha256=bY2bBHUr5LI7lsksSDxTm_ZQY6vJGBV63B5ryuJVa-U,139
5
+ wavelet_matrix/__init__.pyi,sha256=EomBIOBB63drZDkP025K3IMqmFARHTkC8Pb_rDOyY9A,3309
6
+ wavelet_matrix/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ wavelet_matrix/wavelet_matrix.cpython-313-aarch64-linux-gnu.so,sha256=fty2NF1MyJZFg-RSuI_5oYeG4OljiVC8OumrvpH5q_Q,1474528
8
+ wavelet_matrix-2.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.10.2)
3
+ Root-Is-Purelib: false
4
+ Tag: cp313-cp313-manylinux_2_17_aarch64
5
+ Tag: cp313-cp313-manylinux2014_aarch64
@@ -0,0 +1,7 @@
1
+ Copyright 2025 Koki Watanabe
2
+
3
+ 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:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ 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.