§
    ¹³Ùg¸J  ã                  ór  — d Z ddlmZ ddlmZ ddlmZ ddlZddl	m
Z
mZmZ ddlmZ ddlmZ dd	lmZmZmZ dd
lmZmZ ddlmZ ddlmZmZ ddlmZmZ ddl m!Z!m"Z"m#Z#m$Z$m%Z% ddl&m'Z' ddl(m)Z)m*Z* ddl+m,Z, ddl-m.Z.m/Z/m0Z0 	 d0d1d„Z1d2d „Z2 G d!„ d"e)e,e*                  ¦  «        Z3d3d&„Z4d4d)„Z5d5d-„Z6d6d/„Z7dS )7z<Estimator V1 implementation for an arbitrary Backend object.é    )Úannotations)ÚSequence)Ú
accumulateN)ÚClassicalRegisterÚQuantumCircuitÚQuantumRegister)Ú	transpile)ÚQiskitError)Ú	BackendV1Ú	BackendV2ÚOptions)ÚPauliÚ	PauliList)ÚBaseOperator)ÚCountsÚResult)ÚCouplingMapÚPassManager)ÚApplyLayoutÚEnlargeWithAncillaÚFullAncillaAllocationÚOptimize1qGatesDecompositionÚ	SetLayout)Údeprecate_funcé   )ÚBaseEstimatorÚEstimatorResult)ÚPrimitiveJob)Ú_circuit_keyÚ_observable_keyÚinit_observableTÚcircuitsú%QuantumCircuit | list[QuantumCircuit]ÚbackendúBackendV1 | BackendV2Úclear_metadataÚboolÚreturnútuple[list[Result], list[dict]]c                ó  ‡ ‡‡‡— t          ‰ t          ¦  «        r‰ gŠ g }‰ D ]%}|                     |j        ¦  «         |ri |_        Œ&t          ‰t          ¦  «        r$t          ‰                     ¦   «         dd¦  «        Šn,t          ‰t          ¦  «        r‰j        Šnt          d¦  «        ‚‰r:ˆˆ ˆˆfd„t          dt          ‰ ¦  «        ‰¦  «        D ¦   «         }d„ |D ¦   «         }n! ‰j        ‰ fi ‰¤Ž                     ¦   «         g}||fS )aO  Remove metadata of circuits and run the circuits on a backend.
    Args:
        circuits: The circuits
        backend: The backend
        clear_metadata: Clear circuit metadata before passing to backend.run if
            True.
        **run_options: run_options
    Returns:
        The result and the metadata of the circuits
    Úmax_experimentsNzBackend version not supportedc                óB   •— g | ]} ‰j         ‰||‰z   …         fi ‰¤Ž‘ŒS © )Úrun)Ú.0Úposr$   r"   Úmax_circuitsÚrun_optionss     €€€€úY/granary/edev/quantum/lib/python3.11/site-packages/qiskit/primitives/backend_estimator.pyú
<listcomp>z!_run_circuits.<locals>.<listcomp>J   sL   ø€ ð 
ð 
ð 
àð ˆGŒK˜  s¨\Ñ'9Ð!9Ô:ÐJÐJ¸kÐJÐJð
ð 
ð 
ó    r   c                ó6   — g | ]}|                      ¦   «         ‘ŒS r-   )Úresult)r/   Úxs     r3   r4   z!_run_circuits.<locals>.<listcomp>N   s    € Ð+Ð+Ð+ �!—(’(‘*”*Ð+Ð+Ð+r5   )Ú
isinstancer   ÚappendÚmetadatar   ÚgetattrÚconfigurationr   r1   ÚRuntimeErrorÚrangeÚlenr.   r7   )	r"   r$   r&   r2   r;   ÚcircÚjobsr7   r1   s	   `` `    @r3   Ú_run_circuitsrC   ,   sR  øøøø€ õ  �(�NÑ+Ô+ð Ø�:ˆØ€HØð ð ˆØ�Š˜œÑ&Ô&Ð&Øð 	ØˆDŒMøÝ�'�9Ñ%Ô%ð <Ý˜w×4Ò4Ñ6Ô6Ð8IÈ4ÑPÔPˆˆÝ	�G�YÑ	'Ô	'ð <ØÔ+ˆˆåÐ:Ñ;Ô;Ð;Øð Að
ð 
ð 
ð 
ð 
ð 
ð 
å˜Q¥ H¡¤¨|Ñ<Ô<ð
ñ 
ô 
ˆð ,Ð+ dÐ+Ñ+Ô+ˆˆà�'”+˜hÐ6Ð6¨+Ð6Ð6×=Ò=Ñ?Ô?Ð@ˆØ�8ÐÐr5   Úresultsúlist[Result]c                ó–   — g }| D ]C}|                      ¦   «         }t          |t          ¦  «        s|g}|                     |¦  «         ŒD|S ©N)Ú
get_countsr9   ÚlistÚextend)rD   ÚcountsÚresÚcounts       r3   Ú_prepare_countsrN   T   sX   € Ø€FØð ð ˆØ—’Ñ Ô ˆÝ˜%¥Ñ&Ô&ð 	Ø�GˆEØ�Š�eÑÔÐÐØ€Mr5   c                  óþ   ‡ — e Zd ZdZ edd¬¦  «        	 	 	 	 d5d6ˆ fd„¦   «         Zed7d„¦   «         Zd„ Zed8d„¦   «         Z	ed9d„¦   «         Z
ed:d„¦   «         Zd„ Zd;d"„Zd<d&„Zed=d+„¦   «         Zd8d,„Zd>d3„Zd4„ Zˆ xZS )?ÚBackendEstimatora‹  Evaluates expectation value using Pauli rotation gates.

    The :class:`~.BackendEstimator` class is a generic implementation of the
    :class:`~.BaseEstimator` (V1) interface that is used to wrap a :class:`~.BackendV2`
    (or :class:`~.BackendV1`) object in the :class:`~.BaseEstimator` V1 API. It
    facilitates using backends that do not provide a native
    :class:`~.BaseEstimator` V1 implementation in places that work with
    :class:`~.BaseEstimator` V1.
    However, if you're using a provider that has a native implementation of
    :class:`~.BaseEstimatorV1` ( :class:`~.BaseEstimator`) or
    :class:`~.BaseEstimatorV2`, it is a better
    choice to leverage that native implementation as it will likely include
    additional optimizations and be a more efficient implementation.
    The generic nature of this class precludes doing any provider- or
    backend-specific optimizations.
    z1.2z»All implementations of the `BaseEstimatorV1` interface have been deprecated in favor of their V2 counterparts. The V2 alternative for the `BackendEstimator` class is `BackendEstimatorV2`.)ÚsinceÚadditional_msgNTFr$   r%   Úoptionsúdict | NoneÚabelian_groupingr'   Úbound_pass_managerúPassManager | NoneÚskip_transpilationc           
     óÌ  •— t          ¦   «                              |¬¦  «         g | _        g | _        g | _        || _        || _        t          ¦   «         | _        || _	        d| _
        d| _        t          t          t          t          | j        ¦  «        ¦  «        t          t          | j        ¦  «        ¦  «        ¦  «        ¦  «        | _        || _        i | _        i | _        dS )a_  Initialize a new BackendEstimator (V1) instance

        Args:
            backend: (required) the backend to run the primitive on
            options: Default options.
            abelian_grouping: Whether the observable should be grouped into
                commuting
            bound_pass_manager: An optional pass manager to run after
                parameter binding.
            skip_transpilation: If this is set to True the internal compilation
                of the input circuits is skipped and the circuit objects
                will be directly executed when this object is called.
        )rS   N)ÚsuperÚ__init__Ú	_circuitsÚ_parametersÚ_observablesÚ_abelian_groupingÚ_backendr   Ú_transpile_optionsÚ_bound_pass_managerÚ_preprocessed_circuitsÚ_transpiled_circuitsrI   Úzipr?   r@   Ú	_groupingÚ_skip_transpilationÚ_circuit_idsÚ_observable_ids)Úselfr$   rS   rU   rV   rX   Ú	__class__s         €r3   r[   zBackendEstimator.__init__p   sÆ   ø€ õ6 	‰Œ×Ò ÐÑ)Ô)Ð)ØˆŒØˆÔØˆÔà!1ˆÔàˆŒå")¡)¤)ˆÔØ#5ˆÔ à`dˆÔ#ØAEˆÔ!å�c¥%­¨D¬NÑ(;Ô(;Ñ"<Ô"<½eÅCÈÔHYÑDZÔDZÑ>[Ô>[Ñ\Ô\Ñ]Ô]ˆŒØ#5ˆÔ àˆÔØ!ˆÔÐÐr5   r(   r   c                ó   — | j         S )z;Return the transpiler options for transpiling the circuits.)ra   ©rj   s    r3   Útranspile_optionsz"BackendEstimator.transpile_options    s   € ð Ô&Ð&r5   c                ó8   — d| _          | j        j        di |¤Ž dS )zxSet the transpiler options for transpiler.
        Args:
            **fields: The fields to update the options
        Nr-   )rd   ra   Úupdate_options)rj   Úfieldss     r3   Úset_transpile_optionsz&BackendEstimator.set_transpile_options¥   s.   € ð
 %)ˆÔ!Ø.ˆÔÔ.Ð8Ð8°Ð8Ð8Ð8Ð8Ð8r5   ú1list[tuple[QuantumCircuit, list[QuantumCircuit]]]c                óB   — |                       ¦   «         | _        | j        S )z‹
        Transpiled quantum circuits produced by preprocessing
        Returns:
            List of the transpiled quantum circuit
        )Ú_preprocessingrc   rm   s    r3   Úpreprocessed_circuitsz&BackendEstimator.preprocessed_circuits­   s!   € ð '+×&9Ò&9Ñ&;Ô&;ˆÔ#ØÔ*Ð*r5   úlist[QuantumCircuit]c                ó8   — |                       ¦   «          | j        S )z¼
        Transpiled quantum circuits.
        Returns:
            List of the transpiled quantum circuit
        Raises:
            QiskitError: if the instance has been closed.
        )Ú
_transpilerd   rm   s    r3   Útranspiled_circuitsz$BackendEstimator.transpiled_circuits¹   s   € ð 	�ŠÑÔÐØÔ(Ð(r5   c                ó   — | j         S )zW
        Returns:
            The backend which this estimator object based on
        )r`   rm   s    r3   r$   zBackendEstimator.backendÅ   s   € ð Œ}Ðr5   c                ó$  — g | _         | j        D �]\  }}| j        r6|                     ¦   «         }t	          t          |j        ¦  «        ¦  «        }n_t          || j        fi | j	        j
        ¤Ž}|j        �|j                             ¦   «         }n!t	          t          |j        ¦  «        ¦  «        }t          || j        ¦  «        }|                     |¦  «        }g }|D ]ž}|                     ¦   «         }|j        d         }	|j        D ]%}
|	j        |
j        k    rt#          d|	› d�¦  «        ‚Œ&|                     |	¦  «         |                     ||	d¬¦  «         |j        |_        |                     |¦  «         ŒŸ| xj         |z  c_         �Œ�dS )zSplit TranspileNr   zNClassical register for measurements conflict with those of the input circuit: z9. Recommended to avoid register names starting with '__'.T)ÚclbitsÚinplace)rd   rv   rg   ÚcopyrI   r?   Ú
num_qubitsr	   r$   rn   Ú__dict__ÚlayoutÚfinal_index_layoutÚ%_passmanager_for_measurement_circuitsr.   ÚcregsÚnamer
   Úadd_registerÚcomposer;   r:   )rj   Úcommon_circuitÚdiff_circuitsÚtranspiled_circuitrƒ   Úpassmanagerrz   Údiff_circuitÚtranspiled_circuit_copyr}   Úcregs              r3   ry   zBackendEstimator._transpileÍ   sî  € à$&ˆÔ!Ø-1Ô-Gð #	=ñ #	=Ñ)ˆN˜MàÔ'ð 
TØ%3×%8Ò%8Ñ%:Ô%:Ð"Ý%)­%°Ô0IÑ*JÔ*JÑ%KÔ%KÐ"Ð"å%.Ø" D¤Lð&ð &Ø48Ô4JÔ4Sð&ð &Ð"ð &Ô,Ð8Ø);Ô)B×)UÒ)UÑ)WÔ)WÐ&Ð&å)-­eÐ4FÔ4QÑ.RÔ.RÑ)SÔ)SÐ&õ @Ð@RÐTXÔT`ÑaÔaˆKØ'ŸOšO¨MÑ:Ô:ˆMà"$ÐØ -ð Dð D�Ø*<×*AÒ*AÑ*CÔ*CÐ'ð &Ô+¨AÔ.�Ø3Ô9ð ð �DØ”{ d¤iÒ/Ð/Ý)ðVØ(.ðVð Vð Vñô ð ð 0ð (×4Ò4°VÑ<Ô<Ð<Ø'×/Ò/°ÀVÐUYÐ/ÑZÔZÐZØ3?Ô3HÐ'Ô0Ø#×*Ò*Ð+BÑCÔCÐCÐCØÐ%Ô%Ð)<Ñ<Ð%Ô%Ñ%ðG#	=ð #	=r5   r"   úSequence[int]ÚobservablesÚparameter_valuesúSequence[Sequence[float]]r   c                óÌ  ‡ ‡
‡— t          t          ||¦  «        ¦  «        ‰ _        ‰ j        Šd„ ‰ j        D ¦   «         }dgt          t          |¦  «        ¦  «        z   Š
ˆ fd„t          ||¦  «        D ¦   «         }ˆ
ˆfd„t          t          ||¦  «        ¦  «        D ¦   «         }‰                      |¦  «        }t          |‰ j	        fi |¤Ž\  }}	‰  
                    |‰
|	¦  «        S )Nc                ó2   — g | ]\  }}t          |¦  «        ‘ŒS r-   )r@   )r/   Ú_Úms      r3   r4   z*BackendEstimator._call.<locals>.<listcomp>   s"   € ÐKÐKÐK¡f q¨!�3˜q™6œ6ÐKÐKÐKr5   r   c                óf   •— g | ]-\  }}t          t          ‰j        |         |¦  «        ¦  «        ‘Œ.S r-   )Údictre   r]   )r/   ÚiÚvaluerj   s      €r3   r4   z*BackendEstimator._call.<locals>.<listcomp>  sD   ø€ ð 
ð 
ð 
Ù6>°a¸�D•�TÔ% aÔ(¨%Ñ0Ô0Ñ1Ô1ð
ð 
ð 
r5   c                óÌ   •— g | ]`\  }\  }}t          ‰|         ‰|         |z   ¦  «        D ]8}t          |¦  «        d k    r‰|         n‰|                              |¦  «        ‘Œ9ŒaS )r   )r?   r@   Úassign_parameters)r/   rš   ÚpÚnÚcircuit_indexÚaccumrz   s        €€r3   r4   z*BackendEstimator._call.<locals>.<listcomp>  s�   ø€ ð 
ð 
ð 
ñ �‘6�A�qÝ!& u¨Q¤x°°q´¸A±Ñ!>Ô!>ð
ð 
ð õ	 �q‘6”6˜Q’;�;ð $ MÔ2Ð2à(¨Ô7×IÒIÈ!ÑLÔLð	
ð 
ð 
ð 
r5   )rI   re   rf   rz   rv   r   Ú	enumerateÚ_bound_pass_manager_runrC   r`   Ú_postprocessing)rj   r"   r‘   r’   r2   Únum_observablesÚparameter_dictsÚbound_circuitsr7   r;   r¡   rz   s   `         @@r3   Ú_callzBackendEstimator._callõ   s  øøø€ õ �c (¨KÑ8Ô8Ñ9Ô9ˆŒØ"Ô6ÐØKÐK°Ô0JÐKÑKÔKˆØ�•d�: oÑ6Ô6Ñ7Ô7Ñ7ˆð
ð 
ð 
ð 
ÝBEÀhÐP`ÑBaÔBað
ñ 
ô 
ˆð
ð 
ð 
ð 
ð 
õ '¥s¨?¸OÑ'LÔ'LÑMÔMð
ñ 
ô 
ˆð ×5Ò5°nÑEÔEˆõ )¨¸¼ÐVÐVÈ+ÐVÐVÑˆ�à×#Ò# F¨E°8Ñ<Ô<Ð<r5   útuple[QuantumCircuit, ...]útuple[BaseOperator, ...]útuple[tuple[float, ...], ...]c                ót  — g }|D ]Ê}| j                              t          |¦  «        ¦  «        }|�|                     |¦  «         ŒA|                     t	          | j        ¦  «        ¦  «         t	          | j        ¦  «        | j         t          |¦  «        <   | j                             |¦  «         | j                             |j        ¦  «         ŒËg }|D ]º}	t          |	¦  «        }	| j	                             t          |	¦  «        ¦  «        }|�|                     |¦  «         ŒP|                     t	          | j        ¦  «        ¦  «         t	          | j        ¦  «        | j	        t          |	¦  «        <   | j                             |	¦  «         Œ»t          | j        |||fi |¤Ž}
|
                     ¦   «          |
S rG   )rh   Úgetr   r:   r@   r\   r]   Ú
parametersr!   ri   r    r^   r   r¨   Ú_submit)rj   r"   r‘   r’   r2   Úcircuit_indicesÚcircuitÚindexÚobservable_indicesÚ
observableÚjobs              r3   Ú_runzBackendEstimator._run  s¶  € ð ˆØð 	<ð 	<ˆGØÔ%×)Ò)­,°wÑ*?Ô*?Ñ@Ô@ˆEØÐ Ø×&Ò& uÑ-Ô-Ð-Ð-à×&Ò&¥s¨4¬>Ñ':Ô':Ñ;Ô;Ð;Ý;>¸t¼~Ñ;NÔ;N�Ô!¥,¨wÑ"7Ô"7Ñ8Ø”×%Ò% gÑ.Ô.Ð.ØÔ ×'Ò'¨Ô(:Ñ;Ô;Ð;Ð;ØÐØ%ð 	5ð 	5ˆJÝ(¨Ñ4Ô4ˆJØÔ(×,Ò,­_¸ZÑ-HÔ-HÑIÔIˆEØÐ Ø"×)Ò)¨%Ñ0Ô0Ð0Ð0à"×)Ò)­#¨dÔ.?Ñ*@Ô*@ÑAÔAÐAÝDGÈÔHYÑDZÔDZ�Ô$¥_°ZÑ%@Ô%@ÑAØÔ!×(Ò(¨Ñ4Ô4Ð4Ð4ÝØŒJ˜Ð);Ð=Mð
ð 
ØQ\ð
ð 
ˆð 	�Š‰ŒˆØˆ
r5   r€   ÚintÚpaulir   c                óæ  — t          j        |j        ¦  «        |j        |j        z           }t          j        |¦  «        sdg}t          t          | d¦  «        t          t          |¦  «        d|› �¦  «        ¦  «        }t          |¦  «        D ]_\  }}|j        |         r7|j        |         r|                     |¦  «         |                     |¦  «         |                     ||¦  «         Œ`||fS )Nr   ÚqÚ__c_)ÚnpÚaranger€   Úzr8   Úanyr   r   r   r@   r¢   ÚsdgÚhÚmeasure)r€   r¸   Úqubit_indicesÚmeas_circuitÚclbitrš   s         r3   Ú_measurement_circuitz%BackendEstimator._measurement_circuit8  sû   € õ œ	 %Ô"2Ñ3Ô3°E´G¸e¼gÑ4EÔFˆÝŒv�mÑ$Ô$ð 	 Ø˜CˆMÝ%Ý˜J¨Ñ,Ô,Õ.?ÅÀMÑ@RÔ@RÐTbÐ[`ÐTbÐTbÑ.cÔ.cñ
ô 
ˆõ " -Ñ0Ô0ð 	+ð 	+‰HˆE�1ØŒw�qŒzð "Ø”7˜1”:ð (Ø ×$Ò$ QÑ'Ô'Ð'Ø—’˜qÑ!Ô!Ð!Ø× Ò   EÑ*Ô*Ð*Ð*Ø˜]Ð*Ð*r5   c                ól  — g }| j         D �](}| j        |d                  }| j        |d                  }g }| j        �r|                     d¬¦  «        D ]ý}t          t          j                             |j	        j
        ¦  «        t          j                             |j	        j        ¦  «        f¦  «        }|                      |j        |¦  «        \  }}	t          j        |j	        j
        dd…|	f         |j	        j        dd…|	f         |j	        j        ¦  «        }
|
t          j        |j        ¦  «        dœ|_        |                     |¦  «         Œþn·t+          |j	        |¦  «        D ]¡\  }}|                      |j        |¦  «        \  }}	t          j        |j	        j
        dd…|	f         |j	        j        dd…|	f         |j	        j        ¦  «        }
|
t          j        |j        ¦  «        dœ|_        |                     |¦  «         Œ¢|                     |                     ¦   «         |f¦  «         �Œ*|S )z_
        Preprocessing for evaluation of expectation value using pauli rotation gates.
        r   r   T)Ú
qubit_wiseN)ÚpaulisÚcoeffs)rf   r\   r^   r_   Úgroup_commutingr   r¼   Ú
logical_orÚreducerÉ   r¾   r8   rÆ   r€   r   Úfrom_symplecticÚphaseÚreal_if_closerÊ   r;   r:   re   r   )rj   rv   Úgroupr±   r´   rŠ   ÚobsÚbasisrÄ   ÚindicesrÉ   s              r3   ru   zBackendEstimator._preprocessingL  s=  € ð !#ÐØ”^ð "	Jñ "	JˆEØ”n U¨1¤XÔ.ˆGØÔ*¨5°¬8Ô4ˆJØ24ˆMØÔ%ñ 7Ø%×5Ò5ÀÐ5ÑFÔFð 7ð 7�CÝ!Ýœ×-Ò-¨c¬j¬lÑ;Ô;½R¼]×=QÒ=QÐRUÔR\ÔR^Ñ=_Ô=_Ð`ñô �Eð -1×,EÒ,EÀgÔFXÐZ_Ñ,`Ô,`Ñ)�L 'Ý&Ô6Øœ
œ Q Q Q¨ ZÔ0Øœ
œ Q Q Q¨ ZÔ0Øœ
Ô(ñô �Fð #)Ý"$Ô"2°3´:Ñ">Ô">ð-ð -�LÔ)ð "×(Ò(¨Ñ6Ô6Ð6Ð6ð7õ  #& jÔ&7¸Ñ"DÔ"Dð 7ð 7‘J�E˜3Ø,0×,EÒ,EÀgÔFXÐZ_Ñ,`Ô,`Ñ)�L 'Ý&Ô6Øœ
œ Q Q Q¨ ZÔ0Øœ
œ Q Q Q¨ ZÔ0Øœ
Ô(ñô �Fð #)Ý"$Ô"2°3´:Ñ">Ô">ð-ð -�LÔ)ð "×(Ò(¨Ñ6Ô6Ð6Ð6à!×(Ò(¨'¯,ª,©.¬.¸-Ð)HÑIÔIÐIÑIØ$Ð$r5   r7   rE   r¡   ú	list[int]r;   ú
list[dict]c                ó¢  — t          |¦  «        }g }g }g }t          ||dd…         ¦  «        D ]æ\  }}	d}
d}t          ||	¦  «        D ]h}||         }|d         }|d         }||         }t          ||¦  «        \  }}|
t	          j        ||¦  «        z  }
|t	          j        ||dz  ¦  «        z  }Œi|                     |
¦  «         |                     |¦  «         |                     t          ||                              ¦   «         ¦  «        ¦  «         Œçd„ t          ||¦  «        D ¦   «         }t          t	          j
        |¦  «        |¦  «        S )z`
        Postprocessing for evaluation of expectation value using pauli rotation gates.
        r   Ng        rÉ   rÊ   é   c                ó   — g | ]
\  }}||d œ‘ŒS ))ÚvarianceÚshotsr-   )r/   ÚvarrÛ   s      r3   r4   z4BackendEstimator._postprocessing.<locals>.<listcomp>—  s$   € ÐbÐbÐb¹*¸#¸u ¨uÐ5Ð5ÐbÐbÐbr5   )rN   re   r?   Ú_pauli_expval_with_variancer¼   Údotr:   ÚsumÚvaluesr   rÐ   )rj   r7   r¡   r;   rK   Úexpval_listÚvar_listÚ
shots_listrš   ÚjÚcombined_expvalÚcombined_varÚkÚmetarÉ   rÊ   rM   ÚexpvalsÚ	variancess                      r3   r¤   z BackendEstimator._postprocessingv  s`  € õ ! Ñ(Ô(ˆØˆØˆØˆ
å˜˜u Q R RœyÑ)Ô)ð 	7ð 	7‰DˆAˆqà!ˆOØˆLå˜1˜a‘[”[ð =ð =�Ø ”{�Ø˜hœ�Ø˜hœ�à˜qœ	�å%@ÀÈÑ%OÔ%OÑ"�˜ð  ¥2¤6¨'°6Ñ#:Ô#:Ñ:�Ø¥¤ y°&¸!±)Ñ <Ô <Ñ<��à×Ò˜Ñ/Ô/Ð/Ø�OŠO˜LÑ)Ô)Ð)Ø×Ò�c &¨¤)×"2Ò"2Ñ"4Ô"4Ñ5Ô5Ñ6Ô6Ð6Ð6àbÐbÍÈHÐV`ÑHaÔHaÐbÑbÔbˆå�rÔ/°Ñ<Ô<¸hÑGÔGÐGr5   c                ó|   — | j         €|S | j                              |¦  «        }t          |t          ¦  «        s|g}|S rG   )rb   r.   r9   rI   )rj   r"   Úoutputs      r3   r£   z(BackendEstimator._bound_pass_manager_run›  sD   € ØÔ#Ð+ØˆOàÔ-×1Ò1°(Ñ;Ô;ˆFÝ˜f¥dÑ+Ô+ð "Ø ˜�ØˆMr5   )NTNF)
r$   r%   rS   rT   rU   r'   rV   rW   rX   r'   )r(   r   )r(   rs   )r(   rw   )r(   r%   )r"   r�   r‘   r�   r’   r“   r(   r   )r"   r©   r‘   rª   r’   r«   )r€   r·   r¸   r   )r7   rE   r¡   rÕ   r;   rÖ   r(   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r[   Úpropertyrn   rr   rv   rz   r$   ry   r¨   r¶   ÚstaticmethodrÆ   ru   r¤   r£   Ú__classcell__)rk   s   @r3   rP   rP   ^   sª  ø€ € € € € ðð ð" €^ØðWðñ ô ð  $Ø!%Ø15Ø#(ð("ð ("ð ("ð ("ð ("ð ("ñô ð("ðT ð'ð 'ð 'ñ „Xð'ð9ð 9ð 9ð ð	+ð 	+ð 	+ñ „Xð	+ð ð	)ð 	)ð 	)ñ „Xð	)ð ðð ð ñ „Xðð&=ð &=ð &=ðP =ð  =ð  =ð  =ðDð ð ð ðB ð+ð +ð +ñ „\ð+ð&(%ð (%ð (%ð (%ðT#Hð #Hð #Hð #HðJð ð ð ð ð ð r5   rP   rÉ   r   rÕ   c                óØ   — | j         | j        z  }t          j        |dd¬¦  «        }ddt          j        |j        d         t          ¬¦  «        z  z  }||z  }|                     ¦   «         S )z®Convert PauliList to diagonal integers.
    These are integer representations of the binary string with a
    1 where there are Paulis, and 0 where there are identities.
    r   Úlittle)ÚaxisÚbitorderé   ©Údtype)r¾   r8   r¼   Úpackbitsr½   ÚshapeÚobjectÚtolist)rÉ   ÚnonidÚpacked_valsÚpower_uint8Úindss        r3   Ú_paulis2indsr  ¥  sh   € ð ŒH�v”xÑ€Eõ ”+˜e¨!°hÐ?Ñ?Ô?€KØ˜�BœI kÔ&7¸Ô&:Å&ÐIÑIÔIÑIÑJ€KØ˜Ñ$€DØ�;Š;‰=Œ=Ðr5   Úintegerr·   c                óL   — t          | ¦  «                             d¦  «        dz  S )zReturn the parity of an integerÚ1rØ   )ÚbinrM   )r  s    r3   Ú_parityr  µ  s!   € åˆw‰<Œ<×Ò˜cÑ"Ô" QÑ&Ð&r5   rK   r   útuple[np.ndarray, np.ndarray]c                ó¼  — t          |¦  «        }t          |¦  «        }t          j        |t          ¬¦  «        }d}|                      ¦   «         D ]|\  }}d|v r|                     dd¦  «        d         n|}t          |d¦  «        }	||z  }t          |¦  «        D ]0}
dt          ||
         |	z  ¦  «        z  }||
xx         ||z  z  cc<   Œ1Œ}||z  }d|dz  z
  }||fS )zÛReturn array of expval and variance pairs for input Paulis.
    Note: All non-identity Pauli's are treated as Z-paulis, assuming
    that basis rotations have been applied to convert them to the
    diagonal basis.
    rù   r   ú r   rØ   éÿÿÿÿ)
r@   r  r¼   ÚzerosÚfloatÚitemsÚsplitr·   r?   r  )rK   rÉ   ÚsizeÚ	diag_indsré   ÚdenomÚbin_outcomeÚfreqÚsplit_outcomeÚoutcomerç   Úcoeffrê   s                r3   rÝ   rÝ   º  s
  € õ ˆv‰;Œ;€DÝ˜VÑ$Ô$€IåŒh�t¥5Ð)Ñ)Ô)€GØ€EØ#Ÿ\š\™^œ^ð 'ð 'Ñˆ�TØ8;¸{Ð8JÐ8J˜×)Ò)¨#¨qÑ1Ô1°!Ô4Ð4ÐP[ˆÝ�m QÑ'Ô'ˆØ�‰ˆÝ�t‘”ð 	'ð 	'ˆAØ�G I¨a¤L°7Ñ$:Ñ;Ô;Ñ;ˆEØ�AˆJˆJŒJ˜$ ™,Ñ&ˆJˆJ‰JˆJð	'ð
 ˆuÑ€Gð �G˜Q‘J‘€IØ�IÐÐr5   r   c                ór  — t          t          | ¦  «        g¦  «        }t          |t          ¦  «        rt	          |j        ¬¦  «        }n't	          |                     ¦   «         j        ¬¦  «        }|                     |¦  «         t          |t          ¦  «        ret          |j	        t          ¦  «        rK|j	        }|                     t          |¦  «        ¦  «         |                     t          ¦   «         ¦  «         n—t          |t          ¦  «        r‚|                     ¦   «         j	        �it          |                     ¦   «         j	        ¦  «        }|                     t          |¦  «        ¦  «         |                     t          ¦   «         ¦  «         |                     t          ¦   «         ¦  «         |S )N)Útarget)rÓ   )r   r   r9   r   r   r  r=   Úbasis_gatesr:   Úcoupling_mapr   r   r   r   r   )r‚   r$   rŒ   Úopt1qr  s        r3   r„   r„   Ö  su  € Ý�y¨Ñ0Ô0Ð1Ñ2Ô2€KÝ�'�9Ñ%Ô%ð XÝ,°G´NÐCÑCÔCˆˆå,°7×3HÒ3HÑ3JÔ3JÔ3VÐWÑWÔWˆØ×Ò�uÑÔÐÝ�'�9Ñ%Ô%ð 1­*°WÔ5IÍ;Ñ*WÔ*Wð 1ØÔ+ˆØ×ÒÕ0°Ñ>Ô>Ñ?Ô?Ð?Ø×ÒÕ-Ñ/Ô/Ñ0Ô0Ð0Ð0Ý	�G�YÑ	'Ô	'ð 1¨G×,AÒ,AÑ,CÔ,CÔ,PÐ,\Ý" 7×#8Ò#8Ñ#:Ô#:Ô#GÑHÔHˆØ×ÒÕ0°Ñ>Ô>Ñ?Ô?Ð?Ø×ÒÕ-Ñ/Ô/Ñ0Ô0Ð0Ø×Ò•{‘}”}Ñ%Ô%Ð%ØÐr5   )T)r"   r#   r$   r%   r&   r'   r(   r)   )rD   rE   )rÉ   r   r(   rÕ   )r  r·   r(   r·   )rK   r   rÉ   r   r(   r	  )r(   r   )8rð   Ú
__future__r   Úcollections.abcr   Ú	itertoolsr   Únumpyr¼   Úqiskit.circuitr   r   r   Úqiskit.compilerr	   Úqiskit.exceptionsr
   Úqiskit.providersr   r   r   Úqiskit.quantum_infor   r   Ú+qiskit.quantum_info.operators.base_operatorr   Úqiskit.resultr   r   Úqiskit.transpilerr   r   Úqiskit.transpiler.passesr   r   r   r   r   Úqiskit.utils.deprecationr   Úbaser   r   Úprimitive_jobr   Úutilsr   r    r!   rC   rN   rP   r  r  rÝ   r„   r-   r5   r3   ú<module>r/     sv  ðð CÐ Bà "Ð "Ð "Ð "Ð "Ð "à $Ð $Ð $Ð $Ð $Ð $Ø  Ð  Ð  Ð  Ð  Ð  à Ð Ð Ð à MÐ MÐ MÐ MÐ MÐ MÐ MÐ MÐ MÐ MØ %Ð %Ð %Ð %Ð %Ð %Ø )Ð )Ð )Ð )Ð )Ð )Ø :Ð :Ð :Ð :Ð :Ð :Ð :Ð :Ð :Ð :Ø 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø DÐ DÐ DÐ DÐ DÐ DØ (Ð (Ð (Ð (Ð (Ð (Ð (Ð (Ø 6Ð 6Ð 6Ð 6Ð 6Ð 6Ð 6Ð 6ðð ð ð ð ð ð ð ð ð ð ð ð ð ð 4Ð 3Ð 3Ð 3Ð 3Ð 3à 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø 'Ð 'Ð 'Ð 'Ð 'Ð 'Ø AÐ AÐ AÐ AÐ AÐ AÐ AÐ AÐ AÐ Að  ð%ð %ð %ð %ð %ðPð ð ð ðDð Dð Dð Dð D�} \°/Ô%BÔCñ Dô Dð DðN
ð ð ð ð 'ð 'ð 'ð 'ð
ð ð ð ð8ð ð ð ð ð r5   