
    {	i
                     Z    S r SSKJrJr  SSKJr  SSKJr   " S S\5      rS r\\l        g	)
zC
Instruction to set the state simulator state to a superop matrix.
    )QuantumCircuitInstruction)SuperOp   )default_qubitsc                   0   ^  \ rS rSrSrSrU 4S jrSrU =r$ )
SetSuperOp   z"Set superop state of the simulatorTc                    > [        U[        5      (       d  [        U5      nUR                  (       a  UR                  5       (       d  [	        S5      e[
        TU ]  SUR                  SUR                  /5        g)aa  Create new instruction to set the superop simulator state.

Args:
    state (QuantumChannel): A CPTP quantum channel.

Raises:
    ValueError: if the input QuantumChannel is not CPTP.

.. note::

    This set instruction must always be performed on the full width of
    qubits in a circuit, otherwise an exception will be raised during
    simulation.
z%The input quantum channel is not CPTPset_superopr   N)
isinstancer   
num_qubitsis_cptp
ValueErrorsuper__init__data)selfstate	__class__s     i/home/james-whalen/.local/lib/python3.13/site-packages/qiskit_aer/library/set_instructions/set_superop.pyr   SetSuperOp.__init__   sY     %))ENEu}}DEE(8(8!ejj\J     )	__name__
__module____qualname____firstlineno____doc__
_directiver   __static_attributes____classcell__)r   s   @r   r	   r	      s    ,JK Kr   r	   c                 .   [        U 5      n[        U[        5      (       d  [        U5      nUR                  (       a  UR                  [	        U5      :w  a&  [        SUR                   SU R                   S35      eU R                  [        U5      U5      $ )a|  Set the superop state of the simulator.

Args:
    state (QuantumChannel): A CPTP quantum channel.

Returns:
    QuantumCircuit: with attached instruction.

Raises:
    ValueError: If the state is the incorrect size for the current circuit.
    ValueError: if the input QuantumChannel is not CPTP.

.. note:

    This instruction is always defined across all qubits in a circuit.
zThe size of the quantum channel for the set_superop instruction must be equal to the number of qubits in the circuit (state.num_qubits (z ) != QuantumCircuit.num_qubits (z)).)r   r   r   r   lenr   appendr	   )r   r   qubitss      r   r   r   0   s    " D!FeW%%u//3v;>2272B2B1C D..2oo->cC
 	
 ;;z%(&11r   N)	r   qiskit.circuitr   r   qiskit.quantum_infor   r   r	   r   r   r   r   <module>r)      s2    7 ' +K K62< ) r   