Closed gillenhaalb closed 5 years ago
Not sure if Im fully following. Are you suggesting a transpiler pass?
Ah sorry, yes a transpiler pass. I will be generalizing the circuit in Aqua to inverse and approximate QFTs as well, and I figured adding a transpiler pass in Terra that returns an optimized circuit with the final QFT replaced by the reduced noise version may make sense. If so, should I simply follow the pattern and submit it in a PR with the rest of them in https://github.com/Qiskit/qiskit-terra/tree/master/qiskit/transpiler/passes?
I think this makes more sense in Aqua right now. It's not so easy for the compiler to automatically detect that a (sub-)circuit is a quantum fourier transform. Ultimately when we have better library support for these kinds of things it could be done. But for now I think it's easier for the circuit constructor to request this optimization. Also it's not clear that this optimization is always worth it. It depends on the latency and error of measurement+feed-forward. Current devices don't support feed-forward at all.
That makes a lot of sense, thanks for letting me know!
What is the expected behavior?
Just submitted a PR to Aqua for the "semiclassical" Fourier transform option, but as its use depends on the FT directly preceding measurement, it could be complimented by having this checked in the compilation pass. I.e. if a circuit has a standard QFT directly preceding a measurement, the compiler could automatically change that QFT into the semiclassical.
This reduces noise effects drastically by replacing quantum two-qubit control gates with a measurement and classical control. See the noise reduction demo here: SemiclassFTdemo.zip