New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RoaringBitmap add an efficient findOffset
method for the index of one assigned value.
#627
Comments
You could try using a |
@shouriken Are you looking for better Or do you look for something like |
@blacelle @richardstartin |
You can't know the offset without knowing the cumulative cardinality, so a binary search approach couldn't work without either computing or looking up the cumulative cardinality. The mismatch between These operations could be fused into a single method but I don't envisage that a fused operation implemented here would offer much advantage over doing it yourself, and the benefit of not implementing it here is that it might confuse users for what probably isn't the most common use case. |
This is essentially the implementation of
I finally get the use-case of @shouriken . For the record, a suggested .findOffset (with
@shouriken If you look for performance, try with |
FWIW I'm surprised this wasn't clear from what's written above.
Yes, this is what was being suggested above. |
The C version of Roaring has a function called The problem with the following is that it entails two potentially expensive queries... rank = bitmap.rank(n);
if (bitmap.contains(n)) {
return rank;
} else {
return -rank-1;
} A single I invite a pull request. |
Hello, i want use roaring bitmap to store indices of a sparse array; in sparse array, there is a frequently-used method
valueAt(int index)
. RoaringBitmap provide thecontains
method, i can use it to judgeindex
if assigned index; if not assigned, sparse array return a default value; but if assigned, there is not method provided by finding theoffset
ofindex
, now i userank(index) - 1
to get the offset, it seems not efficient enough.If you can provide this method?
Thanks.
The text was updated successfully, but these errors were encountered: