vigna / sux-rs

Rust implementations of succinct data structures
Apache License 2.0
46 stars 7 forks source link

We need a BitVec trait to be able to forward its methods #40

Closed vigna closed 4 months ago

vigna commented 5 months ago

At the moment, one can functorially add rank, select and zero-select structures incrementally, and delegation methods make it possible to access all functionality of such structures. However, the only delegation of the lower level (bit vector) are the length and AsRef<[usize]>. It would be natural to have a bit vector trait and delegate the corresponding method throughout all structures.

zommiommy commented 5 months ago

I think it's reasonable, I don't know if we might want a same index to handle both explicit bit vectors and implicit representations of it. The other options is just to make specialised indices that can be used when the underlying data is a bitvector

vigna commented 5 months ago

Presently we just decided to forward BitLength + Index<usize, Output = bool>, as it provides full functionality. It might be interesting to move some of the code of BitVec to a trait based on those two traits and AsRef<[usize]>, as that would make full bitvector functionality available.

vigna commented 4 months ago

Closing the issue as for maximum performance we presently have only AsRef<[usize]>-based bit vectors.