def operator_iteration(self, T, v, max_iter, tol=None, *args, **kwargs):
        # May be replaced with quantecon.compute_fixed_point
        if max_iter <= 0:
            return v, 0

        for i in range(max_iter):
            new_v = T(v, *args, **kwargs)
            if tol is not None and np.abs(new_v - v).max() < tol:
                v[:] = new_v
                break
            v[:] = new_v

        num_iter = i + 1

        return num_iter
allow any logged user to post a comment
dataset/ETHPy150Open QuantEcon/QuantEcon.py/quantecon/markov/ddp.py/DiscreteDP.operator_iteration--crossover with--dataset/ETHPy150Open frappe/frappe/frappe/desk/form/utils.py/add_comment