§
    º³Ùg  ã                   óJ   — d Z ddlmZ ddlmZ ddlmZ  G d„ de¦  «        ZdS )z;Check if a DAG circuit is already mapped to a coupling map.é    )ÚAnalysisPass)ÚTarget)Ú	check_mapc                   ó*   ‡ — e Zd ZdZdˆ fd„	Zd„ Zˆ xZS )ÚCheckMapas  Check if a DAG circuit is already mapped to a coupling map.

    Check if a DAGCircuit is mapped to ``coupling_map`` by checking that all
    2-qubit interactions are laid out to be on adjacent qubits in the global coupling
    map of the device, setting the property set field (either specified with ``property_set_field``
    or the default ``is_swap_mapped``) to ``True`` or ``False`` accordingly. Note this does not
    validate directionality of the connectivity between  qubits. If you need to check gates are
    implemented in a native direction for a target use the :class:`~.CheckGateDirection` pass
    instead.
    Nc                 ó°  •— t          ¦   «                              ¦   «          |€d| _        n|| _        t          |t          ¦  «        r|                     ¦   «         }n|}|€	d| _        dS t          ¦   «         | _        |                     ¦   «         D ]D}| j         	                    |¦  «         | j         	                    |d         |d         f¦  «         ŒEdS )aj  CheckMap initializer.

        Args:
            coupling_map (Union[CouplingMap, Target]): Directed graph representing a coupling map.
            property_set_field (str): An optional string to specify the property set field to
                store the result of the check. If not default the result is stored in
                ``"is_swap_mapped"``.
        NÚis_swap_mappedé   r   )
ÚsuperÚ__init__Úproperty_set_fieldÚ
isinstancer   Úbuild_coupling_mapÚqargsÚsetÚ	get_edgesÚadd)ÚselfÚcoupling_mapr   ÚcmapÚedgeÚ	__class__s        €ú^/granary/edev/quantum/lib/python3.11/site-packages/qiskit/transpiler/passes/utils/check_map.pyr   zCheckMap.__init__!   sÔ   ø€ õ 	‰Œ×ÒÑÔÐØÐ%Ø&6ˆDÔ#Ð#à&8ˆDÔ#Ý�l¥FÑ+Ô+ð 	 Ø×2Ò2Ñ4Ô4ˆDˆDàˆDØˆ<ØˆDŒJˆJˆJå™œˆDŒJØŸšÑ(Ô(ð 3ð 3�Ø”
—’˜tÑ$Ô$Ð$Ø”
—’  Q¤¨¨a¬Ð1Ñ2Ô2Ð2Ð2ð3ð 3ó    c                 ó<  — | j         sd| j        | j        <   dS t          j        || j         ¦  «        }|€d| j        | j        <   dS d| j        | j        <   |d         › d|j        |d         d                  › d|j        |d         d                  › d�| j        d	<   dS )
zÞRun the CheckMap pass on `dag`.

        If `dag` is mapped to `coupling_map`, the property
        `is_swap_mapped` is set to True (or to False otherwise).

        Args:
            dag (DAGCircuit): DAG to map.
        TNFr   ú(r
   z, z) failedÚcheck_map_msg)r   Úproperty_setr   r   Úqubits)r   ÚdagÚress      r   ÚrunzCheckMap.run;   s²   € ð Œzð 	Ø9=ˆDÔ˜dÔ5Ñ6ØˆFÝÔ! # t¤zÑ2Ô2ˆØˆ;Ø9=ˆDÔ˜dÔ5Ñ6ØˆFØ5:ˆÔ˜$Ô1Ñ2à�1ŒvÐPÐP˜œ
 3 q¤6¨!¤9Ô-ÐPÐP°´¸CÀ¼FÀ1¼IÔ1FÐPÐPÐPð 	Ô˜/Ñ*Ð*Ð*r   )N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r"   Ú__classcell__)r   s   @r   r   r      sV   ø€ € € € € ð	ð 	ð3ð 3ð 3ð 3ð 3ð 3ð4
ð 
ð 
ð 
ð 
ð 
ð 
r   r   N)r&   Úqiskit.transpiler.basepassesr   Úqiskit.transpiler.targetr   Úqiskit._accelerater   r   © r   r   ú<module>r,      sx   ðð BÐ Aà 5Ð 5Ð 5Ð 5Ð 5Ð 5Ø +Ð +Ð +Ð +Ð +Ð +à (Ð (Ð (Ð (Ð (Ð (ð9
ð 9
ð 9
ð 9
ð 9
ˆ|ñ 9
ô 9
ð 9
ð 9
ð 9
r   