@@ -774,3 +774,61 @@ def test_cross_clifford_pieces_filling_merge():
7747746: ───────────────────────────────────────────────────────────PhXZ(a=0.2,x=0.2,z=0.1)───X─────────────────────────@───PhXZ(a=0.8,x=0.8,z=0.5)─────H────────────────────────
775775""" ,
776776 )
777+
778+
779+ def test_pull_through_phxz_gate_case1 ():
780+ """Test case diagrams.
781+ Input:
782+ a: ───H───────PhXZ(a=0.25,x=-1,z=0)───────@───
783+ │
784+ b: ───H───H───H───────────────────────H───X───
785+ Output: expected circuit diagram below.
786+ """
787+ a = cirq .NamedQubit ('a' )
788+ b = cirq .NamedQubit ('b' )
789+
790+ phxz = cirq .PhasedXZGate (axis_phase_exponent = 0.25 , x_exponent = - 1 , z_exponent = 0 )
791+ assert_dd (
792+ input_circuit = cirq .Circuit (
793+ cirq .Moment (cirq .H (a ), cirq .H (b )),
794+ cirq .Moment (cirq .H (b )),
795+ cirq .Moment (phxz (a ), cirq .H (b )),
796+ cirq .Moment (cirq .H (b )),
797+ cirq .Moment (cirq .CNOT (a , b )),
798+ ),
799+ expected_circuit = """
800+ a: ───H───X───PhXZ(a=0.25,x=-1,z=0)───X───@───Z───
801+ │
802+ b: ───H───H───H───────────────────────H───X───────
803+ """ ,
804+ schema = "XX_PAIR" ,
805+ )
806+
807+
808+ def test_pull_through_phxz_gate_case2 ():
809+ """Test case diagrams.
810+ Input:
811+ a: ───H───────PhXZ(a=0.2,x=-1,z=0)───────@───
812+ │
813+ b: ───H───H───H───────────────────────H───X───
814+ Output: expected circuit diagram below.
815+ """
816+ a = cirq .NamedQubit ('a' )
817+ b = cirq .NamedQubit ('b' )
818+
819+ phxz = cirq .PhasedXZGate (axis_phase_exponent = 0.2 , x_exponent = - 1 , z_exponent = 0 )
820+ assert_dd (
821+ input_circuit = cirq .Circuit (
822+ cirq .Moment (cirq .H (a ), cirq .H (b )),
823+ cirq .Moment (cirq .H (b )),
824+ cirq .Moment (phxz (a ), cirq .H (b )),
825+ cirq .Moment (cirq .H (b )),
826+ cirq .Moment (cirq .CNOT (a , b )),
827+ ),
828+ expected_circuit = """
829+ a: ───H───X───PhXZ(a=0.1,x=0,z=0.4)───X───@───X───
830+ │
831+ b: ───H───H───H───────────────────────H───X───X───
832+ """ ,
833+ schema = "XX_PAIR" ,
834+ )
0 commit comments