Registry / data / wavelet-matrix

wavelet-matrix

JSON →
library2.1.8pypypi✓ verified 85d ago

A high-performance indexed sequence data structure powered by Rust, supporting fast rank/select and range queries. Current version 2.1.8, requires Python >=3.9. Released under MIT license; maintained by wm-team.

pip install wavelet-matrix
INSTALL
IMPORT
SIG · WAVELET-MATRIX
W
wavelet-matrix
datapythonv2.1.8
Install
2.6s avg
Import
Disk
19MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.1.8 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 21MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.6s · import 0.000s · 21MB
19MB installed
● package 19MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

WaveletMatrix
from wavelet_matrix import WaveletMatrix
from waveletmatrix import WaveletMatrix
Hyphen in package name, underscore in import module name.

Basic usage: create a WaveletMatrix from a list of integers, then use rank, select, and quantile methods.

from wavelet_matrix import WaveletMatrix data = [5, 3, 1, 4, 2] wm = WaveletMatrix(data) print(wm.rank(3, 2)) # rank of value 3 up to index 2 print(wm.select(1, 1)) # position of the 1st occurrence of value 1 print(wm.quantile(0, 4, 2)) # 2nd smallest in range [0,4]
Debug
Known issues
breakingIn version 2.0, the constructor argument order changed from `data, alphabet_size` to `data` only, with automatic alphabet detection. Code using `WaveletMatrix(data, 256)` will raise TypeError.
fix
Remove the second argument from constructor: `WaveletMatrix(data)`.
affects: >=2.0.0
gotchaRank and select methods are 0-indexed. `rank(value, index)` returns count of `value` up to and including the position `index`. `select(value, k)` returns the 0-based position of the kth occurrence (k is 0-based).
fix
Ensure indices are 0-based. For 1-based indexing, adjust by -1.
affects: all
gotchaThe library only supports non-negative integers up to 2^31-1. Negative numbers or floats will raise TypeError or overflow.
fix
Map your data to non-negative integers before constructing the WaveletMatrix.
affects: all
Errors
Common errors & fixes
AttributeError: module 'wavelet_matrix' has no attribute 'WaveletMatrix'
Importing using the package name with hyphen instead of underscore.
fix
Use `from wavelet_matrix import WaveletMatrix` (note underscore).
TypeError: WaveletMatrix.__init__() got multiple values for argument 'data'
Passing the old second argument (alphabet_size) to constructor.
fix
Call `WaveletMatrix(data)` without alphabet size. The class now infers alphabet automatically.
ValueError: Rank query index out of range
Passing an index >= length of the sequence.
fix
Ensure index < len(wavelet_matrix). Rank indices are 0-based up to n-1.
Upgrade
Version history
2.1.8latest on PyPI · released Mar 16, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
36 hits · last 30 days
node
28
OpenAI (training)
1
Resources
wavelet-matrix — pip install wavelet-matrix · libregistry