code: def gradient_program(f_h: float, precision: int) -> Program:
      
  
      # encode oracle values into phase
      phase_factor = np.exp(1.0j * 2 * np.pi * abs(f_h))
      U = np.array([[phase_factor, 0],
                    [0, phase_factor]])
      p_gradient = phase_estimation(U, precision)
  
      return p_gradient
docs: Gradient estimation via Jordan's algorithm (10.1103/PhysRevLett.95.050501).
  
      :param f_h: Oracle output at perturbation h.
      :param precision: Bit precision of gradient.
      :return: Quil program to estimate gradient of f.