parameters: (x, w, p, method='gpfw', max_iters=0)
return_statement: return y
docstring: r"""1D proximal operator for any :math:`\ell_p` norm.
  
      Specifically, this optimizes the following program:
  
      .. math::
  
          \mathrm{min}_y \frac{1}{2} \|x-y\|^2 + w \|y_i - y_{i+1}\|_p.
  
      Parameters
      ----------
      x : numpy array
          The signal we are approximating.
      w : float
          The non-negative weight in the optimization problem.
      method : str
          The method to be used, one of the following:
  
           * ``'gp'`` - gradient projection
           * ``'fw'`` - Frank-Wolfe
           * ``'gpfw'`` - hybrid gradient projection + Frank-Wolfe
  
      Returns
      -------
      numpy array
          The solution of the optimization problem.
docstring_summary: r"""1D proximal operator for any :math:`\ell_p` norm.
docstring_tokens: r 1D proximal operator for any : math : \ ell_p norm .
function: def tvp_1d(x, w, p, method='gpfw', max_iters=0):
      r"""1D proximal operator for any :math:`\ell_p` norm.
  
      Specifically, this optimizes the following program:
  
      .. math::
  
          \mathrm{min}_y \frac{1}{2} \|x-y\|^2 + w \|y_i - y_{i+1}\|_p.
  
      Parameters
      ----------
      x : numpy array
          The signal we are approximating.
      w : float
          The non-negative weight in the optimization problem.
      method : str
          The method to be used, one of the following:
  
           * ``'gp'`` - gradient projection
           * ``'fw'`` - Frank-Wolfe
           * ``'gpfw'`` - hybrid gradient projection + Frank-Wolfe
  
      Returns
      -------
      numpy array
          The solution of the optimization problem.
      """
      methods = {
          'gp': lib.GP_TVp,
          'fw': lib.FW_TVp,
          'gpfw': lib.GPFW_TVp,
      }
      assert method in methods
      assert w >= 0
      assert p >= 1
      w = force_float_scalar(w)
      p = force_float_scalar(p)
      x = force_float_matrix(x)
      info = np.zeros(_N_INFO)
      y = np.zeros(np.size(x), order='F')
      _call(methods[method], x, w, y, info, np.size(x), p, ffi.NULL)
      return y
function_tokens: def tvp_1d ( x , w , p , method = 'gpfw' , max_iters = 0 ) : methods = { 'gp' : lib . GP_TVp , 'fw' : lib . FW_TVp , 'gpfw' : lib . GPFW_TVp , } assert method in methods assert w >= 0 assert p >= 1 w = force_float_scalar ( w ) p = force_float_scalar ( p ) x = force_float_matrix ( x ) info = np . zeros ( _N_INFO ) y = np . zeros ( np . size ( x ) , order = 'F' ) _call ( methods [ method ] , x , w , y , info , np . size ( x ) , p , ffi . NULL ) return y