-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Labels
Description
c = Circuit(2).CX(0,1).X(1).CX(0,1).X(1)
SynthesiseTK().apply(c)
CliffordSimp(target_2qb_gate=OpType.TK2).apply(c)
SynthesiseTK().apply(c)
c
# [TK1(0.5, 0.5, 3.5) q[0]; TK1(0, 0, 1) q[1]; TK2(0.5, 0, 0) q[0], q[1]; TK2(0.5, 0, 0) q[0], q[1]; TK1(0.5, 0.5, 0.5) q[0]; TK1(0, 1, 3) q[1]; ]c = Circuit(2).CX(0,1).X(1).CX(0,1).X(1)
CliffordSimp(target_2qb_gate=OpType.CX).apply(c)
c
# []I think #1801 lets us use CliffordSimp without rebasing to CX first, though that also makes it ineffective.
This also has an effect on FullPeepholeOptimise, the circuit below can be optimised using one ZZMax and one CX.
c = Circuit(3).CX(0,1).Rz(3.5,1).CX(0,2).CX(0,1)
FullPeepholeOptimise(target_2qb_gate=OpType.CX).apply(c)
c
# [TK1(0, 0, 1.5) q[0]; TK1(0.5, 0.5, 0) q[1]; CX q[0], q[2]; CX q[0], q[1]; TK1(0.5, 0.5, 0.5) q[1]; ]but the following code produces 3 TK2 gates
c = Circuit(3).CX(0,1).Rz(3.5,1).CX(0,2).CX(0,1)
FullPeepholeOptimise(target_2qb_gate=OpType.TK2).apply(c)
c
# [TK1(0.5, 0.5, 0) q[0]; TK1(0, 1.5, 1) q[1]; TK1(0, 1.5, 1) q[2]; TK2(0.5, 0, 0) q[0], q[1]; TK2(0.5, 0, 0) q[0], q[2]; TK1(0, 1.5, 3.5) q[1]; TK2(0.5, 0, 0) q[0], q[1]; TK1(0, 0, 1) q[2]; TK1(0.5, 0.5, 0.5) q[0]; TK1(0, 0, 1) q[1]; ]