package smol

  1. Overview
  2. Docs

Parameters

Signature

type 'a v = private 'a Stdlib.Map.Make(Literal).t

The type of vectors. Their basis is the set of literals.

val singleton : Literal.t -> 'a -> 'a v

Make a vector with a single entry

val of_map : 'a Stdlib.Map.Make(Literal).t -> 'a v
val to_map : 'a v -> 'a Stdlib.Map.Make(Literal).t
val to_seq : 'a v -> (Literal.t * 'a) Stdlib.Seq.t
val add_seq : (Literal.t * 'a) Stdlib.Seq.t -> 'a v -> 'a v
val of_seq : (Literal.t * 'a) Stdlib.Seq.t -> 'a v
val mem : Literal.t -> 'a v -> bool
val get_entry : Literal.t -> 'a v -> 'a option
val add_entry : Literal.t -> 'a -> 'a v -> 'a v

Adds an entry to the vector. If the literal was already in the basis, updates the value instead.

val remove_entry : Literal.t -> 'a v -> 'a v
val update_entry : Literal.t -> ('a option -> 'a option) -> 'a v -> 'a v
val merge : (Literal.t -> 'a option -> 'b option -> 'c option) -> 'a v -> 'b v -> 'c v
val union : (Literal.t -> 'a -> 'a -> 'a option) -> 'a v -> 'a v -> 'a v
val iter : (Literal.t -> 'a -> unit) -> 'a v -> unit
val fold : (Literal.t -> 'a -> 'b -> 'b) -> 'a v -> 'b -> 'b
val for_all : (Literal.t -> 'a -> bool) -> 'a v -> bool
val exists : (Literal.t -> 'a -> bool) -> 'a v -> bool
val filter : (Literal.t -> 'a -> bool) -> 'a v -> 'a v
val partition : (Literal.t -> 'a -> bool) -> 'a v -> 'a v * 'a v
val cardinal : 'a v -> int
val bindings : 'a v -> (Literal.t * 'a) list
val map : ('a -> 'b) -> 'a v -> 'b v
val mapi : (Literal.t -> 'a -> 'b) -> 'a v -> 'b v
val get_support : 'a v -> Literal.t list

Returns the support of the vector

module Make_SR (K : Algebra.Semiring_S) : sig ... end

Define arithmetic operations on vectors with values in a semiring.

module Make_R (K : Algebra.Ring_S) : sig ... end

Define arithmetic operations on vectors with values in a ring.

val make_monoid : (module Algebra.Semiring_S with type t = 'a) -> Literal.t list -> (module Algebra.Add_Monoid_S with type t = 'a v)

Create an additive monoid on vectors from a semiring of values and a finite support

val make_group : (module Algebra.Ring_S with type t = 'a) -> Literal.t list -> (module Algebra.Add_Group_S with type t = 'a v)

Create an additive group on vectors from a ring of values and a finite support