
    {	i|                     Z    S r SSKJr  SSKJr  SSKJr   " S S\5      rSS	 jr\\l        g
)z/
Simulator instruction to save unitary matrix.
    )QuantumCircuit   )SaveSingleData   )default_qubitsc                   0   ^  \ rS rSrSrSU 4S jjrSrU =r$ )SaveUnitary   zSave Unitaryc                 $   > [         TU ]  SXUS9  g)a  Create new instruction to save the unitary simulator state.

Args:
    num_qubits (int): the number of qubits of the
    label (str): the key for retrieving saved data from results.
    pershot (bool): if True save a list of unitaries for each
                    shot of the simulation rather than a single
                    statevector [Default: False].

.. note::

    This save instruction must always be performed on the full width of
    qubits in a circuit, otherwise an exception will be raised during
    simulation.
save_unitary)pershotN)super__init__)self
num_qubitslabelr   	__class__s       k/home/james-whalen/.local/lib/python3.13/site-packages/qiskit_aer/library/save_instructions/save_unitary.pyr   SaveUnitary.__init__   s      	GL     unitaryF)__name__
__module____qualname____firstlineno____doc__r   __static_attributes____classcell__)r   s   @r   r	   r	      s    M Mr   r	   c                 `    [        U 5      n[        [        U5      XS9nU R                  XC5      $ )a  Save the current state of the unitary simulator.

Args:
    label (str): the key for retrieving saved data from results.
    pershot (bool): if True save a list of unitaries for each
                    shot of the simulation [Default: False].

Returns:
    QuantumCircuit: with attached instruction.

.. note::

    This instruction is always defined across all qubits in a circuit.
)r   r   )r   r	   lenappend)r   r   r   qubitsinstrs        r   r   r   +   s-     D!FF5BE;;u%%r   Nr   )r   qiskit.circuitr   	save_datar   r   r	   r   r   r   r   <module>r(      s2    * % +M. M,&( + r   