
    z	i3                        S r SSKJr  SSKrSSKJr  SSKJrJ	r	  SSK
Jr  SSKJrJrJrJr  SSKJr  \R&                  (       a  SS	KJr  \R,                  \R,                  \R,                  \R,                  S
.r    S           SS jjrg)zThe twirling module.    )annotationsN)twirl_circuit)QuantumCircuit_copy_metadata)Gate)CXGateECRGateCZGate	iSwapGate)QiskitError)Target)cxecrcziswapc                   Sn[        U[        5      (       a-  [        R                  US5      nUc  [	        SU S35      eU/nGO![        U[
        5      (       a  / n/ nU H  n[        U[        5      (       a;  [        R                  US5      nUc  [	        SU S35      eUR                  U5        MS  [        USS5      nUc  UR                  U5        Mv  U[        R                  5       ;   a  UR                  U5        M  UR                  U5        M     U(       d  SnU(       d  SnO=Ub8  [        USS5      nUc  SnU/nO$U[        R                  5       ;   a  U/nOSnU/nOUnUn	U	c  Sn	[        U R                  UUUU	U5      n
Ub?  / nU
 H5  n[        R                  " U5      n[        X5        UR                  U5        M7     U$ [        R                  " U
S   5      n[        X5        U$ )aB	  Create copies of a given circuit with Pauli twirling applied around specified two qubit
gates.

If you're running this function with the intent to twirl a circuit to run on hardware this
may not be the most efficient way to perform twirling. Especially if the hardware vendor
has implemented the :mod:`.primitives` execution interface with :class:`.SamplerV2` and
:class:`.EstimatorV2` this most likely is not the best way to apply twirling to your
circuit and you'll want to refer to the implementation of :class:`.SamplerV2` and/or
:class:`.EstimatorV2` for the specified hardware vendor.

If the intent of this function is to be run after :func:`.transpile` or
:meth:`.PassManager.run` the optional ``target`` argument can be used
so that the inserted 1 qubit Pauli gates are synthesized to be
compatible with the given :class:`.Target` so the output circuit(s) are
still compatible.

Args:
    circuit: The circuit to twirl
    twirling_gate: The gate to twirl, defaults to `None` which means twirl all default gates:
        :class:`.CXGate`, :class:`.CZGate`, :class:`.ECRGate`, and :class:`.iSwapGate`.
        If supplied it can either be a single gate or a list of gates either as either a gate
        object or its string name. Currently only the names `"cx"`, `"cz"`, `"ecr"`,  and
        `"iswap"` are supported. If a gate object is provided outside the default gates it must
        have a matrix defined from its :class:`~.Gate.to_matrix` method for the gate to potentially
        be twirled. If a valid twirling configuration can't be computed that particular gate will
        be silently ignored and not twirled.
    seed: An integer seed for the random number generator used internally by this function.
        If specified this must be between 0 and 18,446,744,073,709,551,615.
    num_twirls: The number of twirling circuits to build. This defaults to ``None`` and will return
        a single circuit. If it is an integer a list of circuits with `num_twirls` circuits
        will be returned.
    target: If specified an :class:`.Target` instance to use for running single qubit decomposition
        as part of the Pauli twirling to optimize and map the pauli gates added to the circuit
        to the specified target.

Returns:
    A copy of the given circuit with Pauli twirling applied to each
    instance of the specified twirling gate.
NzThe specified gate name z is not supported_standard_gate   r   )
isinstancestrNAME_TO_CLASSgetr   listappendgetattrvaluestwirl_rs_datar   _from_circuit_datar   )circuittwirling_gateseed
num_twirlstargetcustom_gatesgatetwirling_std_gatestd_gate
out_twirlsnew_dataout_listcircnew_circout_circs                  Q/home/james-whalen/.local/lib/python3.13/site-packages/qiskit/circuit/twirling.pypauli_twirl_2q_gatesr0   $   s   \ L-%%  5< 8GXYZZ!F	M4	(	(!D$$$$((t4<%(@O`&abb!((. '.> E ( ''-$(<(<(>>)00?$++D1 "  L  $		"=*:DA $)?L=//11%-J!$(! -)J
H D%88>H7-OOH%  !44Xa[Aw)    )NNNN)r    r   r!   z*None | str | Gate | list[str] | list[Gate]r"   
int | Noner#   r2   r$   zTarget | Nonereturnz%QuantumCircuit | list[QuantumCircuit])__doc__
__future__r   typingqiskit._accelerate.twirlingr   r   qiskit.circuit.quantumcircuitr   r   qiskit.circuit.gater   %qiskit.circuit.library.standard_gatesr   r	   r
   r   qiskit.exceptionsr   TYPE_CHECKINGqiskit.transpiler.targetr   r   r   r0    r1   r/   <module>r?      s     "  A H $ T T )	/ 

!!


%%	 AE! mm=m m 	m
 m +mr1   