powered by
Fast versions of union, intersect, setdiff, symmetric difference and setequal for integers.
union
intersect
setdiff
setequal
bit_union(x, y)bit_intersect(x, y)bit_setdiff(x, y)bit_symdiff(x, y)bit_setequal(x, y)
bit_intersect(x, y)
bit_setdiff(x, y)
bit_symdiff(x, y)
bit_setequal(x, y)
an integer vector
bit_union(): union
bit_union()
bit_intersect(): intersection
bit_intersect()
bit_setdiff(): asymmetric difference
bit_setdiff()
bit_symdiff(): symmetricx difference
bit_symdiff()
bit_setequal(): equality
bit_setequal()
determines the range of the integers and checks if the density justifies use of a bit vector; if yes, uses a bit vector for finding duplicates; if no, falls back to union, intersect, setdiff, union(setdiff(x,y),setdiff(y,x)) and setequal
union(setdiff(x,y),setdiff(y,x))
bit_in, bit_rangediff
bit_in
bit_rangediff
bit_union(1:2, 2:3) bit_intersect(1:2, 2:3) bit_setdiff(1:2, 2:3) bit_symdiff(1:2, 2:3) bit_setequal(1:2, 2:3) bit_setequal(1:2, 2:1)
Run the code above in your browser using DataLab