
    z	i%                    H    S r SSKJr  SSKrSSKJr  SSKJr	  SS jrS	S jrg)
zYRoutines that use local invariants to compute properties
of two-qubit unitary operators.
    )annotationsN)two_qubit_local_invariants)local_equivalencec                    [         R                  " U [        S9n U R                  S:w  a  [	        S5      e[        U 5      u  pn[         R                  " [        US5      [        US5      [        US5      /5      $ )aM  Computes the local invariants for a two-qubit unitary.

Args:
    U (ndarray): Input two-qubit unitary.

Returns:
    ndarray: NumPy array of local invariants [g0, g1, g2].

Raises:
    ValueError: Input not a 2q unitary.

Notes:
    Y. Makhlin, Quant. Info. Proc. 1, 243-252 (2002).
    Zhang et al., Phys Rev A. 67, 042313 (2003).
dtype)   r	   z,Unitary must correspond to a two-qubit gate.   )npasarraycomplexshape
ValueErrortqli_rsarrayround)Uabcs       e/home/james-whalen/.local/lib/python3.13/site-packages/qiskit/synthesis/two_qubit/local_invariance.pyr   r      sa      	

1G$Aww&GHH
IQ188U1b\5B<q">??    c                    [         R                  " U [        S9n[        U5      u  p#n[         R                  " [        US5      [        US5      [        US5      /5      $ )aT  Computes the equivalent local invariants from the
Weyl coordinates.

Args:
    weyl (ndarray): Weyl coordinates.

Returns:
    ndarray: Local equivalent coordinates [g0, g1, g3].

Notes:
    This uses Eq. 30 from Zhang et al, PRA 67, 042313 (2003),
    but we multiply weyl coordinates by 2 since we are
    working in the reduced chamber.
r   r
   )r   r   floatle_rsr   r   )weylmatr   r   r   s        r   r   r   .   sI     **T
'Cc
IQ188U1b\5B<q">??r   )r   
np.ndarrayreturnr   )r   r   r   r   )
__doc__
__future__r   numpyr   &qiskit._accelerate.two_qubit_decomposer   r   r   r    r   r   <module>r%      s$    #  X M@.@r   