def _projection_simplex(v, z=1):
    '\n    Old implementation for test and benchmark purposes.\n    The arguments v and z should be a vector and a scalar, respectively.\n    '
    n_features = v.shape[0]
    u = np.sort(v)[::(- 1)]
    cssv = (np.cumsum(u) - z)
    ind = (np.arange(n_features) + 1)
    cond = ((u - (cssv / ind)) > 0)
    rho = ind[cond][(- 1)]
    theta = (cssv[cond][(- 1)] / float(rho))
    w = np.maximum((v - theta), 0)
    return w
Old implementation for test and benchmark purposes.
The arguments v and z should be a vector and a scalar, respectively.
def _projection_simplex(v, z=1):
    '\n    Old implementation for test and benchmark purposes.\n    The arguments v and z should be a vector and a scalar, respectively.\n    '
    n_features = v.shape[0]
    u = np.sort(v)[::(- 1)]
    cssv = (np.cumsum(u) - z)
    ind = (np.arange(n_features) + 1)
    cond = ((u - (cssv / ind)) > 0)
    rho = ind[cond][(- 1)]
    theta = (cssv[cond][(- 1)] / float(rho))
    w = np.maximum((v - theta), 0)
    return w