-
Notifications
You must be signed in to change notification settings - Fork 583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multi-qubit X gate promoted to TOFFOLI gate and could not be serialized by TFQ. #480
Comments
After talking this over with the Cirq people it turns out that this is intended behavior. So we have to turn around and update our serializer functionality to support Toffoli and CCZ. |
@Danielle-Schuman I was using the nightly one at the time. |
Ok, thank you for the answer, @we-taper :). I was using the regular version, so that might have caused the different behaviour. I meanwhile have found a workaround, though. (I just implemented the Toffoli-gate in a decomposed manner, as described in https://en.wikipedia.org/wiki/Toffoli_gate#/media/File:Qcircuit_ToffolifromCNOT.svg , that worked with the regular TFQ version, too.) |
Thanks! @Danielle-Schuman Actually, why not working with the nightly-version? The major benefit is that gates will be implemented natively which means faster execution. So far it has been quite smooth for me to use the nightly version (or to be specific |
I see there is a pull request under review to fixing this thread, is there plans to merge that soon? It's not breaking since you can use the techniques presented above to solve the problem, but it's a weird interaction. |
Link to cuQuantum install guide
When a multi-qubit X gate is created by the
.controlled
method, it maybe automatically promoted tocirq.TOFFOLI
gate which isn't supported by TFQ.Minimal example:
Currently, the work-around is to use
cirq.ControlledGate(sub_gate=cirq.X, num_controls=3).on(*qbs)
instead.Similar problem happen to
cirq.Z
as well, which is promoted tocirq.CCZ
.Luckily,
cirq.Y
works becausecirq.CCY
does not exist.The text was updated successfully, but these errors were encountered: