4242
4343def _exp (theta : Union [complex , sympy .Basic ]):
4444 """Utility method to return exp(theta) using numpy or sympy, depending on the type of theta."""
45- return sympy .exp (theta ) if cirq .is_parameterized (theta ) else np .exp (theta )
45+ return sympy .exp (theta ) if cirq .is_parameterized (theta ) else np .exp (cast ( complex , theta ) )
4646
4747
4848def _gates_to_str (gates : Iterable [Any ], gettr : Callable [[Any ], str ] = _gate_str ) -> str :
@@ -360,7 +360,7 @@ def _convert_to_fsim(self, g: POSSIBLE_FSIM_GATES) -> Optional[cirq.FSimGate]:
360360 def _convert_to_phased_fsim (self , g : POSSIBLE_FSIM_GATES ) -> Optional [cirq .PhasedFSimGate ]:
361361 if isinstance (g , cirq .PhasedFSimGate ):
362362 return g
363- chi = 0
363+ chi = 0.0
364364 if isinstance (g , cirq .PhasedISwapPowGate ):
365365 chi = g .phase_exponent * 2 * np .pi
366366 g = g ._iswap
@@ -376,7 +376,7 @@ def _convert_to_iswap(self, g: POSSIBLE_FSIM_GATES) -> Optional[cirq.ISwapPowGat
376376 return (
377377 None
378378 if (fsim is None or not self ._approx_eq_or_symbol (fsim .phi , 0 ))
379- else cirq .ISWAP ** ( - 2 * fsim .theta / np .pi )
379+ else cirq .ISwapPowGate ( exponent = - 2 * fsim .theta / np .pi )
380380 )
381381
382382 def _convert_to_phased_iswap (self , g : POSSIBLE_FSIM_GATES ) -> Optional [cirq .PhasedISwapPowGate ]:
@@ -400,7 +400,7 @@ def _convert_to_cz(self, g: POSSIBLE_FSIM_GATES) -> Optional[cirq.CZPowGate]:
400400 return (
401401 None
402402 if (cg is None or not self ._approx_eq_or_symbol (cg .theta , 0 ))
403- else cirq .CZ ** ( - cg .phi / np .pi )
403+ else cirq .CZPowGate ( exponent = - cg .phi / np .pi )
404404 )
405405
406406 def _convert_to_identity (self , g : POSSIBLE_FSIM_GATES ) -> Optional [cirq .IdentityGate ]:
0 commit comments