This function checks if a given matching is stable for a particular set of preferences. This function checks if there's an unmatched pair that would rather be matched with each other than with their assigned partners.
cpp_wrapper_irving_check_stability(pref, matchings)
is a matrix with the preference order of each individual in the
market. If there are n
individuals, then this matrix will be of
dimension n-1
by n
. The i,j
th element refers to
j
's i
th most favorite partner. Preference orders must be
specified using C++ indexing (starting at 0). The matrix pref
must
be of dimension n-1
by n
.
is a vector of length n
corresponding to the
matchings that were formed (using C++ indexing). E.g. if the 4
th
element of this vector is 0
then individual 4
was matched
with individual 1
. If no stable matching exists, then this function
returns a vector of zeros.
true if the matching is stable, false otherwise @export