code: def get_spectrum(op, decimals):
      r"""Extract the frequencies contributed by an input-encoding gate to the
      overall Fourier representation of a quantum circuit.
  
      If :math:`G` is the generator of the input-encoding gate :math:`\exp(-i x G)`,
      the frequencies are the differences between any two of :math:`G`'s eigenvalues.
      We only compute non-negative frequencies in this subroutine.
  
      Args:
          op (~pennylane.operation.Operation): Operation to extract
              the frequencies for
          decimals (int): Number of decimal places to round the frequencies to
  
      Returns:
          set[float]: non-negative frequencies contributed by this input-encoding gate
      """
      matrix = qml.matrix(qml.generator(op, format="observable"))
  
      # todo: use qml.math.linalg once it is tested properly
      evals = np.linalg.eigvalsh(matrix)
  
      # compute all unique positive differences of eigenvalues, then add 0
      # note that evals are sorted already
      _spectrum = set(
          np.round(
              [x[1] - x[0] for x in combinations(evals, 2)],
              decimals=decimals,
          )
      )
      _spectrum |= {0}
  
      return _spectrum
  
imports: from itertools import combinations
  import numpy
  import pennylane
label_desc: Use image node_id 2 for calling a global function with example usage: get_spectrum(op, decimals) and returns: _spectrum