code: def project_simplex(v, z=1):
      if np.sum(v) <= z:
          return v
  
      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] / rho
      w = np.maximum(v - theta, 0)
      return w
  
imports: import numpy
  from scipy.linalg import svd
  from lightning.impl.prox_fast import prox_tv1d
label_desc: Use image node_id 1 for calling a global function with example usage: project_simplex(v, z) and returns: w, v