Specific scenario consultation

16 views
Skip to first unread message

Matan Tennenhaus

unread,
Sep 24, 2024, 5:34:42 PM9/24/24
to Roaring Bitmaps
Hi,
I am trying to find an optimized algorithm using roaring API for my problem.
I have 3 existing bitmaps: a, b, c.
The algorithm:
temp = a & b;
c += temp;
a -= temp;
b -= temp;
(remove from a and b the intersection, and add it to c).
I cannot find API's which let me cache somehow the results and used it, and i feel i need to do some calculations multiple times..
I would be glad to get recommendations on how to use roaring API the most efficiently in this scenario.

Many thanks in advance,
Matan.

Daniel Lemire

unread,
Sep 24, 2024, 5:55:01 PM9/24/24
to Roaring Bitmaps
Can you illustrate your issue using software code? Please elaborate on the issue.

Matan Tennenhaus

unread,
Sep 25, 2024, 2:50:30 AM9/25/24
to Roaring Bitmaps
    /* intersect */
    tmp = roaring64_bitmap_and(al, bl);
    /* al = al - tmp*/
    roaring64_bitmap_andnot_inplace(al, tmp);
    /* bl = bl - intr */
    roaring64_bitmap_andnot_inplace(bl, tmp);
    /* cl = cl + tmp*/
    roaring64_bitmap_or_inpalce(cl, tmp);

ב-יום רביעי, 25 בספטמבר 2024 בשעה 00:55:01 UTC+3, Daniel Lemire כתב/ה:

Daniel Lemire

unread,
Sep 25, 2024, 7:53:28 AM9/25/24
to Matan Tennenhaus, Roaring Bitmaps
Your code looks fine to me. Of course, we have that...

a -= (a&b)

is equal to

a -= b

But that's just basic set theory... I don't see anything specific to Roaring bitmaps in the computation you are doing. 

--
You received this message because you are subscribed to the Google Groups "Roaring Bitmaps" group.
To unsubscribe from this group and stop receiving emails from it, send an email to roaring-bitma...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/roaring-bitmaps/31a0f057-e49f-4e6b-a0f4-b25f6bd68910n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages