@@ -7,30 +7,35 @@ function YaoBlocks.mat(
77 :: Type{T} , R:: RotationGate{D,Reactant.TracedRNumber{S},<:XGate}
88) where {D,T,S}
99 M = Reactant. broadcast_to_size (zero (T), (2 , 2 ))
10- M[1 , 1 ] = cos (R. theta / 2 )
11- M[2 , 2 ] = cos (R. theta / 2 )
12- M[1 , 2 ] = - im * sin (R. theta / 2 )
13- M[2 , 1 ] = - im * sin (R. theta / 2 )
10+ c = cos (R. theta / 2 )
11+ s = - im * sin (R. theta / 2 )
12+ M[1 , 1 ] = c
13+ M[2 , 2 ] = c
14+ M[1 , 2 ] = s
15+ M[2 , 1 ] = s
1416 return M
1517end
1618
1719function YaoBlocks. mat (
1820 :: Type{T} , R:: RotationGate{D,Reactant.TracedRNumber{S},<:YGate}
1921) where {D,T,S}
2022 M = Reactant. broadcast_to_size (zero (T), (2 , 2 ))
21- M[1 , 1 ] = cos (R. theta / 2 )
22- M[2 , 2 ] = cos (R. theta / 2 )
23- M[1 , 2 ] = - sin (R. theta / 2 )
24- M[2 , 1 ] = sin (R. theta / 2 )
23+ c = cos (R. theta / 2 )
24+ s = sin (R. theta / 2 )
25+ M[1 , 1 ] = c
26+ M[2 , 2 ] = c
27+ M[1 , 2 ] = - s
28+ M[2 , 1 ] = s
2529 return M
2630end
2731
2832function YaoBlocks. mat (
2933 :: Type{T} , R:: RotationGate{D,Reactant.TracedRNumber{S},<:ZGate}
3034) where {D,T,S}
3135 M = Reactant. broadcast_to_size (zero (T), (2 , 2 ))
32- M[1 , 1 ] = exp (- im * R. theta / 2 )
33- M[2 , 2 ] = exp (im * R. theta / 2 )
36+ x = exp (im * R. theta / 2 )
37+ M[1 , 1 ] = conj (x)
38+ M[2 , 2 ] = x
3439 return M
3540end
3641
0 commit comments