§
    º³Ùg�	  ã                  ó>   — 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S )z:Depth-efficient synthesis algorithm for Permutation gates.é    )ÚannotationsN)ÚQuantumCircuit)Ú _synth_permutation_depth_lnn_kmsÚpatternúlist[int] | np.ndarray[int]Úreturnr   c                óH   — t          j        t          | ¦  «        d¬¦  «        S )af  Synthesize a permutation circuit for a linear nearest-neighbor
    architecture using the Kutin, Moulton, Smithline method.

    This is the permutation synthesis algorithm from [1], section 6.
    It synthesizes any permutation of n qubits over linear nearest-neighbor
    architecture using SWAP gates with depth at most :math:`n` and size at most
    :math:`n(n-1)/2` (where both depth and size are measured with respect to SWAPs).

    Args:
        pattern: Permutation pattern, describing
            which qubits occupy the positions 0, 1, 2, etc. after applying the
            permutation. That is, ``pattern[k] = m`` when the permutation maps
            qubit ``m`` to position ``k``. As an example, the pattern ``[2, 4, 3, 0, 1]``
            means that qubit ``2`` goes to position ``0``, qubit ``4`` goes to
            position ``1``, etc.

    Returns:
        The synthesized quantum circuit.

    References:
        1. Samuel A. Kutin, David Petrie Moulton and Lawren M. Smithline.
           *Computation at a distance.*,
           `arXiv:quant-ph/0701194v1 <https://arxiv.org/abs/quant-ph/0701194>`_
    T)Úadd_regs)r   Ú_from_circuit_datar   )r   s    úb/granary/edev/quantum/lib/python3.11/site-packages/qiskit/synthesis/permutation/permutation_lnn.pyÚsynth_permutation_depth_lnn_kmsr      s+   € õ> Ô,Ý(¨Ñ1Ô1¸Dðñ ô ð ó    )r   r   r   r   )
Ú__doc__Ú
__future__r   ÚnumpyÚnpÚqiskit.circuit.quantumcircuitr   Ú(qiskit._accelerate.synthesis.permutationr   r   © r   r   ú<module>r      sn   ðð AÐ @à "Ð "Ð "Ð "Ð "Ð "Ø Ð Ð Ð Ø 8Ð 8Ð 8Ð 8Ð 8Ð 8Ø UÐ UÐ UÐ UÐ UÐ Uð!ð !ð !ð !ð !ð !r   