qml.fourier.join_spectra

join_spectra(spec1, spec2)[source]

Join two sets of frequencies that belong to the same input.

Since \(\exp(i a x)\exp(i b x) = \exp(i (a+b) x)\), the spectra of two gates encoding the same \(x\) are joined by computing the set of sums and absolute values of differences of their elements. We only compute non-negative frequencies in this subroutine and assume the inputs to be non-negative frequencies as well.

Parameters
  • spec1 (set[float]) – first spectrum

  • spec2 (set[float]) – second spectrum

Returns

joined spectrum

Return type

set[float]