def _bistochastic_normalize(X, max_iter=1000, tol=1e-5):
    # According to paper, this can also be done more efficiently with
    # deviation reduction and balancing algorithms.
    X = make_nonnegative(X)
    X_scaled = X
    dist = None
    for _ in range(max_iter):
        X_new, _, _ = _scale_normalize(X_scaled)
        if issparse(X):
            dist = norm(X_scaled.data - X.data)
        else:
            dist = norm(X_scaled - X_new)
        X_scaled = X_new
        if dist is not None and dist < tol:
            break
    return X_scaled
Normalize rows and columns of ``X`` simultaneously so that all
dataset/ETHPy150Open scikit-learn/scikit-learn/sklearn/cluster/bicluster.py/_bistochastic_normalize