@@ -103,3 +103,38 @@ def test_calibrate_z_phases(angles, error):
103
103
104
104
# Either we reduced the error or the error is small enough.
105
105
assert new_dist < original_dist or new_dist < 1e-6
106
+
107
+
108
+ @pytest .mark .slow
109
+ @pytest .mark .parametrize (['angles' , 'error' ], _create_tests (n = 10 , seed = 32432432 ))
110
+ def test_calibrate_z_phases_no_options (angles , error ):
111
+
112
+ original_gate = cirq .PhasedFSimGate (** {k : v for k , v in zip (_ANGLES , angles )})
113
+ actual_gate = cirq .PhasedFSimGate (** {k : v + e for k , v , e in zip (_ANGLES , angles , error )})
114
+
115
+ sampler = _TestSimulator (original_gate , actual_gate , seed = 0 )
116
+ qubits = cirq .q (0 , 0 ), cirq .q (0 , 1 )
117
+ calibrated_gate = calibrate_z_phases (
118
+ sampler ,
119
+ qubits ,
120
+ original_gate ,
121
+ options = None ,
122
+ n_repetitions = 10 ,
123
+ n_combinations = 10 ,
124
+ n_circuits = 10 ,
125
+ cycle_depths = range (3 , 10 ),
126
+ )[qubits ]
127
+
128
+ initial_unitary = cirq .unitary (original_gate )
129
+ final_unitary = cirq .unitary (calibrated_gate )
130
+ target_unitary = cirq .unitary (actual_gate )
131
+ maximally_mixed_state = np .eye (4 ) / 2
132
+ dm_initial = initial_unitary @ maximally_mixed_state @ initial_unitary .T .conj ()
133
+ dm_final = final_unitary @ maximally_mixed_state @ final_unitary .T .conj ()
134
+ dm_target = target_unitary @ maximally_mixed_state @ target_unitary .T .conj ()
135
+
136
+ original_dist = _trace_distance (dm_initial , dm_target )
137
+ new_dist = _trace_distance (dm_final , dm_target )
138
+
139
+ # Either we reduced the error or the error is small enough.
140
+ assert new_dist < original_dist or new_dist < 1e-6
0 commit comments