§
    º³Ùg%  ã                  óF   — d Z ddlmZ ddlZddlmZ ddlmZ	 dd	„Zdd„ZdS )zYRoutines that use local invariants to compute properties
of two-qubit unitary operators.
é    )ÚannotationsN)Útwo_qubit_local_invariants)Úlocal_equivalenceÚUú
np.ndarrayÚreturnc                ó  — t          j        | t          ¬¦  «        } | j        dk    rt	          d¦  «        ‚t          | ¦  «        \  }}}t          j        t          |d¦  «        t          |d¦  «        t          |d¦  «        g¦  «        S )au  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)r   ÚaÚbÚcs       úa/granary/edev/quantum/lib/python3.11/site-packages/qiskit/synthesis/two_qubit/local_invariance.pyr   r      st   € õ  	Œ
�1�GÐ$Ñ$Ô$€AØ„w�&ÒÐÝÐGÑHÔHÐHÝ˜‘
”
�I€Qˆˆ1ÝŒ8•U˜1˜b‘\”\¥5¨¨B¡<¤<µ°q¸"±´Ð>Ñ?Ô?Ð?ó    Úweylc                óà   — t          j        | t          ¬¦  «        }t          |¦  «        \  }}}t          j        t          |d¦  «        t          |d¦  «        t          |d¦  «        g¦  «        S )a|  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   )r   Úmatr   r   r   s        r   r   r   .   sX   € õ Œ*�T¥Ð
'Ñ
'Ô
'€CÝ�c‘
”
�I€Qˆˆ1ÝŒ8•U˜1˜b‘\”\¥5¨¨B¡<¤<µ°q¸"±´Ð>Ñ?Ô?Ð?r   )r   r   r   r   )r   r   r   r   )
Ú__doc__Ú
__future__r   Únumpyr   Ú&qiskit._accelerate.two_qubit_decomposer   r   r   r   © r   r   ú<module>r%      s�   ððð ð #Ð "Ð "Ð "Ð "Ð "Ø Ð Ð Ð Ø XÐ XÐ XÐ XÐ XÐ XØ MÐ MÐ MÐ MÐ MÐ Mð@ð @ð @ð @ð.@ð @ð @ð @ð @ð @r   