
    {	iw.                         S r SSKrSSKrSSKJr  SSKJr  SSKJr  SSK	J
r
  SS	KJr  SS
KJr  SSKJrJrJrJrJrJr  SSKJr  \R0                  " \5      r " S S\5      rg)z$
Aer statevector simulator backend.
    N)warnOptions   )AerError)__version__   )
AerBackend)AerBackendConfiguration)available_devicesMAX_QUBITS_STATEVECTORLEGACY_METHOD_MAPcpp_execute_circuitsmap_legacy_method_configadd_final_save_op)aer_controller_executec                      ^  \ rS rSrSrS\\SSSSSS\" S5      SS	\" / S
Q5      \" / SQ5      / S.r	Sr
S	rSU 4S jjr\S 5       rU 4S jrS rS rS rSrU =r$ )StatevectorSimulator*   a  Ideal quantum circuit statevector simulator

**Configurable Options**

The `StatevectorSimulator` supports CPU and GPU simulation methods and
additional configurable options. 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 a single-precision simulator

.. code-block:: python

    backend = StatevectorSimulator(precision='single')

**Backend Options**

The following configurable backend options are supported

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

* ``method`` (str): [DEPRECATED] Set the simulation method supported
  methods are ``"statevector"`` for CPU simulation, and
  ``"statevector_gpu"`` for GPU simulation. This option has been
  deprecated, use the ``device`` option to set "CPU" or "GPU"
  simulation instead.

* ``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 aer 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).

* ``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 the initial statevector is 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_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).

* ``statevector_parallel_threshold`` (int): Sets the threshold that
  "n_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).

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]
statevector_simulatorz$https://github.com/Qiskit/qiskit-aerTFg    .Az#A C++ statevector circuit simulatorN):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cucpcu1cu2cu3rxxryyrzzrzxccxcczcswapmcxmcymczmcsxmcumcpmcphasemcu1mcu2mcu3mcrxmcrymcrzmcrmcswapunitarydiagonalmultiplexer
initializedelaypauli)krausroerrorquantum_channel
qerror_locsave_expvalsave_density_matrixsave_statevector
save_probssave_probs_ketsave_amplitudessave_amplitudes_sq
save_stateset_statevectorreset)backend_namebackend_versionn_qubitsurl	simulatorlocalconditional
open_pulsememory	max_shotsdescriptioncoupling_mapbasis_gatescustom_instructionsgates)CPUGPUThrustc                   > [        S[        5        [        5       U l        [        R
                  c  [        U R                  5      [        l        Uc%  [        R                  " [        R                  5      nOSUl
        [        TU ]1  XX4S9  g )Na	  The `StatevectorSimulator` backend will be deprecated in the future. It has been superseded by the `AerSimulator` backend. To obtain legacy functionality initialize with `AerSimulator(method="statevector")` and append run circuits with the `save_state` instruction.F)
propertiesproviderbackend_options)r   PendingDeprecationWarningr   _controllerr   _AVAILABLE_DEVICESr   r   	from_dict_DEFAULT_CONFIGURATIONrf   super__init__)selfconfigurationrr   rs   rt   	__class__s        c/home/james-whalen/.local/lib/python3.13/site-packages/qiskit_aer/backends/statevector_simulator.pyr{   StatevectorSimulator.__init__   s    2
 &	
 2322:6GHXHX6Y 3 3==$;;M (-M$8 	 	
    c                     [        S0 SS_SS_SS_SS _SS _S	S _S
S_SS _SS _SS _SS _SS _SS _SS_SS_SS_SS_SS_6$ )Nshotsr	   devicern   	precisiondoubleexecutormax_job_sizemax_shot_sizezero_thresholdg|=validation_thresholdmax_parallel_threadsmax_parallel_experimentsmax_parallel_shotsmax_memory_mbseed_simulatorfusion_enableTfusion_verboseFfusion_max_qubit   fusion_threshold   statevector_parallel_threshold r   )clss    r   _default_options%StatevectorSimulator._default_options  s     

 
 	

 
 
 
 !
 "&
 "&
 &*
  $
 
  
 
  !!
" #
$  %
( ,.)
 	
r   c                    > US:X  aI  [        S[        5        U[        ;   a  [        U   u  p#U R                  SU5        US:w  a  [	        S5      eg [
        TU ]  X5        g )NmethodzThe method option of the `StatevectorSimulator` has been deprecated as of qiskit-aer 0.9.0. To run a GPU statevector simulation use the option `device='GPU'` insteadr   statevectorzGonly the 'statevector' method is supported for the StatevectorSimulator)r   DeprecationWarningr   
set_optionr   rz   )r|   keyvaluer   r~   s       r   r   StatevectorSimulator.set_option$  sl    (?D #	 )) 1% 8&1%]  3&r   c                 $    [        S[        5        g)(Return the available simulation methods.zThe `available_methods` method of the StatevectorSimulator is deprecated as of qiskit-aer 0.9.0 as this simulator only supports a single method. To check if GPU simulation is available use the `available_devices` method instead.)r   )r   r   r|   s    r   available_methods&StatevectorSimulator.available_methods7  s    ; 	
  r   c                 B    [         R                   " U R                  5      $ )r   )copyrw   r   s    r   r   &StatevectorSimulator.available_devicesB  s    yy0011r   c                 ^    [        U5      n[        US5      n[        U R                  XU5      $ )z Execute circuits on the backend.r   )r   r   r   rv   )r|   aer_circuitsnoise_modelconfigs       r   _execute_circuits&StatevectorSimulator._execute_circuitsF  s.    )&1(}E#D$4$4lQWXXr   )rv   )NNN)__name__
__module____qualname____firstlineno____doc__r   r   intsortedry   _SIMULATION_DEVICESrw   r{   classmethodr   r   r   r   r   __static_attributes____classcell__)r~   s   @r   r   r   *   s    \~ 0&*5X
 =;=
|  & 
$ CbH 3
4 
 
0'&	 2Y Yr   r   )r   r   loggingwarningsr   qiskit.providers.optionsr   aererrorr   versionr   
aerbackendr
   backendconfigurationr   backend_utilsr   r   r   r   r   r   controller_wrappersr   	getLoggerr   loggerr   r   r   r   <module>r      sU       ,  ! " 9  8 
		8	$`Y: `Yr   