@@ -188,7 +188,6 @@ class CliffordTrialResult(simulator.SimulationTrialResult):
188
188
def __init__ (self , params : study .ParamResolver ,
189
189
measurements : Dict [str , np .ndarray ],
190
190
final_simulator_state : 'CliffordState' ) -> None :
191
-
192
191
super ().__init__ (params = params ,
193
192
measurements = measurements ,
194
193
final_simulator_state = final_simulator_state )
@@ -331,7 +330,21 @@ def apply_unitary(self, op: 'cirq.Operation'):
331
330
332
331
def apply_single_qubit_unitary (self , op : 'cirq.Operation' ):
333
332
qubit = self .qubit_map [op .qubits [0 ]]
334
- # Handle H natively as optimization.
333
+ if op .gate == cirq .I :
334
+ return
335
+
336
+ if op .gate == cirq .X :
337
+ self ._apply_X (qubit )
338
+ return
339
+
340
+ if op .gate == cirq .Y :
341
+ self ._apply_Y (qubit )
342
+ return
343
+
344
+ if op .gate == cirq .Z :
345
+ self ._apply_Z (qubit )
346
+ return
347
+
335
348
if op .gate == cirq .H :
336
349
self ._apply_H (qubit )
337
350
return
@@ -366,14 +379,26 @@ def apply_single_qubit_unitary(self, op: 'cirq.Operation'):
366
379
phase_shift = u [max_idx ] / applied_unitary [max_idx ]
367
380
self .ch_form .omega *= phase_shift
368
381
369
- def _apply_H (self , qubit : ops . Qid ):
382
+ def _apply_H (self , qubit : int ):
370
383
self .tableau ._H (qubit )
371
384
self .ch_form ._H (qubit )
372
385
373
- def _apply_S (self , qubit : ops . Qid ):
386
+ def _apply_S (self , qubit : int ):
374
387
self .tableau ._S (qubit )
375
388
self .ch_form ._S (qubit )
376
389
390
+ def _apply_X (self , qubit : int ):
391
+ self .tableau ._X (qubit )
392
+ self .ch_form ._X (qubit )
393
+
394
+ def _apply_Z (self , qubit : int ):
395
+ self .tableau ._Z (qubit )
396
+ self .ch_form ._Z (qubit )
397
+
398
+ def _apply_Y (self , qubit : int ):
399
+ self .tableau ._Y (qubit )
400
+ self .ch_form ._Y (qubit )
401
+
377
402
def perform_measurement (self ,
378
403
qubits : Sequence [ops .Qid ],
379
404
prng : np .random .RandomState ,
0 commit comments