def _getm(method):
    if method == 'illinois':
        def getm(fz, fb):
            return 0.5
    elif method == 'pegasus':
        def getm(fz, fb):
            return fb/(fb + fz)
    elif method == 'anderson':
        def getm(fz, fb):
            m = 1 - fz/fb
            if m > 0:
                return m
            else:
                return 0.5
    else:
        raise ValueError("method '%s' not recognized" % method)
    return getm
Return a function to calculate m for Illinois-like methods.
dataset/ETHPy150Open fredrik-johansson/mpmath/mpmath/calculus/optimization.py/_getm