@@ -805,6 +805,38 @@ def test_multi_asymmetric_depolarizing_channel_repr():
805
805
)
806
806
807
807
808
+ def test_multi_asymmetric_depolarizing_eq ():
809
+ a = cirq .asymmetric_depolarize (error_probabilities = {'I' : 0.8 , 'X' : 0.2 })
810
+ b = cirq .asymmetric_depolarize (error_probabilities = {'II' : 0.8 , 'XX' : 0.2 })
811
+
812
+ assert not cirq .approx_eq (a , b )
813
+
814
+ a = cirq .asymmetric_depolarize (error_probabilities = {'II' : 0.8 , 'XX' : 0.2 })
815
+ b = cirq .asymmetric_depolarize (error_probabilities = {'II' : 2 / 3 , 'XX' : 1 / 3 })
816
+
817
+ assert not cirq .approx_eq (a , b )
818
+
819
+ a = cirq .asymmetric_depolarize (error_probabilities = {'II' : 2 / 3 , 'ZZ' : 1 / 3 })
820
+ b = cirq .asymmetric_depolarize (error_probabilities = {'II' : 2 / 3 , 'XX' : 1 / 3 })
821
+
822
+ assert not cirq .approx_eq (a , b )
823
+
824
+ a = cirq .asymmetric_depolarize (0.1 , 0.2 )
825
+ b = cirq .asymmetric_depolarize (error_probabilities = {'II' : 2 / 3 , 'XX' : 1 / 3 })
826
+
827
+ assert not cirq .approx_eq (a , b )
828
+
829
+ a = cirq .asymmetric_depolarize (error_probabilities = {'II' : 0.667 , 'XX' : 0.333 })
830
+ b = cirq .asymmetric_depolarize (error_probabilities = {'II' : 2 / 3 , 'XX' : 1 / 3 })
831
+
832
+ assert cirq .approx_eq (a , b , atol = 1e-3 )
833
+
834
+ a = cirq .asymmetric_depolarize (error_probabilities = {'II' : 0.667 , 'XX' : 0.333 })
835
+ b = cirq .asymmetric_depolarize (error_probabilities = {'XX' : 1 / 3 , 'II' : 2 / 3 })
836
+
837
+ assert cirq .approx_eq (a , b , atol = 1e-3 )
838
+
839
+
808
840
def test_multi_asymmetric_depolarizing_channel_str ():
809
841
assert str (cirq .asymmetric_depolarize (error_probabilities = {'II' : 0.8 , 'XX' : 0.2 })) == (
810
842
"asymmetric_depolarize(error_probabilities={'II': 0.8, 'XX': 0.2})"
@@ -814,16 +846,16 @@ def test_multi_asymmetric_depolarizing_channel_str():
814
846
def test_multi_asymmetric_depolarizing_channel_text_diagram ():
815
847
a = cirq .asymmetric_depolarize (error_probabilities = {'II' : 2 / 3 , 'XX' : 1 / 3 })
816
848
assert cirq .circuit_diagram_info (a , args = no_precision ) == cirq .CircuitDiagramInfo (
817
- wire_symbols = ('A(II:0.6666666666666666, XX:0.3333333333333333)' ,)
849
+ wire_symbols = ('A(II:0.6666666666666666, XX:0.3333333333333333)' , '(1)' )
818
850
)
819
851
assert cirq .circuit_diagram_info (a , args = round_to_6_prec ) == cirq .CircuitDiagramInfo (
820
- wire_symbols = ('A(II:0.666667, XX:0.333333)' ,)
852
+ wire_symbols = ('A(II:0.666667, XX:0.333333)' , '(1)' )
821
853
)
822
854
assert cirq .circuit_diagram_info (a , args = round_to_2_prec ) == cirq .CircuitDiagramInfo (
823
- wire_symbols = ('A(II:0.67, XX:0.33)' ,)
855
+ wire_symbols = ('A(II:0.67, XX:0.33)' , '(1)' )
824
856
)
825
857
assert cirq .circuit_diagram_info (a , args = no_precision ) == cirq .CircuitDiagramInfo (
826
- wire_symbols = ('A(II:0.6666666666666666, XX:0.3333333333333333)' ,)
858
+ wire_symbols = ('A(II:0.6666666666666666, XX:0.3333333333333333)' , '(1)' )
827
859
)
828
860
829
861
0 commit comments