Show HN: High-Performance Wavelet Matrix for Python, Implemented in Rust
Posted by math-hiyoko 2 days ago
I built a Rust-powered Wavelet Matrix library for Python.
There were surprisingly few practical Wavelet Matrix implementations available for Python, so I implemented one with a focus on performance, usability, and typed APIs. It supports fast rank/select, top-k, quantile, range queries, and even dynamic updates.
Feedback welcome!
Comments
Comment by koolala 2 days ago
Comment by mrkeen 2 days ago
Popcount works great in this context, but that only gives you linear speedups. Doing rank/select in O(1) instead of O(N) is a bigger win, and you get that by precomputing superblocks.
> Or are they used with 4x4 Matrix operators? Are wavelets good for that kind of math?
Nope, different kind of matrix. Just refers to a nicer packing of a wavelet tree with space wasted by bookkeeping pointers between tree nodes.
Comment by yourdetect 1 day ago
Comment by math-hiyoko 1 day ago
Comment by simgt 1 day ago
No.
Comment by kennykartman 1 day ago
Comment by joshlk 1 day ago
Comment by mrkeen 1 day ago
The matrix version is just an implementation detail to store the tree in a less tree-like shape so you don't need as many pointers.
Comment by atoav 1 day ago
Many people don't know what you would use wavelets for or where they really shine. I for example know wavelets are used in image compression algorithms but that's about it. I am curious where else this could be applied.
Comment by math-hiyoko 1 day ago
Comment by heya1993 2 days ago