module CCBV:sig
..end
The size of the bitvector is rounded up to the multiple of 30 or 62.
In other words some functions such as CCBV.iter
might iterate on more
bits than what was originally asked for.
type
t
val empty : unit -> t
val create : size:int -> bool -> t
val copy : t -> t
val cardinal : t -> int
val length : t -> int
val resize : t -> int -> unit
resize bv n
should make bv
able to store (Sys.word_size - 2)* n
bitsval is_empty : t -> bool
val set : t -> int -> unit
val get : t -> int -> bool
val reset : t -> int -> unit
val flip : t -> int -> unit
val clear : t -> unit
val iter : t -> (int -> bool -> unit) -> unit
val iter_true : t -> (int -> unit) -> unit
val to_list : t -> int list
val to_sorted_list : t -> int list
CCBV.to_list
, but also guarantees the list is sorted in
increasing orderval of_list : int list -> t
val first : t -> int
Not_found
if all bits are 0val filter : t -> (int -> bool) -> unit
filter bv p
only keeps the true bits of bv
whose index
satisfies p index
val union_into : into:t -> t -> unit
union ~into bv
sets into
to the union of itself and bv
.val inter_into : into:t -> t -> unit
inter ~into bv
sets into
to the intersection of itself and bv
val union : t -> t -> t
union bv1 bv2
returns the union of the two setsval inter : t -> t -> t
inter bv1 bv2
returns the intersection of the two setsval select : t -> 'a array -> 'a list
select arr bv
selects the elements of arr
whose index
corresponds to a true bit in bv
. If bv
is too short, elements of arr
with too high an index cannot be selected and are therefore not
selected.val selecti : t -> 'a array -> ('a * int) list
CCBV.select
, but selected elements are paired with their indextype'a
sequence =('a -> unit) -> unit
val to_seq : t -> int sequence
val of_seq : int sequence -> t
val print : Format.formatter -> t -> unit