
    z	i                       S r SSKJr  SSKrSSKJr  SSKJrJ	r	J
r
  / SQS/ 4/ SQS\
/4/ S	QS\	/4/ S
QS\/4S.r / SQS/ 4/ SQS\
/4/ SQS\	/4/ SQS\	\
/4/ SQS\/4/ SQS\\
/4/ SQS\\	/4/ SQS\\	\
/4S.r S rS rS rg)z3
Simple circuit constructors for Weyl reflections.
    )annotationsN)QuantumCircuit)RXGateRYGateRZGate)   r   r   r   )r	   r   )r	   r   r	   )r   r	   r	   )zno reflectionzreflect XX, YYzreflect XX, ZZzreflect YY, ZZ)r   r   r   )r   r   r   y              ?)r   r   r   y             )r   r   r   )r   r   r   )r   r   r   )r   r   r   r	   )zno shiftzZ shiftzY shiftz	Y,Z shiftzX shiftz	X,Z shiftz	X,Y shiftzX,Y,Z shiftc                    [         U    u  p#n[        X!5       VVs/ s H	  u  pVXV-  PM     nnn[        S5      nU H*  n	UR                  U	" [        R
                  5      S/5        M,     XxU4$ s  snnf )z
Given a reflection type and a canonical coordinate, applies the reflection
and describes a circuit which enacts the reflection + a global phase shift.
   r   )reflection_optionszipr   appendnppi)
reflection_name
coordinatereflection_scalarsreflection_phase_shiftsource_reflection_gatesxyreflected_coordsource_reflectiongates
             f/home/james-whalen/.local/lib/python3.13/site-packages/qiskit/synthesis/two_qubit/xx_decompose/weyl.pyapply_reflectionr   B   s    
 K]KG0G *--?)LM)Lqu)LOM&q)'  beeqc2 ( /EEE Ns   A-c                ^   [         U    u  p#n[        X!5       VVs/ s H  u  pV[        R                  S-  U-  U-   PM      nnn[	        S5      nU HQ  n	UR                  U	" [        R                  5      S/5        UR                  U	" [        R                  5      S/5        MS     XxU4$ s  snnf )z
Given a shift type and a canonical coordinate, applies the shift and
describes a circuit which enacts the shift + a global phase shift.
r   r   r   )shift_optionsr   r   r   r   r   )

shift_namer   shift_scalarsshift_phase_shiftsource_shift_gatesr   r   shifted_coordsource_shiftr   s
             r   apply_shiftr%   R   s    
 <I;T8M&836}3QR3Q41RUUQY]Q&3QMR!!$L"DK!-DK!- # (999 Ss   %B)c                   [        S5      nSX4:X  a   U$ SX4:X  aK  UR                  [        R                  * S-  S/5        UR                  [        R                  S-  S/5        U$ SX4:X  aL  UR	                  [        R                  * S-  S/5        UR	                  [        R                  * S-  S/5        U$ SX4:X  a  UR	                  [        R                  S-  S/5        UR	                  [        R                  S-  S/5        UR                  [        R                  S-  S/5        UR                  [        R                  * S-  S/5        U$ SX4:X  a  UR	                  [        R                  S-  S/5        UR	                  [        R                  S-  S/5        UR                  [        R                  S-  S/5        UR                  [        R                  * S-  S/5        U$ S	X4:X  aI  UR                  [        R                  S-  S/5        UR                  [        R                  * S-  S/5        U$ )
u   
Given a pair of distinct indices 0 ≤ (first_index, second_index) ≤ 2,
produces a two-qubit circuit which rotates a canonical gate

    a0 XX + a1 YY + a2 ZZ

into

    a[first] XX + a[second] YY + a[other] ZZ .
r   )r   r   )r   r   r   r   )r   r   )r   r   )r   r   )r   r   )r   rxr   r   rzry)first_indexsecond_indexconjs      r   canonical_rotation_circuitr-   b   s    !D+,,* K) 
K.	.
QC 	A3$ K# 
K.	.
QC 
QC  K 
K.	.	A3	A3	A3
QC  K 
K.	.	A3	A3	A3
QC 
 K	 
K.	.	A3
QC K    )__doc__
__future__r   numpyr   qiskit.circuit.quantumcircuitr   %qiskit.circuit.library.standard_gatesr   r   r   r   r   r   r%   r-    r.   r   <module>r5      s    #  8 H H  B'"Ax0"Ax0"Ax0	 	 Ar"2x(3)Q 013)Q 01R&&!12sVVV$<=	F : #r.   