| Bitset | R Documentation |
This is a data structure that compactly stores the presence of
integers in some finite set (max_size), and can
efficiently perform set operations (union, intersection, complement, symmetric
difference, set difference).
WARNING: All operations are in-place so please use $copy
if you would like to perform an operation without destroying your current bitset.
.bitseta pointer to the underlying IterableBitset.
max_sizethe maximum size of the bitset.
new()create a bitset.
Bitset$new(size, from = NULL)
sizethe size of the bitset.
frompointer to an existing IterableBitset to use; if NULL
make empty bitset, otherwise copy existing bitset.
insert()insert into the bitset.
Bitset$insert(v)
van integer vector of elements to insert.
remove()remove from the bitset.
Bitset$remove(v)
van integer vector of elements (not indices) to remove.
clear()clear the bitset.
Bitset$clear()
size()get the number of elements in the set.
Bitset$size()
or()to "bitwise or" or union two bitsets.
Bitset$or(other)
otherthe other bitset.
and()to "bitwise and" or intersect two bitsets.
Bitset$and(other)
otherthe other bitset.
not()to "bitwise not" or complement a bitset.
Bitset$not(inplace)
inplacewhether to overwrite the current bitset.
xor()to "bitwise xor" or get the symmetric difference of two bitset (keep elements in either bitset but not in their intersection).
Bitset$xor(other)
otherthe other bitset.
set_difference()Take the set difference of this bitset with another
(keep elements of this bitset which are not in other).
Bitset$set_difference(other)
otherthe other bitset.
sample()sample a bitset.
Bitset$sample(rate)
ratethe success probability for keeping each element, can be a single value for all elements or a vector of unique probabilities for keeping each element.
choose()choose k random items in the bitset
Bitset$choose(k)
kthe number of items in the bitset to keep. The selection of these k items from N total items in the bitset is random, and k should be chosen such that 0 ≤ k ≤ N.
copy()returns a copy the bitset.
Bitset$copy()
to_vector()return an integer vector of the elements stored in this bitset.
Bitset$to_vector()
clone()The objects of this class are cloneable with this method.
Bitset$clone(deep = FALSE)
deepWhether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.