Combine two array_of_doubles() sketches into a new compact
array_of_doubles_sketch result, without mutating either input. a and
b must be Array of Doubles sketches created with the same seed (a
mismatch raises datasketches_seed_mismatch).
Usage
array_of_doubles_union(a, b, lg_k = NULL)
array_of_doubles_intersection(a, b)
array_of_doubles_difference(a, b)Details
array_of_doubles_union(a, b)estimates the size of the unionunion(A, B).aandbmust also share the samenum_values(a mismatch raisesdatasketches_incompatible_sketch); value arrays for matching keys are combined by element-wise sum.array_of_doubles_intersection(a, b)estimates the size of the intersectionintersection(A, B), with the samenum_valuesrequirement and combining rule asarray_of_doubles_union().array_of_doubles_difference(a, b)estimates the size of the set differenceA \\ B(elements inAbut notB), retaininga's value arrays unchanged for the retained keys.
Examples
a <- array_of_doubles(1:1000, runif(1000))
b <- array_of_doubles(501:1500, runif(1000))
array_of_doubles_union(a, b)$column_sums()
#> [1] 1005.581
array_of_doubles_intersection(a, b)$estimate()
#> [1] 500
array_of_doubles_difference(a, b)$estimate()
#> [1] 500