Package org.roaringbitmap.buffer
Class BufferFastAggregation
- java.lang.Object
-
- org.roaringbitmap.buffer.BufferFastAggregation
-
public final class BufferFastAggregation extends java.lang.Object
Fast algorithms to aggregate many bitmaps.
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static MutableRoaringBitmap
and(long[] aggregationBuffer, java.util.Iterator<? extends ImmutableRoaringBitmap> bitmaps)
Compute the AND aggregate.static MutableRoaringBitmap
and(long[] aggregationBuffer, ImmutableRoaringBitmap... bitmaps)
Compute the AND aggregate.static MutableRoaringBitmap
and(java.util.Iterator<? extends ImmutableRoaringBitmap> bitmaps)
Compute the AND aggregate.static MutableRoaringBitmap
and(ImmutableRoaringBitmap... bitmaps)
Compute the AND aggregate.static MutableRoaringBitmap
and(MutableRoaringBitmap... bitmaps)
Compute the AND aggregate.static java.util.Iterator<ImmutableRoaringBitmap>
convertToImmutable(java.util.Iterator<MutableRoaringBitmap> i)
Convenience method converting one type of iterator into another, to avoid unnecessary warnings.static MutableRoaringBitmap
horizontal_or(java.util.Iterator bitmaps)
Deprecated.static MutableRoaringBitmap
horizontal_or(ImmutableRoaringBitmap... bitmaps)
Minimizes memory usage while computing the or aggregate on a moderate number of bitmaps.static MutableRoaringBitmap
horizontal_or(MutableRoaringBitmap... bitmaps)
Minimizes memory usage while computing the or aggregate on a moderate number of bitmaps.static MutableRoaringBitmap
horizontal_xor(ImmutableRoaringBitmap... bitmaps)
Minimizes memory usage while computing the xor aggregate on a moderate number of bitmaps.static MutableRoaringBitmap
horizontal_xor(MutableRoaringBitmap... bitmaps)
Minimizes memory usage while computing the xor aggregate on a moderate number of bitmaps.static MutableRoaringBitmap
naive_and(java.util.Iterator bitmaps)
Compute overall AND between bitmaps two-by-two.static MutableRoaringBitmap
naive_and(ImmutableRoaringBitmap... bitmaps)
Compute overall AND between bitmaps two-by-two.static MutableRoaringBitmap
naive_and(MutableRoaringBitmap... bitmaps)
Compute overall AND between bitmaps two-by-two.static MutableRoaringBitmap
naive_or(java.util.Iterator bitmaps)
Compute overall OR between bitmaps two-by-two.static MutableRoaringBitmap
naive_or(ImmutableRoaringBitmap... bitmaps)
Compute overall OR between bitmaps two-by-two.static MutableRoaringBitmap
naive_or(MutableRoaringBitmap... bitmaps)
Compute overall OR between bitmaps two-by-two.static MutableRoaringBitmap
naive_xor(java.util.Iterator bitmaps)
Compute overall XOR between bitmaps two-by-two.static MutableRoaringBitmap
naive_xor(ImmutableRoaringBitmap... bitmaps)
Compute overall XOR between bitmaps two-by-two.static MutableRoaringBitmap
naive_xor(MutableRoaringBitmap... bitmaps)
Compute overall XOR between bitmaps two-by-two.static MutableRoaringBitmap
or(java.util.Iterator bitmaps)
Compute overall OR between bitmaps.static MutableRoaringBitmap
or(ImmutableRoaringBitmap... bitmaps)
Compute overall OR between bitmaps.static MutableRoaringBitmap
or(MutableRoaringBitmap... bitmaps)
Compute overall OR between bitmaps.static MutableRoaringBitmap
priorityqueue_or(java.util.Iterator bitmaps)
Uses a priority queue to compute the or aggregate.static MutableRoaringBitmap
priorityqueue_or(ImmutableRoaringBitmap... bitmaps)
Uses a priority queue to compute the or aggregate.static MutableRoaringBitmap
priorityqueue_xor(ImmutableRoaringBitmap... bitmaps)
Uses a priority queue to compute the xor aggregate.static MutableRoaringBitmap
workAndMemoryShyAnd(long[] buffer, ImmutableRoaringBitmap... bitmaps)
Computes the intersection by first intersecting the keys, avoids materialising containers, limits memory usage.static MutableRoaringBitmap
xor(java.util.Iterator bitmaps)
Compute overall XOR between bitmaps.static MutableRoaringBitmap
xor(ImmutableRoaringBitmap... bitmaps)
Compute overall XOR between bitmaps.static MutableRoaringBitmap
xor(MutableRoaringBitmap... bitmaps)
Compute overall XOR between bitmaps.
-
-
-
Method Detail
-
and
public static MutableRoaringBitmap and(ImmutableRoaringBitmap... bitmaps)
Compute the AND aggregate.- Parameters:
bitmaps
- input bitmaps- Returns:
- aggregated bitmap
-
and
public static MutableRoaringBitmap and(long[] aggregationBuffer, ImmutableRoaringBitmap... bitmaps)
Compute the AND aggregate.- Parameters:
aggregationBuffer
- a memory buffer for use in the aggregation. Will be cleared after use.bitmaps
- input bitmaps- Returns:
- aggregated bitmap
-
and
public static MutableRoaringBitmap and(java.util.Iterator<? extends ImmutableRoaringBitmap> bitmaps)
Compute the AND aggregate. In practice, calls {#link workShyAnd}- Parameters:
bitmaps
- input bitmaps (ImmutableRoaringBitmap or MutableRoaringBitmap)- Returns:
- aggregated bitmap
-
and
public static MutableRoaringBitmap and(long[] aggregationBuffer, java.util.Iterator<? extends ImmutableRoaringBitmap> bitmaps)
Compute the AND aggregate. In practice, calls {#link workShyAnd}- Parameters:
aggregationBuffer
- a buffer for use in aggregationsbitmaps
- input bitmaps (ImmutableRoaringBitmap or MutableRoaringBitmap)- Returns:
- aggregated bitmap
-
and
public static MutableRoaringBitmap and(MutableRoaringBitmap... bitmaps)
Compute the AND aggregate. In practice, calls {#link naive_and}- Parameters:
bitmaps
- input bitmaps- Returns:
- aggregated bitmap
-
convertToImmutable
public static java.util.Iterator<ImmutableRoaringBitmap> convertToImmutable(java.util.Iterator<MutableRoaringBitmap> i)
Convenience method converting one type of iterator into another, to avoid unnecessary warnings.- Parameters:
i
- input bitmaps- Returns:
- an iterator over the provided iterator, with a different type
-
horizontal_or
public static MutableRoaringBitmap horizontal_or(ImmutableRoaringBitmap... bitmaps)
Minimizes memory usage while computing the or aggregate on a moderate number of bitmaps. This function runs in linearithmic (O(n log n)) time with respect to the number of bitmaps.- Parameters:
bitmaps
- input bitmaps- Returns:
- aggregated bitmap
- See Also:
or(ImmutableRoaringBitmap...)
-
horizontal_or
@Deprecated public static MutableRoaringBitmap horizontal_or(java.util.Iterator bitmaps)
Deprecated.Calls naive_or.- Parameters:
bitmaps
- input bitmaps (ImmutableRoaringBitmap or MutableRoaringBitmap)- Returns:
- aggregated bitmap
-
horizontal_or
public static MutableRoaringBitmap horizontal_or(MutableRoaringBitmap... bitmaps)
Minimizes memory usage while computing the or aggregate on a moderate number of bitmaps. This function runs in linearithmic (O(n log n)) time with respect to the number of bitmaps.- Parameters:
bitmaps
- input bitmaps- Returns:
- aggregated bitmap
- See Also:
or(ImmutableRoaringBitmap...)
-
horizontal_xor
public static MutableRoaringBitmap horizontal_xor(ImmutableRoaringBitmap... bitmaps)
Minimizes memory usage while computing the xor aggregate on a moderate number of bitmaps. This function runs in linearithmic (O(n log n)) time with respect to the number of bitmaps.- Parameters:
bitmaps
- input bitmaps- Returns:
- aggregated bitmap
- See Also:
xor(ImmutableRoaringBitmap...)
-
horizontal_xor
public static MutableRoaringBitmap horizontal_xor(MutableRoaringBitmap... bitmaps)
Minimizes memory usage while computing the xor aggregate on a moderate number of bitmaps. This function runs in linearithmic (O(n log n)) time with respect to the number of bitmaps.- Parameters:
bitmaps
- input bitmaps- Returns:
- aggregated bitmap
- See Also:
xor(ImmutableRoaringBitmap...)
-
naive_and
public static MutableRoaringBitmap naive_and(ImmutableRoaringBitmap... bitmaps)
Compute overall AND between bitmaps two-by-two. This function runs in linear time with respect to the number of bitmaps.- Parameters:
bitmaps
- input bitmaps- Returns:
- aggregated bitmap
-
naive_and
public static MutableRoaringBitmap naive_and(java.util.Iterator bitmaps)
Compute overall AND between bitmaps two-by-two. This function runs in linear time with respect to the number of bitmaps.- Parameters:
bitmaps
- input bitmaps (ImmutableRoaringBitmap or MutableRoaringBitmap)- Returns:
- aggregated bitmap
-
naive_and
public static MutableRoaringBitmap naive_and(MutableRoaringBitmap... bitmaps)
Compute overall AND between bitmaps two-by-two. This function runs in linear time with respect to the number of bitmaps.- Parameters:
bitmaps
- input bitmaps- Returns:
- aggregated bitmap
-
workAndMemoryShyAnd
public static MutableRoaringBitmap workAndMemoryShyAnd(long[] buffer, ImmutableRoaringBitmap... bitmaps)
Computes the intersection by first intersecting the keys, avoids materialising containers, limits memory usage. You must provide a long[] array of length at least 1024, initialized with zeroes. We do not check whether the array is initialized with zeros: it is the caller's responsability. You should expect this function to be slower than workShyAnd and the reduction in memory usage might be small.- Parameters:
buffer
- should be a 1024-long arraybitmaps
- the inputs- Returns:
- the intersection of the bitmaps
-
naive_or
public static MutableRoaringBitmap naive_or(ImmutableRoaringBitmap... bitmaps)
Compute overall OR between bitmaps two-by-two. This function runs in linear time with respect to the number of bitmaps.- Parameters:
bitmaps
- input bitmaps- Returns:
- aggregated bitmap
-
naive_or
public static MutableRoaringBitmap naive_or(java.util.Iterator bitmaps)
Compute overall OR between bitmaps two-by-two. This function runs in linear time with respect to the number of bitmaps.- Parameters:
bitmaps
- input bitmaps (ImmutableRoaringBitmap or MutableRoaringBitmap)- Returns:
- aggregated bitmap
-
naive_or
public static MutableRoaringBitmap naive_or(MutableRoaringBitmap... bitmaps)
Compute overall OR between bitmaps two-by-two. This function runs in linear time with respect to the number of bitmaps.- Parameters:
bitmaps
- input bitmaps- Returns:
- aggregated bitmap
-
naive_xor
public static MutableRoaringBitmap naive_xor(ImmutableRoaringBitmap... bitmaps)
Compute overall XOR between bitmaps two-by-two. This function runs in linear time with respect to the number of bitmaps.- Parameters:
bitmaps
- input bitmaps- Returns:
- aggregated bitmap
-
naive_xor
public static MutableRoaringBitmap naive_xor(java.util.Iterator bitmaps)
Compute overall XOR between bitmaps two-by-two. This function runs in linear time with respect to the number of bitmaps.- Parameters:
bitmaps
- input bitmaps (ImmutableRoaringBitmap or MutableRoaringBitmap)- Returns:
- aggregated bitmap
-
naive_xor
public static MutableRoaringBitmap naive_xor(MutableRoaringBitmap... bitmaps)
Compute overall XOR between bitmaps two-by-two. This function runs in linear time with respect to the number of bitmaps.- Parameters:
bitmaps
- input bitmaps- Returns:
- aggregated bitmap
-
or
public static MutableRoaringBitmap or(ImmutableRoaringBitmap... bitmaps)
Compute overall OR between bitmaps.- Parameters:
bitmaps
- input bitmaps- Returns:
- aggregated bitmap
-
or
public static MutableRoaringBitmap or(java.util.Iterator bitmaps)
Compute overall OR between bitmaps.- Parameters:
bitmaps
- input bitmaps (ImmutableRoaringBitmap or MutableRoaringBitmap)- Returns:
- aggregated bitmap
-
or
public static MutableRoaringBitmap or(MutableRoaringBitmap... bitmaps)
Compute overall OR between bitmaps.- Parameters:
bitmaps
- input bitmaps- Returns:
- aggregated bitmap
-
priorityqueue_or
public static MutableRoaringBitmap priorityqueue_or(ImmutableRoaringBitmap... bitmaps)
Uses a priority queue to compute the or aggregate. This function runs in linearithmic (O(n log n)) time with respect to the number of bitmaps.- Parameters:
bitmaps
- input bitmaps- Returns:
- aggregated bitmap
- See Also:
horizontal_or(ImmutableRoaringBitmap...)
-
priorityqueue_or
public static MutableRoaringBitmap priorityqueue_or(java.util.Iterator bitmaps)
Uses a priority queue to compute the or aggregate. This function runs in linearithmic (O(n log n)) time with respect to the number of bitmaps.- Parameters:
bitmaps
- input bitmaps- Returns:
- aggregated bitmap
- See Also:
horizontal_or(ImmutableRoaringBitmap...)
-
priorityqueue_xor
public static MutableRoaringBitmap priorityqueue_xor(ImmutableRoaringBitmap... bitmaps)
Uses a priority queue to compute the xor aggregate. This function runs in linearithmic (O(n log n)) time with respect to the number of bitmaps.- Parameters:
bitmaps
- input bitmaps- Returns:
- aggregated bitmap
- See Also:
horizontal_xor(ImmutableRoaringBitmap...)
-
xor
public static MutableRoaringBitmap xor(ImmutableRoaringBitmap... bitmaps)
Compute overall XOR between bitmaps.- Parameters:
bitmaps
- input bitmaps- Returns:
- aggregated bitmap
-
xor
public static MutableRoaringBitmap xor(java.util.Iterator bitmaps)
Compute overall XOR between bitmaps.- Parameters:
bitmaps
- input bitmaps (ImmutableRoaringBitmap or MutableRoaringBitmap)- Returns:
- aggregated bitmap
-
xor
public static MutableRoaringBitmap xor(MutableRoaringBitmap... bitmaps)
Compute overall XOR between bitmaps.- Parameters:
bitmaps
- input bitmaps- Returns:
- aggregated bitmap
-
-