
    z	i                        S r SSKrSSKJrJrJr  S\R                  S\S\S\R                  4S jr	S\S\S	\S\R                  4S
 jr
S\S\R                  4S jrS\S\R                  4S jrS\S\R                  4S jrg)z\
These are a number of elementary functions that are required for the AQC routines to work.
    N)RXGateRZGateRYGateunitarynjreturnc                     [         R                  " [         R                  " [         R                  " SU-  5      U 5      [         R                  " SUS-
  U-
  -  5      5      $ )a  
Computes I(j - 1) tensor product U tensor product I(n - j), where U is a unitary matrix
of size ``(2, 2)``.

Args:
    unitary: a unitary matrix of size ``(2, 2)``.
    n: num qubits.
    j: position where to place a unitary.

Returns:
    a unitary of n qubits with u in position j.
      npkroneye)r   r   r   s      l/home/james-whalen/.local/lib/python3.13/site-packages/qiskit/synthesis/unitary/aqc/elementary_operations.pyplace_unitaryr      sB     77277266!Q$<1266!A	:J3KLL    kc                 z   X:  Ga  [         R                  " [         R                  " [         R                  " SU-  5      SS/SS//5      [         R                  " SU S-
  U-
  -  5      5      [         R                  " [         R                  " [         R                  " [         R                  " [         R                  " SU-  5      SS/SS//5      [         R                  " SX!-
  S-
  -  5      5      SS/SS//5      [         R                  " SU S-
  U-
  -  5      5      -   nU$ [         R                  " [         R                  " [         R                  " SU-  5      SS/SS//5      [         R                  " SU S-
  U-
  -  5      5      [         R                  " [         R                  " [         R                  " [         R                  " [         R                  " SU-  5      SS/SS//5      [         R                  " SX-
  S-
  -  5      5      SS/SS//5      [         R                  " SU S-
  U-
  -  5      5      -   nU$ )z
Places a CNOT from j to k.

Args:
    n: number of qubits.
    j: control qubit.
    k: target qubit.

Returns:
    a unitary of n qubits with CNOT placed at ``j`` and ``k``.
r   r   r   r   )r   r   r   r   s       r   
place_cnotr   %   s    	u''GGBFF1a4LAq6Aq6"23RVVA!a%!)<L5M
GGGGq!t1v1v.>?aeVWiHXAYZQ!Q  FF1Q#$

& N ''GGBFF1a4LAq6Aq6"23RVVA!a%!)<L5M
GGGGq!t1v1v.>?aeVWiHXAYZQ!Q  FF1Q#$

 Nr   phic                 4    [        U 5      R                  5       $ )zw
Computes an RX rotation by the angle of ``phi``.

Args:
    phi: rotation angle.

Returns:
    an RX rotation matrix.
)r   	to_matrixr   s    r   	rx_matrixr   H        #;  ""r   c                 4    [        U 5      R                  5       $ )zw
Computes an RY rotation by the angle of ``phi``.

Args:
    phi: rotation angle.

Returns:
    an RY rotation matrix.
)r   r   r   s    r   	ry_matrixr   U   r   r   c                 4    [        U 5      R                  5       $ )zw
Computes an RZ rotation by the angle of ``phi``.

Args:
    phi: rotation angle.

Returns:
    an RZ rotation matrix.
)r   r   r   s    r   	rz_matrixr    b   r   r   )__doc__numpyr   %qiskit.circuit.library.standard_gatesr   r   r   ndarrayintr   r   floatr   r   r     r   r   <module>r(      s     H HM2:: M# M# M"** M  #  #  #  "**  F
#5 
#RZZ 
#
#5 
#RZZ 
#
#5 
#RZZ 
#r   