Stable_matching(3)
π NAME π
okay bestie, welcome to the Stable_matching(3) page from the OCaml library β¨. The NAME section is literally:
Stable_matching - no description
and thatβs it β βno descriptionβ π no cap. The docs are being mysterious, but the rest of the page has the actual module tea π«.
π§ Module π§
This section just says:
Module Stable_matching
like, thatβs the module weβre talking about, periodt π .
β¨ Documentation β¨
okay so the docs open with:
Module Stable_matching
: sig end
then:
module Item : sig end
Item is literally just sig end β thatβs the whole thing, no cap π«Ά.
The type lines are giving:
type left_index = intβ a left index is just anint, iconic.type right_index = intβ a right index is also just anint, slay.type rank = intβ and a rank? also anint, we love consistency π.
Then thereβs this type:
type ('a, 'v) matches = {
left : 'a list ;
pairs : ('v * 'v) list ;
right : 'a list ;
}
and this one:
type ('v, 'k) item_matches = (('v, 'k) Item.t, 'v) matches
then the unstable_matching type:
type unstable_matching = {
first : left_index * right_index ;
second : left_index * right_index ;
current_rank : rank * rank ;
optimal : rank * rank ;
}
Now the values, bestie π
val stable_matches : distance:(int -> int -> int) -> ('a, int) matches
-> (unit, unstable_matching) Result.t
val strong_stable_matches : distance:(int -> int -> int) -> ('a, int)
matches -> (unit, unstable_matching) Result.t
val matches : compatible:(left_index -> right_index -> bool) ->
preferences:(right_index -> (left_index * rank) array) -> size:int * int
-> (int, int) matches
so matches ~compatible ~preferences ~size:(ls,rs) computes a matching between a set of ls left items and rs right items favoring the right side. The matches are compatible and weakly stable according to the preferences matrix. The size of the matching is at least 2/3 of the optimal matching size β and yeah, computing optimal matching with partial preferences and ties is in NP π. thatβs the drama, not me.
val fuzzy_match_names : compatibility:('k -> 'k -> bool) ->
max_right_items:int -> cutoff:(string -> int) -> ('v, 'k) Item.t list ->
('v, 'k) Item.t list -> ('v, 'k) item_matches
and fuzzy_match_names ~compatibility ~max_right_item ~cutoff left right calls the Stable_matching.matches function using the OSA edit distance to compute preferences with a cutoff function. To avoid quadratic complexity on large module size we limit the right side to the first max_right_item items. (the signature above says max_right_items, the prose says max_right_item β im just reading the page, bestie π
).
This page came from OCamldoc, dated 2026-06-22, for Stable_matching(3). mwah, bye bestie π«Άππ
π¦ where this page comes from
- arch rolling: ocaml 5.5.0-1 Β· LGPL2.1 AND custom: QPL-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms