module Bool: sig
.. end
type ('b, [< `R | `W ])
t = (int, 'b, [< `R | `W ] as 'a) CCArray1.array_
A simple bitvector based on some integral type 'b
val get : ('a, [< `R | `W > `R ]) t -> int -> bool
val set : ('a, [< `R | `W > `W ]) t -> int -> bool -> unit
val zeroes : int -> (Bigarray.int8_unsigned_elt, [< `R | `W ]) t
val ones : int -> (Bigarray.int8_unsigned_elt, [< `R | `W ]) t
val iter_zeroes : f:(int -> unit) -> ('a, [< `R | `W > `R ]) t -> unit
iter_ones ~f a
calls f i
for every index i
such that get a i = false
val iter_ones : f:(int -> unit) -> ('a, [< `R | `W > `R ]) t -> unit
iter_ones ~f a
calls f i
for every index i
such that get a i = true
val cardinal : ('a, [< `R | `W > `R ]) t -> int
Number of ones
val pp : ('a, [< `R | `W > `R ]) t CCArray1.printer
Print the bitvector nicely
Operations
val or_ : ?res:('b, [< `R | `W > `W ] as 'a) t ->
('b, [< `R | `W > `R ]) t ->
('b, [< `R | `W > `R ]) t -> ('b, 'a) t
or_ a b ~into
puts the boolean "or" of a
and b
in into
expects length into = max (length a) (length b)
Raises WrongDimension
if dimensions do not match
val and_ : ?res:('b, [< `R | `W > `W ] as 'a) t ->
('b, [< `R | `W > `R ]) t ->
('b, [< `R | `W > `R ]) t -> ('b, 'a) t
Boolean conjunction. See or
for the parameters
val not_ : ?res:('b, [< `R | `W > `W ] as 'a) t ->
('b, [< `R | `W > `R ]) t -> ('b, 'a) t
Boolean negation (negation of a 0 becomes a 1)
val mix : ?res:('b, [< `R | `W > `W ] as 'a) t ->
('b, [< `R | `W > `R ]) t ->
('b, [< `R | `W > `R ]) t -> ('b, 'a) t
mix a b ~into
assumes length a + length b = length into
and
mixes (interleaves) bits of a
and b
in into
.
Raises WrongDimension
if dimensions do not match
val convolution : ?res:('b, [< `R | `W > `W ] as 'a) t ->
('b, [< `R | `W > `R ]) t ->
by:('b, [< `R | `W > `R ]) t -> ('b, 'a) t
convolution a ~by:b ~into
assumes length into = length a >= length b
and computes the boolean convolution of a
by b
Raises WrongDimension
if dimensions do not match