Bitmap functions work on two bitmaps object value, returning new bitmap or cardinality. Available calculation are: and, or, xor, and not.

Bitmap objects can be constructed from an array or converted back from a Bitmap object to an array.

bitmapBuild

bitmapBuild builds a bitmap from unsigned integer array.

Parameters:

  • array – unsigned integer array

Usage:

  • bitmapBuild(array)

Returns:

  • Bitmap object for use in calculations.

bitmapToArray

bitmapToArray converts a bitmap to an integer array.

Parameters:

  • bitmap – bitmap object

Usage:

  • bitmapToArray(bitmap)

Returns:

  • UInt8 Array

bitmapSubsetInRange

bitmapSubsetInRange retrieve a bitmap subset in a specified range (exclusive end-range). Range inputs are expecting UInt32 values, use toUInt32(uint8) function to convert types.

Parameters:

  • bitmap – bitmap object
  • range_startUInt32 range start point.
  • range_endUInt32 range end point (excluded).

Usage:

  • bitmapSubsetInRange(bitmap, range_start, range_end)

Returns:

  • UInt8 Array

bitmapSubsetLimit

bitmapSubsetLimit creates a subset of bitmap with n elements taken between range_start and cardinality_limit.

Inputs are expecting UInt32 values, use toUInt32(uint8) function to convert types.

Parameters:

  • bitmap – bitmap object
  • range_startUInt32 range start point.
  • cardinality_limitUInt32 subset cardinality upper limit.

Usage:

  • bitmapSubsetLimit(bitmap, range_start, range_end)

Returns:

  • UInt16 Array

bitmapContains

bitmapContains checks if a bitmap contains a specific element.

Inputs are expecting UInt32 values, use toUInt32(uint8) function to convert types.

Parameters:

  • bitmap – bitmap object
  • search_valueUInt32 element to check if contained in bitmap

Usage:

  • bitmapContains(bitmap, search_value)

Returns:

  • UInt8 - 1 found, 0 not found.

bitmapHasAny

bitmapHasAny checks whether two bitmaps have intersection by some elements.

Parameters:

  • bitmap – bitmap object

Usage:

  • bitmapHasAny(bitmap1, bitmap2)

Returns:

  • UInt8 - 1 if bitmaps have at least one similar element, else 0 if none.

bitmapHasAll

bitmapHasAll checks if the first bitmap contains all the elements of the second bitmap.

Parameters:

  • bitmap – bitmap object

Usage:

  • bitmapHasAll(bitmap1, bitmap2)

Returns:

  • UInt8 - 1 if bitmap contains all elements (or second bitmap is empty), else 0.

bitmapCardinality

bitmapCardinality returns bitmaps cardinality as an Integer.

Parameters:

  • bitmap – bitmap object

Usage:

  • bitmapCardinality(bitmap)

Returns:

  • UInt64 - representing the cardinality.

bitmapMin

bitmapMin returns the smallest value of in the set or UINT32_MAX if the set is empty.

Parameters:

  • bitmap – bitmap object

Usage:

  • bitmapMin(bitmap)

Returns:

  • UInt64 - smallest element in bitmap, else UINT32_MAX if empty.

bitmapMax

bitmapMax returns the largest value of in the set or 0 if the set is empty.

Parameters:

  • bitmap – bitmap object

Usage:

  • bitmapMax(bitmap)

Returns:

  • UInt64 - largest element in bitmap, else 0 if empty.

bitmapTransform

bitmapTransform transforms an array of values in a bitmap to another array of values, the result is a new bitmap.

Parameters:

  • bitmap – bitmap object
  • from_arrayUInt32 array containing values to be replaced, non matching values are ignored.
  • to_arrayUInt32 array with same dimension as from_array containing new transform values, non-matched from_array values ignored.

Usage:

  • bitmapTransform(bitmap, from_array, to_array)

Returns:

  • Bitmap - transformed bitmap.

bitmapAnd

bitmapAnd creates a new bitmap containing the intersection of the two bitmap inputs.

Parameters:

  • bitmap – bitmap object

Usage:

  • bitmapAnd(bitmap1, bitmap2)

Returns:

  • Bitmap - bitmap intersection.

bitmapOr

bitmapOr creates a new bitmap containing the non repeating combination of the two bitmap inputs.

Parameters:

  • bitmap – bitmap object

Usage:

  • bitmapOr(bitmap1, bitmap2)

Returns:

  • Bitmap - bitmap intersection.

bitmapXor

bitmapXor creates a new bitmap containing the non overlapping combination of the two bitmap inputs.

Parameters:

  • bitmap – bitmap object

Usage:

  • bitmapXor(bitmap1, bitmap2)

Returns:

  • Bitmap - bitmap with excluded element removed.

bitmapAndnot

bitmapAndnot creates a new bitmap containing only element from the first bitmap that do not overlap with second bitmap.

Parameters:

  • bitmap – bitmap object

Usage:

  • bitmapAndnot(bitmap1, bitmap2)

Returns:

  • Bitmap - bitmap with excluded element removed.

bitmapAndCardinality

bitmapAndCardinality returns the cardinality of bitmapAnd function as an Integer.

Parameters:

  • bitmap – bitmap object

Usage:

  • bitmapAndCardinality(bitmap1, bitmap2)

Returns:

  • UInt64 - cardinality of bitmap.

bitmapOrCardinality

bitmapOrCardinality returns the cardinality of bitmapOr function as an Integer.

Parameters:

  • bitmap – bitmap object

Usage:

  • bitmapOrCardinality(bitmap1, bitmap2)

Returns:

  • UInt64 - cardinality of bitmap.

bitmapXorCardinality

bitmapXorCardinality returns the cardinality of bitmapXor function as an Integer.

Parameters:

  • bitmap – bitmap object

Usage:

  • bitmapXorCardinality(bitmap1, bitmap2)

Returns:

  • UInt64 - cardinality of bitmap.

bitmapAndnotCardinality

bitmapAndnotCardinality returns the cardinality of bitmapAndnot function as an Integer.

Parameters:

  • bitmap – bitmap object

Usage:

  • bitmapAndnotCardinality(bitmap1, bitmap2)

Returns:

  • UInt64 - cardinality of bitmap.

Did this page help you?