Open t-imamichi opened 5 days ago
Is this issue limited to the rzz gates and not other gates like ryy rzx etc.?
Not limited to RZZ. But I don't mind RYY and RZX because RZZ becomes a basis gate of devices that supports fractional gates. RYY and RZX are not basis gates of any device. https://docs.quantum.ibm.com/guides/fractional-gates
There is a synthesis algorithm TwoQubitControlledUDecomposer
that takes a 2q-unitary and synthesizes it using the 2q basis gate RZZGate
(with angles in the range [-pi/2, pi/2]. This algorithm has recently been ported to rust in #13139.
Here is an example of the output of this algorithm on the circuit suggested below:
from qiskit.quantum_info import Operator
from qiskit.synthesis.two_qubit.two_qubit_decompose import TwoQubitControlledUDecomposer
unitary = Operator(qc)
decomposer = TwoQubitControlledUDecomposer(RZZGate)
qc3 = decomposer(unitary)
print (qc3)
outputs:
global phase: -π
┌─────────┐┌──────────┐ ┌─────────┐┌──────────┐»
q_0: ┤ Ry(π/2) ├┤ Ry(-π/2) ├─────────────■─────────┤ Ry(π/2) ├┤ Ry(-π/2) ├»
└┬────────┤├──────────┤┌──────────┐ │ZZ(-0.3) ├─────────┤└┬────────┬┘»
q_1: ─┤ Rz(-π) ├┤ Ry(-π/2) ├┤ Ry(-π/2) ├─■─────────┤ Ry(π/2) ├─┤ Rz(-π) ├─»
└────────┘└──────────┘└──────────┘ └─────────┘ └────────┘ »
«
«q_0: ────────────
« ┌──────────┐
«q_1: ┤ Ry(-π/2) ├
« └──────────┘
This algorithm should be added to the unitary synthesis tranpiler pass (https://github.com/Qiskit/qiskit/issues/13320). Then I think that this issues will be solved. Note that the redundant 1q gates should be eliminated by the 1q synthesis transpiler passes.
Is this issue limited to the rzz gates and not other gates like ryy rzx etc.?
@melechlapson -
Note that the synthesis algorithm TwoQubitControlledUDecomposer
suggested above works also for gates like RYY, RZX, RXX etc. that are equivalent to an RZZ up to 1q-unitary gates.
Thank you for your information, @ShellyGarion. I would like to use the algorithm as a transpiler pass. So I wait for #13320.
What should we add?
Since the fractional gates are available, RZZ can be used as a basis gate. But, optimization of consecutive RZZ gates does not seem to be enough as follows. It would be nice to merge them into a single RZZ.
output (both 1.2.4 and main branch)