§
    ²Ûgk†  ã                   óÞ   — d Z ddlZddlZddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ d	d
lmZ d	dlmZ d	dlmZ d	dlmZmZmZmZmZ d	dlmZ  ej        e¦  «        Z G d„ de¦  «        ZdS )z
Aer qasm simulator backend.
é    N)Úwarn©ÚOptions)Ú	BackendV2é   )Ú__version__)ÚAerErroré   )Ú
AerBackend)ÚAerBackendConfiguration)Útarget_to_backend_properties)Úcpp_execute_circuitsÚavailable_methodsÚMAX_QUBITS_STATEVECTORÚLEGACY_METHOD_MAPÚmap_legacy_method_config)Úaer_controller_executec                   ó  ‡ — e Zd ZdZ eg d¢¦  «        Z eg d¢¦  «        Zdeeddddd e	d¦  «        dd	eeg d
œZ
g d¢Zd	ZdZd	Zdˆ fd„	Zˆ fd„Zed„ ¦   «         Zed„ ¦   «         Zd„ Zd„ Zd„ Zd„ Zˆ fd„Zd„ Zd„ Zd„ Zdd„Zˆ xZS )ÚQasmSimulatora2  
    Noisy quantum circuit simulator backend.

    **Configurable Options**

    The `QasmSimulator` supports multiple simulation methods and
    configurable options for each simulation method. These may be set using the
    appropriate kwargs during initialization. They can also be set of updated
    using the :meth:`set_options` method.

    Run-time options may also be specified as kwargs using the :meth:`run` method.
    These will not be stored in the backend and will only apply to that execution.
    They will also override any previously set options.

    For example, to configure a density matrix simulator with a custom noise
    model to use for every execution

    .. code-block:: python

        noise_model = NoiseModel.from_backend(backend)
        backend = QasmSimulator(method='density_matrix',
                                noise_model=noise_model)

    **Simulating an IBM Quantum Backend**

    The simulator can be automatically configured to mimic an IBM Quantum backend using
    the :meth:`from_backend` method. This will configure the simulator to use the
    basic device :class:`NoiseModel` for that backend, and the same basis gates
    and coupling map.

    .. code-block:: python

        backend = QasmSimulator.from_backend(backend)

    **Simulation Method Option**

    The simulation method is set using the ``method`` kwarg.
    Supported simulation methods are

    * ``"statevector"``: A dense statevector simulation that can sample
      measurement outcomes from *ideal* circuits with all measurements at
      end of the circuit. For noisy simulations each shot samples a
      randomly sampled noisy circuit from the noise model.
      ``"statevector_cpu"`` is an alias of ``"statevector"``.

    * ``"statevector_gpu"``: A dense statevector simulation that provides
      the same functionalities with ``"statevector"``. GPU performs the computation
      to calculate probability amplitudes as CPU does. If no GPU is available,
      a runtime error is raised.

    * ``"density_matrix"``: A dense density matrix simulation that may
      sample measurement outcomes from *noisy* circuits with all
      measurements at end of the circuit. It can only simulate half the
      number of qubits as the statevector method.

    * ``"density_matrix_gpu"``: A dense density matrix simulation that provides
      the same functionalities with ``"density_matrix"``. GPU performs the computation
      to calculate probability amplitudes as CPU does. If no GPU is available,
      a runtime error is raised.

    * ``"stabilizer"``: An efficient Clifford stabilizer state simulator
      that can simulate noisy Clifford circuits if all errors in the noise model are also
      Clifford errors.

    * ``"extended_stabilizer"``: An approximate simulated based on a
      ranked-stabilizer decomposition that decomposes circuits into stabilizer
      state terms. The number of terms grows with the number of
      non-Clifford gates.

    * ``"matrix_product_state"``: A tensor-network statevector simulator that
      uses a Matrix Product State (MPS) representation for the state.

    * ``"automatic"``: The default behavior where the method is chosen
      automatically for each circuit based on the circuit instructions,
      number of qubits, and noise model.

    **Additional Backend Options**

    The following simulator specific backend options are supported

    * ``method`` (str): Set the simulation method (Default: ``"automatic"``).
      Use :meth:`available_methods` to return a list of all availabe methods.

    * ``device`` (str): Set the simulation device (Default: ``"CPU"``).
      Use :meth:`available_devices` to return a list of devices supported
      on the current system.

    * ``precision`` (str): Set the floating point precision for
      certain simulation methods to either ``"single"`` or ``"double"``
      precision (default: ``"double"``).

    * ``executor`` (futures.Executor): Set a custom executor for
      asynchronous running of simulation jobs (Default: None).

    * ``max_job_size`` (int or None): If the number of run circuits
      exceeds this value simulation will be run as a set of of sub-jobs
      on the executor. If ``None`` simulation of all circuits are submitted
      to the executor as a single job (Default: None).

    * ``max_shot_size`` (int or None): If the number of shots of a noisy
      circuit exceeds this value simulation will be split into multi
      circuits for execution and the results accumulated. If ``None``
      circuits will not be split based on shots. When splitting circuits
      use the ``max_job_size`` option to control how these split circuits
      should be submitted to the executor (Default: None).

    * ``enable_truncation`` (bool): If set to True this removes unnecessary
      qubits which do not affect the simulation outcome from the simulated
      circuits (Default: True).

    * ``zero_threshold`` (double): Sets the threshold for truncating
      small values to zero in the result data (Default: 1e-10).

    * ``validation_threshold`` (double): Sets the threshold for checking
      if initial states are valid (Default: 1e-8).

    * ``max_parallel_threads`` (int): Sets the maximum number of CPU
      cores used by OpenMP for parallelization. If set to 0 the
      maximum will be set to the number of CPU cores (Default: 0).

    * ``max_parallel_experiments`` (int): Sets the maximum number of
      experiments that may be executed in parallel up to the
      max_parallel_threads value. If set to 1 parallel circuit
      execution will be disabled. If set to 0 the maximum will be
      automatically set to max_parallel_threads (Default: 1).

    * ``max_parallel_shots`` (int): Sets the maximum number of
      shots that may be executed in parallel during each experiment
      execution, up to the max_parallel_threads value. If set to 1
      parallel shot execution will be disabled. If set to 0 the
      maximum will be automatically set to max_parallel_threads.
      Note that this cannot be enabled at the same time as parallel
      experiment execution (Default: 0).

    * ``max_memory_mb`` (int): Sets the maximum size of memory
      to store a state vector. If a state vector needs more, an error
      is thrown. In general, a state vector of n-qubits uses 2^n complex
      values (16 Bytes). If set to 0, the maximum will be automatically
      set to the system memory size (Default: 0).

    These backend options only apply when using the ``"statevector"``
    simulation method:

    * ``statevector_parallel_threshold`` (int): Sets the threshold that
      the number of qubits must be greater than to enable OpenMP
      parallelization for matrix multiplication during execution of
      an experiment. If parallel circuit or shot execution is enabled
      this will only use unallocated CPU cores up to
      max_parallel_threads. Note that setting this too low can reduce
      performance (Default: 14).

    * ``statevector_sample_measure_opt`` (int): Sets the threshold that
      the number of qubits must be greater than to enable a large
      qubit optimized implementation of measurement sampling. Note
      that setting this two low can reduce performance (Default: 10)

    These backend options only apply when using the ``"stabilizer"``
    simulation method:

    * ``stabilizer_max_snapshot_probabilities`` (int): set the maximum
      qubit number for the :class:`~qiskit_aer.library.SaveProbabilities` instruction (Default: 32).

    These backend options only apply when using the ``"extended_stabilizer"``
    simulation method:

    * ``extended_stabilizer_sampling_method`` (string): Choose how to simulate
      measurements on qubits. The performance of the simulator depends
      significantly on this choice. In the following, let n be the number of
      qubits in the circuit, m the number of qubits measured, and S be the
      number of shots (Default: resampled_metropolis).

      - ``"metropolis"``: Use a Monte-Carlo method to sample many output
        strings from the simulator at once. To be accurate, this method
        requires that all the possible output strings have a non-zero
        probability. It will give inaccurate results on cases where
        the circuit has many zero-probability outcomes.
        This method has an overall runtime that scales as n^{2} + (S-1)n.

      - ``"resampled_metropolis"``: A variant of the metropolis method,
        where the Monte-Carlo method is reinitialised for every shot. This
        gives better results for circuits where some outcomes have zero
        probability, but will still fail if the output distribution
        is sparse. The overall runtime scales as Sn^{2}.

      - ``"norm_estimation"``: An alternative sampling method using
        random state inner products to estimate outcome probabilites. This
        method requires twice as much memory, and significantly longer
        runtimes, but gives accurate results on circuits with sparse
        output distributions. The overall runtime scales as Sn^{3}m^{3}.

    * ``extended_stabilizer_metropolis_mixing_time`` (int): Set how long the
      monte-carlo method runs before performing measurements. If the
      output distribution is strongly peaked, this can be decreased
      alongside setting extended_stabilizer_disable_measurement_opt
      to True (Default: 5000).

    * ``"extended_stabilizer_approximation_error"`` (double): Set the error
      in the approximation for the extended_stabilizer method. A
      smaller error needs more memory and computational time
      (Default: 0.05).

    * ``extended_stabilizer_norm_estimation_samples`` (int): The default number
      of samples for the norm estimation sampler. The method will use the
      default, or 4m^{2} samples where m is the number of qubits to be
      measured, whichever is larger (Default: 100).

    * ``extended_stabilizer_norm_estimation_repetitions`` (int): The number
      of times to repeat the norm estimation. The median of these reptitions
      is used to estimate and sample output strings (Default: 3).

    * ``extended_stabilizer_parallel_threshold`` (int): Set the minimum
      size of the extended stabilizer decomposition before we enable
      OpenMP parallelization. If parallel circuit or shot execution
      is enabled this will only use unallocated CPU cores up to
      max_parallel_threads (Default: 100).

    * ``extended_stabilizer_probabilities_snapshot_samples`` (int): If using
      the metropolis or resampled_metropolis sampling method, set the number of
      samples used to estimate probabilities in a probabilities snapshot
      (Default: 3000).

    These backend options only apply when using the ``"matrix_product_state"``
    simulation method:

    * ``matrix_product_state_max_bond_dimension`` (int): Sets a limit
      on the number of Schmidt coefficients retained at the end of
      the svd algorithm. Coefficients beyond this limit will be discarded.
      (Default: None, i.e., no limit on the bond dimension).

    * ``matrix_product_state_truncation_threshold`` (double):
      Discard the smallest coefficients for which the sum of
      their squares is smaller than this threshold.
      (Default: 1e-16).

    * ``mps_sample_measure_algorithm`` (str): Choose which algorithm to use for
      ``"sample_measure"`` (Default: "mps_apply_measure").

      - ``"mps_probabilities"``: This method first constructs the probability
        vector and then generates a sample per shot. It is more efficient for
        a large number of shots and a small number of qubits, with complexity
        O(2^n * n * D^2) to create the vector and O(1) per shot, where n is
        the number of qubits and D is the bond dimension.

      - ``"mps_apply_measure"``: This method creates a copy of the mps structure
        and measures directly on it. It is more efficient for a small number of
        shots, and a large number of qubits, with complexity around
        O(n * D^2) per shot.

    * ``mps_log_data`` (str): if True, output logging data of the MPS
      structure: bond dimensions and values discarded during approximation.
      (Default: False)

    These backend options apply in circuit optimization passes:

    * ``fusion_enable`` (bool): Enable fusion optimization in circuit
      optimization passes [Default: True]
    * ``fusion_verbose`` (bool): Output gates generated in fusion optimization
      into metadata [Default: False]
    * ``fusion_max_qubit`` (int): Maximum number of qubits for a operation generated
      in a fusion optimization [Default: 5]
    * ``fusion_threshold`` (int): Threshold that number of qubits must be greater
      than or equal to enable fusion optimization [Default: 14]
    );Úu1Úu2Úu3ÚuÚpÚrÚrxÚryÚrzÚidÚxÚyÚzÚhÚsÚsdgÚsxÚsxdgÚtÚtdgÚswapÚcxÚcyÚczÚcsxÚcpÚcuÚcu1Úcu2Úcu3ÚrxxÚryyÚrzzÚrzxÚccxÚcswapÚmcxÚmcyÚmczÚmcsxÚmcpÚmcphaseÚmcuÚmcu1Úmcu2Úmcu3ÚmcrxÚmcryÚmcrzÚmcrÚmcswapÚunitaryÚdiagonalÚmultiplexerÚ
initializeÚdelayÚpauliÚmcx_grayÚecr)Úquantum_channelÚ
qerror_locÚroerrorÚkrausÚsave_expvalÚsave_expval_varÚsave_probabilitiesÚsave_probabilities_dictÚsave_amplitudesÚsave_amplitudes_sqÚ
save_stateÚsave_density_matrixÚsave_statevectorÚsave_statevector_dictÚsave_stabilizerÚset_statevectorÚset_density_matrixÚset_stabilizerÚresetÚqasm_simulatorz$https://github.com/Qiskit/qiskit-aerTç    €„.AzA C++ Qasm simulator with noiseN)Úbackend_nameÚbackend_versionÚn_qubitsÚurlÚ	simulatorÚlocalÚconditionalÚmemoryÚ	max_shotsÚdescriptionÚcoupling_mapÚbasis_gatesÚcustom_instructionsÚgates)Ú	automaticÚstatevectorÚstatevector_gpuÚstatevector_custatevecÚstatevector_thrustÚdensity_matrixÚdensity_matrix_gpuÚdensity_matrix_custatevecÚdensity_matrix_thrustÚ
stabilizerÚmatrix_product_stateÚextended_stabilizer)ÚCPUÚGPUÚThrustc                 ó~  •— t          dt          ¦  «         t          ¦   «         | _        t          j        €.t          t          j        t          j        ¦  «        t          _        |€t          j
        t          j        ¦  «        }nd|_        | j        | _        t          ¦   «                              ||||¬¦  «         d S )NzsThe `QasmSimulator` backend will be deprecated in the future. It has been superseded by the `AerSimulator` backend.F)ÚproviderÚbackend_options)r   ÚPendingDeprecationWarningr   Ú_controllerr   Ú_AVAILABLE_METHODSr   Ú_SIMULATION_METHODSÚ_SIMULATION_DEVICESr   Ú	from_dictÚ_DEFAULT_CONFIGURATIONÚ
open_pulseÚ_DEFAULT_BASIS_GATESÚ_cached_basis_gatesÚsuperÚ__init__)ÚselfÚconfigurationÚ
propertiesr„   r…   Ú	__class__s        €úX/granary/edev/quantum/lib/python3.11/site-packages/qiskit_aer/backends/qasm_simulator.pyr‘   zQasmSimulator.__init__°  s¾   ø€ Ýðõ &ñ		
ô 	
ð 	
õ 2Ñ3Ô3ˆÔõ Ô+Ð3Ý/@ÝÔ1ÝÔ1ñ0ô 0�MÔ,ð Ð Ý3Ô=½mÔ>bÑcÔcˆMˆMà',ˆMÔ$ð $(Ô#<ˆÔ å‰Œ×ÒØ˜:°È/ð 	ñ 	
ô 	
ð 	
ð 	
ð 	
ó    c                 óv  •— t          ¦   «                              ¦   «         dd…         }dt          | j        j        ¦  «        dz   z  }t          | j        dd¦  «        }|dvr|d|› d|› d	�z  }t          | j        d
d¦  «        }|�-|                     ¦   «         s|d|› dt          |¦  «        › d�z  }|dz  }|S )z'String representation of an AerBackend.Néÿÿÿÿú r
   Úmethod)Nrt   z,
zmethod='ú'Únoise_modelznoise_model=ú))	r�   Ú__repr__Úlenr•   Ú__name__ÚgetattrÚoptionsÚis_idealÚrepr)r’   ÚdisplayÚpadr›   r�   r•   s        €r–   rŸ   zQasmSimulator.__repr__Ï  sØ   ø€ å‘'”'×"Ò"Ñ$Ô$ S b SÔ)ˆØ•S˜œÔ0Ñ1Ô1°AÑ5Ñ6ˆå˜œ x°Ñ6Ô6ˆØÐ,Ð,Ð,ØÐ3˜SÐ3Ð3¨&Ð3Ð3Ð3Ñ3ˆGå˜dœl¨M¸4Ñ@Ô@ˆØÐ"¨;×+?Ò+?Ñ+AÔ+AÐ"ØÐB˜SÐBÐB­d°;Ñ.?Ô.?ÐBÐBÐBÑBˆGà�3‰ˆØˆr—   c                 ó  — t          d?i dd“dd “dd“dd“dd “d	d “d
d “dd“dd“dd “dd “dd “dd “dd “dd“dd“dd“dd“dd “dd “dd“dd “dd “d d “d!d“d"d#“d$d%“d&d'“d(d)“d*d+“d,d-“d.d/“d0d-“d1d2“d3d4“d5d “d6d7“d8d“d9d:“d;d“d<d=“d>d“ŽS )@NÚshotsi   r›   Údevicer€   Ú	precisionÚdoubleÚexecutorÚmax_job_sizeÚmax_shot_sizeÚenable_truncationTÚzero_thresholdg»½×Ùß|Û=Úvalidation_thresholdÚmax_parallel_threadsÚmax_parallel_experimentsÚmax_parallel_shotsÚmax_memory_mbÚfusion_enableÚfusion_verboseFÚfusion_max_qubité   Úfusion_thresholdé   Úaccept_distributed_resultsÚblocking_qubitsÚblocking_enablerm   r�   Úseed_simulatorÚstatevector_parallel_thresholdÚstatevector_sample_measure_opté
   Ú%stabilizer_max_snapshot_probabilitiesé    Ú#extended_stabilizer_sampling_methodÚresampled_metropolisÚ*extended_stabilizer_metropolis_mixing_timeiˆ  Ú'extended_stabilizer_approximation_errorgš™™™™™©?Ú+extended_stabilizer_norm_estimation_sampleséd   Ú/extended_stabilizer_norm_estimation_repetitionsé   Ú&extended_stabilizer_parallel_thresholdÚ2extended_stabilizer_probabilities_snapshot_samplesi¸  Ú)matrix_product_state_truncation_thresholdg¼‰Ø—²Òœ<Ú'matrix_product_state_max_bond_dimensionÚmps_sample_measure_algorithmÚmps_heuristicÚmps_log_dataÚchop_thresholdg:Œ0âŽyE>Úmps_parallel_thresholdÚmps_omp_threadsr
   Ú
mps_lapack© r   )Úclss    r–   Ú_default_optionszQasmSimulator._default_optionsß  s1  € åð 0
ð 0
ð 0
à�$ð0
ð �4ð0
ð �5ð	0
ð
 �hð0
ð �Tð0
ð ˜ð0
ð ˜$ð0
ð #˜dð0
ð !˜5ð0
ð "& ð0
ð "& ð0
ð &* Tð0
ð  $˜tð0
ð ˜$ð0
ð  ˜$ð!0
ð" !˜5ð#0
ð$ ˜Qð%0
ð&  ˜Rð'0
ð( (, tð)0
ð* !˜Dð+0
ð, "˜Eð-0
ð. �4ð/0
ð0 ˜ð10
ð2  ˜4ð30
ð6 ,.¨2ð70
ð8 ,.¨2ð90
ð< 35°"ð=0
ð@ 1GÐ0FðA0
ðB 8<°tðC0
ðD 59°DðE0
ðF 9<¸ðG0
ðH =>¸AðI0
ðJ 47°3ðK0
ðL @D¸tðM0
ðP 7<°eðQ0
ðR 59°DðS0
ðT *9¨ðU0
ðV ˜ðW0
ðX  ˜4ðY0
ðZ $& 2ð[0
ð\ ˜Að]0
ð^ �uð_0
ð 0	
r—   c                 ó  — t          |t          ¦  «        r“|j        €d}n|j        }t          d|j        › d�|j        |j        |j        g t          d¦  «        t          |j
                             ¦   «         ¦  «        |j        |¬¦	  «	        }t          |j        ¦  «        }|j        }n t          dt!          |¦  «        › d�¦  «        ‚d	|vr4d
dlm} |                     |¦  «        }|                     ¦   «         s||d	<    | d|||dœ|¤Ž}	|	S )z"Initialize simulator from backend.Nz$created by AerSimulator.from_backendzaer_simulator_from(rž   re   )	rf   rg   rh   rq   rs   rn   rp   Úmax_experimentsro   z8The backend argument requires a BackendV2 object, not a z objectr�   r   )Ú
NoiseModel)r“   r”   ÚtargetrÙ   )Ú
isinstancer   ro   r   Únamerg   Ú
num_qubitsÚoperation_namesÚintÚlistrp   Ú	get_edgesÚmax_circuitsr   rß   Ú	TypeErrorÚtypeÚnoise.noise_modelrÞ   Úfrom_backendr¤   )
rÚ   Úbackendr£   ro   r“   r”   rß   rÞ   r�   Úsims
             r–   rë   zQasmSimulator.from_backend  sL  € õ �g�yÑ)Ô)ð 	ØÔ"Ð*ØD��à%Ô1�å3ØB°7´<ÐBÐBÐBØ 'Ô 7Ø Ô+Ø#Ô3ØÝ˜c™(œ(Ý! 'Ô"6×"@Ò"@Ñ"BÔ"BÑCÔCØ 'Ô 4Ø'ð
ñ 
ô 
ˆMõ 6°g´nÑEÔEˆJØ”^ˆFˆFåØdÍdÐSZÉmÌmÐdÐdÐdñô ð ð  Ð'Ð'ð 7Ð6Ð6Ð6Ð6Ð6à$×1Ò1°'Ñ:Ô:ˆKØ×'Ò'Ñ)Ô)ð 5Ø)4�˜Ñ&ð ˆcÐ_ ¸*ÈVÐ_Ð_ÐW^Ð_Ð_ˆØˆ
r—   c                 óò   — t          j         | j        ¦  «        }| j                             ¦   «         D ]\  }}t	          |||¦  «         Œ|                      ¦   «         |_        | j        |j        z   |_        |S )z‹Return the simulator backend configuration.

        Returns:
            BackendConfiguration: the configuration for the backend.
        )	ÚcopyÚ_configurationÚ_options_configurationÚitemsÚsetattrÚ_custom_instructionsrr   r�   rq   )r’   ÚconfigÚkeyÚvals       r–   r“   zQasmSimulator.configuration;  s{   € õ ”˜4Ô.Ñ/Ô/ˆØÔ3×9Ò9Ñ;Ô;ð 	&ð 	&‰HˆC�Ý�F˜C Ñ%Ô%Ð%Ð%ð &*×%>Ò%>Ñ%@Ô%@ˆÔ"Ø!Ô5¸Ô8RÑRˆÔØˆr—   c                 ó4   — t          j         | j        ¦  «        S ©z(Return the available simulation methods.)rï   rˆ   ©r’   s    r–   r   zQasmSimulator.available_methodsJ  ó   € åŒy˜Ô0Ñ1Ô1Ð1r—   c                 ó4   — t          j         | j        ¦  «        S rù   )rï   Ú_AVAILABLE_DEVICESrú   s    r–   Úavailable_deviceszQasmSimulator.available_devicesN  rû   r—   c                 óN   — t          |¦  «        }t          | j        |||¦  «        S )z Execute circuits on the backend.)r   r   r‡   )r’   Úaer_circuitsr�   rõ   s       r–   Ú_execute_circuitszQasmSimulator._execute_circuitsR  s'   € å)¨&Ñ1Ô1ˆÝ# DÔ$4°lÀKÐQWÑXÔXÐXr—   c                 óØ  •— |dk    r|                       ||¦  «         d S |dk    rƒ|t          v r&t          |         \  }}|                      d|¦  «         |�=||                      ¦   «         vr't	          d|› d|                      ¦   «         › �¦  «        ‚|                      |¦  «         t          ¦   «                              ||¦  «         |dv r|                      ¦   «         | _        d S d S )Nrr   r›   rª   zInvalid simulation method z. Available methods are: )r›   r�   rq   )	Ú_set_configuration_optionr   Ú
set_optionr   r	   Ú_set_method_configr�   Ú_basis_gatesr�   )r’   rö   Úvaluerª   r•   s       €r–   r  zQasmSimulator.set_optionW  s  ø€ ØÐ'Ò'Ð'Ø×*Ò*¨3°Ñ6Ô6Ð6ØˆFØ�(Š?ˆ?ØÕ)Ð)Ð)Ý 1°%Ô 8‘��vØ—’ ¨&Ñ1Ô1Ð1ØÐ  U°$×2HÒ2HÑ2JÔ2JÐ%JÐ%JÝð8°ð 8ð 8Ø!×3Ò3Ñ5Ô5ð8ð 8ñô ð ð ×#Ò# EÑ*Ô*Ð*Ý‰Œ×Ò˜3 Ñ&Ô&Ð&ØÐ:Ð:Ð:Ø'+×'8Ò'8Ñ':Ô':ˆDÔ$Ð$Ð$ð ;Ð:r—   c                 ó†  — d| j         v r| j         d         S |                      ¦   «         }| j        j        }|r#t	          |¦  «                             |¦  «        }n|}t          | j        dd¦  «        }|r|j        }|                     |¦  «        }nd}|st           	                    d|||¦  «         t          |¦  «        S )zåReturn simualtor basis gates.

        This will be the option value of basis gates if it was set,
        otherwise it will be the intersection of the configuration, noise model
        and method supported basis gates.
        rq   r�   Nz�The intersection of configuration basis gates (%s), simulation method basis gates (%s), and noise model basis gates (%s) is empty)rñ   Ú_method_basis_gatesrð   rq   ÚsetÚintersectionr¢   r£   ÚloggerÚwarningÚsorted)r’   Úmethod_gatesÚconfig_gatesrq   r�   Únoise_gatess         r–   r  zQasmSimulator._basis_gatesi  så   € ð ˜DÔ7Ð7Ð7ØÔ.¨}Ô=Ð=ð ×/Ò/Ñ1Ô1ˆØÔ*Ô6ˆØð 	'Ý˜lÑ+Ô+×8Ò8¸ÑFÔFˆKˆKà&ˆKõ ˜dœl¨M¸4Ñ@Ô@ˆØð 	Ø%Ô1ˆKØ%×2Ò2°;Ñ?Ô?ˆKˆKàˆKàð 	Ý�NŠNð8ð ØØñô ð õ �kÑ"Ô"Ð"r—   c                 ó  — | j                              dd¦  «        }|dv rt          g d¢¦  «        S |dk    rt          g d¢¦  «        S |dk    rt          g d¢¦  «        S |d	k    rt          g d
¢¦  «        S t          j        S )ú1Return method basis gates and custom instructionsr›   N©ry   rz   r{   r|   )$r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r/   r1   r4   r5   r6   r7   r8   rI   rJ   rM   rN   rP   r~   )&r   r   r   r   r   r/   r+   r,   r-   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r8   rI   rS   rM   rN   r   r   r   r   r4   r5   r6   r7   r.   r9   rJ   rL   r}   )r   r    r!   r"   r#   r$   r%   r&   r'   r+   r,   r-   r*   rM   rN   rP   r   )r+   r-   r   r    r!   r"   r#   r$   r%   r&   r'   r*   Úu0r(   r)   r   r   r8   ÚcczrM   rN   )Ú_optionsÚgetr  r   rŽ   ©r’   r›   s     r–   r	  z!QasmSimulator._method_basis_gates�  sç   € à”×"Ò" 8¨TÑ2Ô2ˆØð 
ð 
ð 
õ ð%ð %ð %ñ'ô 'ð 'ðP Ð+Ò+Ð+Ýð'ð 'ð 'ñ)ô )ð )ðT �\Ò!Ð!Ýðð ð ñô ð ð( Ð*Ò*Ð*Ýðð ð ñô ð õ2 Ô1Ð1r—   c                 óZ  — d| j         v r| j         d         S | j                             dd¦  «        }|dv rt          g d¢¦  «        S |dv rt          g d¢¦  «        S |dk    rt          g d	¢¦  «        S |d
k    rt          g d¢¦  «        S |dk    rt          g d¢¦  «        S t          j        S )r  rr   r›   N©ru   rv   rw   rx   )rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r`   r  )rQ   rR   rS   rT   ÚsuperoprU   rV   rW   rX   r[   r\   rZ   r`   ra   r~   )rQ   rR   rS   rT   rU   rV   rW   rX   r\   r[   r]   rY   rZ   Úsave_matrix_product_stateÚset_matrix_product_stater}   )rQ   rR   rS   rU   rV   rW   rX   rZ   r[   r_   rb   r   )rQ   rR   rS   r]   )rñ   r  r  r  r   Ú_DEFAULT_CUSTOM_INSTRr  s     r–   rô   z"QasmSimulator._custom_instructions  s-  € ð ! DÔ$?Ð?Ð?ØÔ.Ð/DÔEÐEà”×"Ò" 8¨TÑ2Ô2ˆØð 
ð 
ð 
õ ðð ð ñô ð ð& ð 
ð 
ð 
õ ðð ð ñô ð ð$ Ð+Ò+Ð+Ýðð ð ñô ð ð& �\Ò!Ð!Ýðð ð ñô ð ð Ð*Ò*Ð*ÝÐZÐZÐZÑ[Ô[Ð[ÝÔ2Ð2r—   c                 óæ   — |dv r
d}t           }n6|dv rd}t           dz  }n%|dk    rd}d}n|d	k    rd
}d}n|dk    rd}d}nd}d}|                      d|¦  «         |                      d|¦  «         dS )z.Set non-basis gate options when setting methodr  z&A C++ statevector simulator with noiser  z)A C++ density matrix simulator with noiser   r~   z/A C++ matrix product state simulator with noiseé?   r}   z.A C++ Clifford stabilizer simulator with noisei'  r   z9A C++ Clifford+T extended stabilizer simulator with noiseNro   rh   )r   r  )r’   r›   ro   rh   s       r–   r  z QasmSimulator._set_method_config|  sÐ   € ð ð 
ð 
ð 
ð CˆKÝ-ˆHˆHØð 
ð 
ð 
ð FˆKÝ-°Ñ2ˆHˆHØÐ-Ò-Ð-ØKˆKØˆHˆHØ�|Ò#Ð#ØJˆKØˆHˆHØÐ,Ò,Ð,ØUˆKØˆHˆHð ˆKØˆHØ×&Ò& }°kÑBÔBÐBØ×&Ò& z°8Ñ<Ô<Ð<Ð<Ð<r—   )NNN)N)r¡   Ú
__module__Ú__qualname__Ú__doc__r  rŽ   r  r   r   rä   rŒ   r‰   rˆ   rŠ   rý   r‘   rŸ   ÚclassmethodrÛ   rë   r“   r   rþ   r  r  r  r	  rô   r  Ú__classcell__)r•   s   @r–   r   r   )   së  ø€ € € € € ðFð FðP "˜6ð<	
ð <	
ð <	
ñ>ô >Ðð@ #˜Fð	
ð 	
ð 	
ñô Ðð2 )Ø&Ø*Ø5ØØØØØ�S˜‘X”XØ8ØØ+Ø4Øðð Ðð"ð ð Ðð Ðà2ÐàÐð
ð 
ð 
ð 
ð 
ð 
ð>ð ð ð ð ð  ð1
ð 1
ñ „[ð1
ðf ð%ð %ñ „[ð%ðNð ð ð2ð 2ð 2ð2ð 2ð 2ðYð Yð Yð
;ð ;ð ;ð ;ð ;ð$$#ð $#ð $#ðLK2ð K2ð K2ðZ^3ð ^3ð ^3ð@!=ð !=ð !=ð !=ð !=ð !=ð !=ð !=r—   r   )r$  rï   ÚloggingÚwarningsr   Úqiskit.providers.optionsr   Úqiskit.providers.backendr   Úversionr   Úaererrorr	   Ú
aerbackendr   Úbackendconfigurationr   Úbackendpropertiesr   Úbackend_utilsr   r   r   r   r   Úcontroller_wrappersr   Ú	getLoggerr¡   r  r   rÙ   r—   r–   ú<module>r3     s]  ððð ð €€€Ø €€€Ø Ð Ð Ð Ð Ð Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø .Ð .Ð .Ð .Ð .Ð .à !Ð !Ð !Ð !Ð !Ð !Ø Ð Ð Ð Ð Ð Ø "Ð "Ð "Ð "Ð "Ð "Ø 9Ð 9Ð 9Ð 9Ð 9Ð 9Ø ;Ð ;Ð ;Ð ;Ð ;Ð ;ðð ð ð ð ð ð ð ð ð ð ð ð ð ð 8Ð 7Ð 7Ð 7Ð 7Ð 7à	ˆÔ	˜8Ñ	$Ô	$€ðt=ð t=ð t=ð t=ð t=�Jñ t=ô t=ð t=ð t=ð t=r—   