Here's an obvious algorithm for checking if a given marriage is stable.
Here, is the ROL for boy b, is the ROL for girl g, is the mate of boy b in matching M, and is the mate of girl g in matching M.
?.