
    z	i	                     ~    S r SSKrSSKJrJr  SSKJr  \R                  S:  a  SSKJ	r	  OSSK
J	r	   " S S	\\5      rg)
z&
Mixin for linear operator interface.
    N)ABCabstractmethod   )MultiplyMixin)      )Selfc                   d    \ rS rSrSrS\4S jrS\4S jrS\4S jrS\4S jr	\
SS	 j5       rS
rg)LinearMixin   av  Abstract Mixin for linear operator.

This class defines the following operator overloads:

    - ``+`` / ``__add__``
    - ``-`` / ``__sub__``
    - ``*`` / ``__rmul__`
    - ``/`` / ``__truediv__``
    - ``__neg__``

The following abstract methods must be implemented by subclasses
using this mixin

    - ``_add(self, other, qargs=None)``
    - ``_multiply(self, other)``
returnc                 ~    [        U[        U 5      5      (       d  US:X  a  U $ [        USS 5      nU R                  XS9$ Nr   qargsr   
isinstancetypegetattr_addselfotherr   s      e/home/james-whalen/.local/lib/python3.13/site-packages/qiskit/quantum_info/operators/mixins/linear.py__add__LinearMixin.__add__.   =    %d,,!Kw-yyy,,    c                 ~    [        U[        U 5      5      (       d  US:X  a  U $ [        USS 5      nU R                  XS9$ r   r   r   s      r   __radd__LinearMixin.__radd__6   r   r   c                 >    [        USS 5      nU R                  U* US9$ Nr   r   r   r   r   s      r   __sub__LinearMixin.__sub__>   s%    w-yy%uy--r   c                 <    [        USS 5      nU * R                  XS9$ r#   r$   r   s      r   __rsub__LinearMixin.__rsub__B   s#    w-||E|//r   Nc                     g)aJ  Return the CLASS self + other.

If ``qargs`` are specified the other operator will be added
assuming it is identity on all other subsystems.

Args:
    other (CLASS): an operator object.
    qargs (None or list): optional subsystems to add on
                          (Default: None)

Returns:
    CLASS: the CLASS self + other.
N r   s      r   r   LinearMixin._addF   s    r   r+   )N)__name__
__module____qualname____firstlineno____doc__r	   r   r    r%   r(   r   r   __static_attributes__r+   r   r   r   r      sK    "- -- -. .0 0  r   r   )r1   sysabcr   r   multiplyr   version_infotypingr	   typing_extensionsr   r+   r   r   <module>r9      s7     # #w&8- 8r   