package containers

  1. Overview
  2. Docs
On This Page
  1. Operations
Legend:
Library
Module
Module type
Parameter
Class
Class type
type ('b, 'perm) t = (int, 'b, 'perm) array_

A simple bitvector based on some integral type 'b

val get : (_, [> `R ]) t -> int -> bool
val set : (_, [> `W ]) t -> int -> bool -> unit
val zeroes : int -> (Bigarray.int8_unsigned_elt, 'perm) t
val ones : int -> (Bigarray.int8_unsigned_elt, 'perm) t
val iter_zeroes : f:(int -> unit) -> (_, [> `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) -> (_, [> `R ]) t -> unit

iter_ones ~f a calls f i for every index i such that get a i = true

val cardinal : (_, [> `R ]) t -> int

Number of ones

val pp : (_, [> `R ]) t printer

Print the bitvector nicely

Operations
val or_ : ?res:('b, [> `W ] as 'perm) t -> ('b, [> `R ]) t -> ('b, [> `R ]) t -> ('b, 'perm) t

or_ a b ~into puts the boolean "or" of a and b in into expects length into = max (length a) (length b)

val and_ : ?res:('b, [> `W ] as 'perm) t -> ('b, [> `R ]) t -> ('b, [> `R ]) t -> ('b, 'perm) t

Boolean conjunction. See or for the parameters

val not_ : ?res:('b, [> `W ] as 'perm) t -> ('b, [> `R ]) t -> ('b, 'perm) t

Boolean negation (negation of a 0 becomes a 1)

val mix : ?res:('b, [> `W ] as 'perm) t -> ('b, [> `R ]) t -> ('b, [> `R ]) t -> ('b, 'perm) t

mix a b ~into assumes length a + length b = length into and mixes (interleaves) bits of a and b in into.

val convolution : ?res:('b, [> `W ] as 'perm) t -> ('b, [> `R ]) t -> by:('b, [> `R ]) t -> ('b, 'perm) t

convolution a ~by:b ~into assumes length into = length a >= length b and computes the boolean convolution of a by b