Closed rmlarose closed 2 years ago
@rmlarose I can take this.
It would be good (but probably not easy) to also support this for other frontends beyond Cirq.
You got it - thanks Purva!
It would be good (but probably not easy) to also support this for other frontends beyond Cirq.
@andreamari Would you prefer these be added to each non_cirq_utils
available in this folder ?
@purva-thakre I think we can start with supporting parametrized Cirq circuits as suggested by @rmlarose in this issue. This is already a useful improvement.
In a second step we can think how to support non-Cirq parametrized circuits. This second step would require to define conversion rules for parametrized gates to and from Cirq.
In a second step we can think how to support non-Cirq parametrized circuits. This second step would require to define conversion rules for parametrized gates to and from Cirq.
@andreamari That's what I thought was needed for the other frontends. I started to figure out how it would work for Qiskit parametrized circuits yesterday.
I'll create a separate PR for each as I work on them and link to this issue. Or if you would prefer to create separate issues to keep better track of these, feel free to assign them to me.
Right now we say that if a circuit doesn't have a unitary, it has non-unitary gates which are not terminal measurements and therefore cannot be folded.
https://github.com/unitaryfund/mitiq/blob/31f10c252b7015a7415e450c9347f19d5b9fe400/mitiq/zne/scaling/folding.py#L69-L73
A Cirq circuit with symbols doesn't have a unitary but does have an inverse:
So a better check is looking for an inverse rather than looking for a unitary.
Current behavior
zne.scaling.fold_*(ansatz)
raisesUnfoldableCircuitError
.Desired behavior
Ability to fold parameterized circuits. For the above circuit, zne.scaling.fold_*(ansatz, scale_factor=3) should return
0: ───Ry(theta)───Ry(-theta)───Ry(theta)───
.