Package org.roaringbitmap
Class FastAggregation
- java.lang.Object
-
- org.roaringbitmap.FastAggregation
-
public final class FastAggregation extends java.lang.ObjectFast algorithms to aggregate many bitmaps.
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static RoaringBitmapand(long[] aggregationBuffer, RoaringBitmap... bitmaps)Compute the AND aggregate.static RoaringBitmapand(java.util.Iterator<? extends RoaringBitmap> bitmaps)Compute the AND aggregate.static RoaringBitmapand(RoaringBitmap... bitmaps)Compute the AND aggregate.static RoaringBitmaphorizontal_or(java.util.Iterator<? extends RoaringBitmap> bitmaps)Deprecated.static RoaringBitmaphorizontal_or(java.util.List<? extends RoaringBitmap> bitmaps)Minimizes memory usage while computing the or aggregate on a moderate number of bitmaps.static RoaringBitmaphorizontal_or(RoaringBitmap... bitmaps)Minimizes memory usage while computing the or aggregate on a moderate number of bitmaps.static RoaringBitmaphorizontal_xor(RoaringBitmap... bitmaps)Minimizes memory usage while computing the xor aggregate on a moderate number of bitmaps.static RoaringBitmapnaive_and(java.util.Iterator<? extends RoaringBitmap> bitmaps)Compute overall AND between bitmaps two-by-two.static RoaringBitmapnaive_and(RoaringBitmap... bitmaps)Compute overall AND between bitmaps two-by-two.static RoaringBitmapnaive_or(java.util.Iterator<? extends RoaringBitmap> bitmaps)Compute overall OR between bitmaps two-by-two.static RoaringBitmapnaive_or(RoaringBitmap... bitmaps)Compute overall OR between bitmaps two-by-two.static RoaringBitmapnaive_xor(java.util.Iterator<? extends RoaringBitmap> bitmaps)Compute overall XOR between bitmaps two-by-two.static RoaringBitmapnaive_xor(RoaringBitmap... bitmaps)Compute overall XOR between bitmaps two-by-two.static RoaringBitmapor(java.util.Iterator<? extends RoaringBitmap> bitmaps)Compute overall OR between bitmaps.static RoaringBitmapor(RoaringBitmap... bitmaps)Compute overall OR between bitmaps.static RoaringBitmappriorityqueue_or(java.util.Iterator<? extends RoaringBitmap> bitmaps)Uses a priority queue to compute the or aggregate.static RoaringBitmappriorityqueue_or(RoaringBitmap... bitmaps)Uses a priority queue to compute the or aggregate.static RoaringBitmappriorityqueue_xor(RoaringBitmap... bitmaps)Uses a priority queue to compute the xor aggregate.static RoaringBitmapworkAndMemoryShyAnd(long[] buffer, RoaringBitmap... bitmaps)Computes the intersection by first intersecting the keys, avoids materialising containers, limits memory usage.static RoaringBitmapworkShyAnd(long[] buffer, RoaringBitmap... bitmaps)Computes the intersection by first intersecting the keys, avoids materialising containers.static RoaringBitmapxor(java.util.Iterator<? extends RoaringBitmap> bitmaps)Compute overall XOR between bitmaps.static RoaringBitmapxor(RoaringBitmap... bitmaps)Compute overall XOR between bitmaps.
-
-
-
Method Detail
-
and
public static RoaringBitmap and(java.util.Iterator<? extends RoaringBitmap> bitmaps)
Compute the AND aggregate. In practice, calls {#link naive_and}- Parameters:
bitmaps- input bitmaps- Returns:
- aggregated bitmap
-
and
public static RoaringBitmap and(RoaringBitmap... bitmaps)
Compute the AND aggregate.- Parameters:
bitmaps- input bitmaps- Returns:
- aggregated bitmap
-
and
public static RoaringBitmap and(long[] aggregationBuffer, RoaringBitmap... bitmaps)
Compute the AND aggregate.- Parameters:
aggregationBuffer- a buffer for aggregationbitmaps- input bitmaps- Returns:
- aggregated bitmap
-
horizontal_or
@Deprecated public static RoaringBitmap horizontal_or(java.util.Iterator<? extends RoaringBitmap> bitmaps)
Deprecated.Calls naive_or.- Parameters:
bitmaps- input bitmaps- Returns:
- aggregated bitmap
-
horizontal_or
public static RoaringBitmap horizontal_or(java.util.List<? extends RoaringBitmap> 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(RoaringBitmap...)
-
horizontal_or
public static RoaringBitmap horizontal_or(RoaringBitmap... 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(RoaringBitmap...)
-
horizontal_xor
public static RoaringBitmap horizontal_xor(RoaringBitmap... 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(RoaringBitmap...)
-
naive_and
public static RoaringBitmap naive_and(java.util.Iterator<? extends RoaringBitmap> 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 RoaringBitmap naive_and(RoaringBitmap... 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
-
workShyAnd
public static RoaringBitmap workShyAnd(long[] buffer, RoaringBitmap... bitmaps)
Computes the intersection by first intersecting the keys, avoids materialising containers.- Parameters:
buffer- an 8KB bufferbitmaps- the inputs- Returns:
- the intersection of the bitmaps
-
workAndMemoryShyAnd
public static RoaringBitmap workAndMemoryShyAnd(long[] buffer, RoaringBitmap... 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 RoaringBitmap naive_or(java.util.Iterator<? extends RoaringBitmap> 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 RoaringBitmap naive_or(RoaringBitmap... 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 RoaringBitmap naive_xor(java.util.Iterator<? extends RoaringBitmap> 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 RoaringBitmap naive_xor(RoaringBitmap... 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 RoaringBitmap or(java.util.Iterator<? extends RoaringBitmap> bitmaps)
Compute overall OR between bitmaps.- Parameters:
bitmaps- input bitmaps- Returns:
- aggregated bitmap
-
or
public static RoaringBitmap or(RoaringBitmap... bitmaps)
Compute overall OR between bitmaps.- Parameters:
bitmaps- input bitmaps- Returns:
- aggregated bitmap
-
priorityqueue_or
public static RoaringBitmap priorityqueue_or(java.util.Iterator<? extends RoaringBitmap> 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(RoaringBitmap...)
-
priorityqueue_or
public static RoaringBitmap priorityqueue_or(RoaringBitmap... 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(RoaringBitmap...)
-
priorityqueue_xor
public static RoaringBitmap priorityqueue_xor(RoaringBitmap... 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(RoaringBitmap...)
-
xor
public static RoaringBitmap xor(java.util.Iterator<? extends RoaringBitmap> bitmaps)
Compute overall XOR between bitmaps.- Parameters:
bitmaps- input bitmaps- Returns:
- aggregated bitmap
-
xor
public static RoaringBitmap xor(RoaringBitmap... bitmaps)
Compute overall XOR between bitmaps.- Parameters:
bitmaps- input bitmaps- Returns:
- aggregated bitmap
-
-