§
    k˜ºhìr  ã                   ó†  — d Z ddlZddlZddlmZ ddlmZmZm	Z	m
Z
 ddgZ G d„ d¦  «        Z G d„ d	e¦  «        Z G d
„ de¦  «        Z G d„ de¦  «        Zdd„Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Zd„ ZdS )aU  Abstract linear algebra library.

This module defines a class hierarchy that implements a kind of "lazy"
matrix representation, called the ``LinearOperator``. It can be used to do
linear algebra with extremely large sparse or structured matrices, without
representing those explicitly in memory. Such matrices can be added,
multiplied, transposed, etc.

As a motivating example, suppose you want have a matrix where almost all of
the elements have the value one. The standard sparse matrix representation
skips the storage of zeros, but not ones. By contrast, a LinearOperator is
able to represent such matrices efficiently. First, we need a compact way to
represent an all-ones matrix::

    >>> import numpy as np
    >>> from scipy.sparse.linalg._interface import LinearOperator
    >>> class Ones(LinearOperator):
    ...     def __init__(self, shape):
    ...         super().__init__(dtype=None, shape=shape)
    ...     def _matvec(self, x):
    ...         return np.repeat(x.sum(), self.shape[0])

Instances of this class emulate ``np.ones(shape)``, but using a constant
amount of storage, independent of ``shape``. The ``_matvec`` method specifies
how this linear operator multiplies with (operates on) a vector. We can now
add this operator to a sparse matrix that stores only offsets from one::

    >>> from scipy.sparse.linalg._interface import aslinearoperator
    >>> from scipy.sparse import csr_array
    >>> offsets = csr_array([[1, 0, 2], [0, -1, 0], [0, 0, 3]])
    >>> A = aslinearoperator(offsets) + Ones(offsets.shape)
    >>> A.dot([1, 2, 3])
    array([13,  4, 15])

The result is the same as that given by its dense, explicitly-stored
counterpart::

    >>> (np.ones(A.shape, A.dtype) + offsets.toarray()).dot([1, 2, 3])
    array([13,  4, 15])

Several algorithms in the ``scipy.sparse`` library are able to operate on
``LinearOperator`` instances.
é    N)Úissparse)ÚisshapeÚ	isintlikeÚasmatrixÚis_pydata_spmatrixÚLinearOperatorÚaslinearoperatorc                   óø   ‡ — e Zd ZdZdZdZˆ fd„Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z ee¦  «        Z d„ Z! ee!¦  «        Z"d„ Z#d„ Z$ˆ xZ%S ) r   al  Common interface for performing matrix vector products

    Many iterative methods (e.g. cg, gmres) do not need to know the
    individual entries of a matrix to solve a linear system A@x=b.
    Such solvers only require the computation of matrix vector
    products, A@v where v is a dense vector.  This class serves as
    an abstract interface between iterative solvers and matrix-like
    objects.

    To construct a concrete LinearOperator, either pass appropriate
    callables to the constructor of this class, or subclass it.

    A subclass must implement either one of the methods ``_matvec``
    and ``_matmat``, and the attributes/properties ``shape`` (pair of
    integers) and ``dtype`` (may be None). It may call the ``__init__``
    on this class to have these attributes validated. Implementing
    ``_matvec`` automatically implements ``_matmat`` (using a naive
    algorithm) and vice-versa.

    Optionally, a subclass may implement ``_rmatvec`` or ``_adjoint``
    to implement the Hermitian adjoint (conjugate transpose). As with
    ``_matvec`` and ``_matmat``, implementing either ``_rmatvec`` or
    ``_adjoint`` implements the other automatically. Implementing
    ``_adjoint`` is preferable; ``_rmatvec`` is mostly there for
    backwards compatibility.

    Parameters
    ----------
    shape : tuple
        Matrix dimensions (M, N).
    matvec : callable f(v)
        Returns returns A @ v.
    rmatvec : callable f(v)
        Returns A^H @ v, where A^H is the conjugate transpose of A.
    matmat : callable f(V)
        Returns A @ V, where V is a dense matrix with dimensions (N, K).
    dtype : dtype
        Data type of the matrix.
    rmatmat : callable f(V)
        Returns A^H @ V, where V is a dense matrix with dimensions (M, K).

    Attributes
    ----------
    args : tuple
        For linear operators describing products etc. of other linear
        operators, the operands of the binary operation.
    ndim : int
        Number of dimensions (this is always 2)

    See Also
    --------
    aslinearoperator : Construct LinearOperators

    Notes
    -----
    The user-defined matvec() function must properly handle the case
    where v has shape (N,) as well as the (N,1) case.  The shape of
    the return type is handled internally by LinearOperator.

    It is highly recommended to explicitly specify the `dtype`, otherwise
    it is determined automatically at the cost of a single matvec application
    on `int8` zero vector using the promoted `dtype` of the output.
    Python `int` could be difficult to automatically cast to numpy integers
    in the definition of the `matvec` so the determination may be inaccurate.
    It is assumed that `matmat`, `rmatvec`, and `rmatmat` would result in
    the same dtype of the output given an `int8` input as `matvec`.

    LinearOperator instances can also be multiplied, added with each
    other and exponentiated, all lazily: the result of these operations
    is always a new, composite LinearOperator, that defers linear
    operations to the original operators and combines the results.

    More details regarding how to subclass a LinearOperator and several
    examples of concrete LinearOperator instances can be found in the
    external project `PyLops <https://pylops.readthedocs.io>`_.


    Examples
    --------
    >>> import numpy as np
    >>> from scipy.sparse.linalg import LinearOperator
    >>> def mv(v):
    ...     return np.array([2*v[0], 3*v[1]])
    ...
    >>> A = LinearOperator((2,2), matvec=mv)
    >>> A
    <2x2 _CustomLinearOperator with dtype=int8>
    >>> A.matvec(np.ones(2))
    array([ 2.,  3.])
    >>> A @ np.ones(2)
    array([ 2.,  3.])

    é   Nc                 óh  •— | t           u r&t          ¦   «                              t          ¦  «        S t          ¦   «                              | ¦  «        }t	          |¦  «        j        t           j        k    r>t	          |¦  «        j        t           j        k    rt          j        dt          d¬¦  «         |S )NzMLinearOperator subclass should implement at least one of _matvec and _matmat.r   )ÚcategoryÚ
stacklevel)
r   ÚsuperÚ__new__Ú_CustomLinearOperatorÚtypeÚ_matvecÚ_matmatÚwarningsÚwarnÚRuntimeWarning)ÚclsÚargsÚkwargsÚobjÚ	__class__s       €úf/var/www/html/services/rag-service/venv/lib/python3.11/site-packages/scipy/sparse/linalg/_interface.pyr   zLinearOperator.__new__š   s—   ø€ Ø•.Ð Ð å‘7”7—?’?Õ#8Ñ9Ô9Ð9å‘'”'—/’/ #Ñ&Ô&ˆCå�S‘	”	Ô!¥^Ô%;Ò;Ð;Ý˜S™	œ	Ô)­^Ô-CÒCÐCÝ”ð Få'5À!ðEñ Eô Eð Eð ˆJó    c                 ó°   — |�t          j        |¦  «        }t          |¦  «        }t          |¦  «        st	          d|›d�¦  «        ‚|| _        || _        dS )z¡Initialize this LinearOperator.

        To be called by subclasses. ``dtype`` may be None; ``shape`` should
        be convertible to a length-2 tuple.
        Nzinvalid shape z (must be 2-d))ÚnpÚdtypeÚtupler   Ú
ValueErrorÚshape)Úselfr!   r$   s      r   Ú__init__zLinearOperator.__init__©   s]   € ð ÐÝ”H˜U‘O”OˆEå�e‘”ˆÝ�u‰~Œ~ð 	GÝÐE¨eÐEÐEÐEÑFÔFÐFàˆŒ
ØˆŒ
ˆ
ˆ
r   c                 ó4  — | j         €�t          j        | j        d         t          j        ¬¦  «        }	 t          j        |                      |¦  «        ¦  «        }|j         | _         dS # t          $ r" t          j         t          ¦  «        | _         Y dS w xY wdS )aø  Determine the dtype by executing `matvec` on an `int8` test vector.

        In `np.promote_types` hierarchy, the type `int8` is the smallest,
        so we call `matvec` on `int8` and use the promoted dtype of the output
        to set the default `dtype` of the `LinearOperator`.
        We assume that `matmat`, `rmatvec`, and `rmatmat` would result in
        the same dtype of the output given an `int8` input as `matvec`.

        Called from subclasses at the end of the __init__ routine.
        Néÿÿÿÿ)r!   )	r!   r    Úzerosr$   Úint8ÚasarrayÚmatvecÚOverflowErrorÚint)r%   ÚvÚmatvec_vs      r   Ú_init_dtypezLinearOperator._init_dtype¹   s�   € ð Œ:ÐÝ”˜œ Bœ­r¬wÐ7Ñ7Ô7ˆAð,Ýœ: d§k¢k°!¡n¤nÑ5Ô5�ð
 &œ^�”
�
�
øõ	 !ð +ð +ð +åœX¥c™]œ]�”
�
�
�
ð+øøøð	 Ðs   ´'A) Á)(BÂBc                 óN   ‡ — t          j        ˆ fd„|j        D ¦   «         ¦  «        S )zÌDefault matrix-matrix multiplication handler.

        Falls back on the user-defined _matvec method, so defining that will
        define matrix multiplication (though in a very suboptimal way).
        c                 ób   •— g | ]+}‰                      |                     d d¦  «        ¦  «        ‘Œ,S ©r(   é   )r,   Úreshape©Ú.0Úcolr%   s     €r   ú
<listcomp>z*LinearOperator._matmat.<locals>.<listcomp>Õ   s3   ø€ ÐHÐHÐH¸S˜$Ÿ+š+ c§k¢k°"°QÑ&7Ô&7Ñ8Ô8ÐHÐHÐHr   )r    ÚhstackÚT©r%   ÚXs   ` r   r   zLinearOperator._matmatÎ   s,   ø€ õ ŒyÐHÐHÐHÐHÀAÄCÐHÑHÔHÑIÔIÐIr   c                 óT   — |                       |                     dd¦  «        ¦  «        S )ay  Default matrix-vector multiplication handler.

        If self is a linear operator of shape (M, N), then this method will
        be called on a shape (N,) or (N, 1) ndarray, and should return a
        shape (M,) or (M, 1) ndarray.

        This default implementation falls back on _matmat, so defining that
        will define matrix-vector multiplication as well.
        r(   r5   )Úmatmatr6   ©r%   Úxs     r   r   zLinearOperator._matvec×   s$   € ð �{Š{˜1Ÿ9š9 R¨Ñ+Ô+Ñ,Ô,Ð,r   c                 óÜ  — t          j        |¦  «        }| j        \  }}|j        |fk    r|j        |dfk    rt          d¦  «        ‚|                      |¦  «        }t          |t           j        ¦  «        rt          |¦  «        }nt          j        |¦  «        }|j	        dk    r| 
                    |¦  «        }n1|j	        dk    r| 
                    |d¦  «        }nt          d¦  «        ‚|S )ax  Matrix-vector multiplication.

        Performs the operation y=A@x where A is an MxN linear
        operator and x is a column vector or 1-d array.

        Parameters
        ----------
        x : {matrix, ndarray}
            An array with shape (N,) or (N,1).

        Returns
        -------
        y : {matrix, ndarray}
            A matrix or ndarray with shape (M,) or (M,1) depending
            on the type and shape of the x argument.

        Notes
        -----
        This matvec wraps the user-specified matvec routine or overridden
        _matvec method to ensure that y has the correct shape and type.

        r5   údimension mismatchr   z/invalid shape returned by user-defined matvec())r    Ú
asanyarrayr$   r#   r   Ú
isinstanceÚmatrixr   r+   Úndimr6   ©r%   rB   ÚMÚNÚys        r   r,   zLinearOperator.matvecã   sÕ   € õ0 ŒM˜!ÑÔˆàŒj‰ˆˆ!àŒ7�q�dŠ?ˆ?˜qœw¨1¨Q¨%Ò/Ð/ÝÐ1Ñ2Ô2Ð2à�LŠL˜‰OŒOˆå�a�œÑ#Ô#ð 	Ý˜‘”ˆAˆAå”
˜1‘”ˆAàŒ6�QŠ;ˆ;Ø—	’	˜!‘”ˆAˆAØŒV�qŠ[ˆ[Ø—	’	˜!˜A‘”ˆAˆAåÐNÑOÔOÐOàˆr   c                 óÜ  — t          j        |¦  «        }| j        \  }}|j        |fk    r|j        |dfk    rt          d¦  «        ‚|                      |¦  «        }t          |t           j        ¦  «        rt          |¦  «        }nt          j        |¦  «        }|j	        dk    r| 
                    |¦  «        }n1|j	        dk    r| 
                    |d¦  «        }nt          d¦  «        ‚|S )a‰  Adjoint matrix-vector multiplication.

        Performs the operation y = A^H @ x where A is an MxN linear
        operator and x is a column vector or 1-d array.

        Parameters
        ----------
        x : {matrix, ndarray}
            An array with shape (M,) or (M,1).

        Returns
        -------
        y : {matrix, ndarray}
            A matrix or ndarray with shape (N,) or (N,1) depending
            on the type and shape of the x argument.

        Notes
        -----
        This rmatvec wraps the user-specified rmatvec routine or overridden
        _rmatvec method to ensure that y has the correct shape and type.

        r5   rD   r   z0invalid shape returned by user-defined rmatvec())r    rE   r$   r#   Ú_rmatvecrF   rG   r   r+   rH   r6   rI   s        r   ÚrmatveczLinearOperator.rmatvec  s×   € õ0 ŒM˜!ÑÔˆàŒj‰ˆˆ!àŒ7�q�dŠ?ˆ?˜qœw¨1¨Q¨%Ò/Ð/ÝÐ1Ñ2Ô2Ð2à�MŠM˜!ÑÔˆå�a�œÑ#Ô#ð 	Ý˜‘”ˆAˆAå”
˜1‘”ˆAàŒ6�QŠ;ˆ;Ø—	’	˜!‘”ˆAˆAØŒV�qŠ[ˆ[Ø—	’	˜!˜A‘”ˆAˆAåÐOÑPÔPÐPàˆr   c                 ód  — t          | ¦  «        j        t          j        k    rut          | d¦  «        r^t          | ¦  «        j        t          j        k    r<|                      |                     dd¦  «        ¦  «                             d¦  «        S t          ‚| j                             |¦  «        S )z6Default implementation of _rmatvec; defers to adjoint.Ú_rmatmatr(   r5   )	r   Ú_adjointr   ÚhasattrrQ   r6   ÚNotImplementedErrorÚHr,   rA   s     r   rN   zLinearOperator._rmatvecA  s‹   € å�‰:Œ:Ô¥.Ô"9Ò9Ð9å˜˜jÑ)Ô)ð CÝ˜T™
œ
Ô+­~Ô/FÒFÐFà—}’} Q§Y¢Y¨r°1Ñ%5Ô%5Ñ6Ô6×>Ò>¸rÑBÔBÐBÝ%Ð%à”6—=’= Ñ#Ô#Ð#r   c                 ó(  — t          |¦  «        s#t          |¦  «        st          j        |¦  «        }|j        dk    rt          d|j        › d�¦  «        ‚|j        d         | j        d         k    rt          d| j        › d|j        › �¦  «        ‚	 |                      |¦  «        }nA# t          $ r4}t          |¦  «        st          |¦  «        rt          d¦  «        |‚‚ d	}~ww xY wt          |t          j        ¦  «        rt          |¦  «        }|S )
aP  Matrix-matrix multiplication.

        Performs the operation y=A@X where A is an MxN linear
        operator and X dense N*K matrix or ndarray.

        Parameters
        ----------
        X : {matrix, ndarray}
            An array with shape (N,K).

        Returns
        -------
        Y : {matrix, ndarray}
            A matrix or ndarray with shape (M,K) depending on
            the type of the X argument.

        Notes
        -----
        This matmat wraps any user-specified matmat routine or overridden
        _matmat method to ensure that y has the correct type.

        r   z$expected 2-d ndarray or matrix, not z-dr   r5   údimension mismatch: ú, zdUnable to multiply a LinearOperator with a sparse matrix. Wrap the matrix in aslinearoperator first.N)r   r   r    rE   rH   r#   r$   r   Ú	ExceptionÚ	TypeErrorrF   rG   r   ©r%   r>   ÚYÚes       r   r@   zLinearOperator.matmatM  s-  € õ. ˜‘”ð 	!Õ1°!Ñ4Ô4ð 	!Ý”˜aÑ Ô ˆAàŒ6�QŠ;ˆ;ÝÐNÀAÄFÐNÐNÐNÑOÔOÐOàŒ7�1Œ:˜œ AœÒ&Ð&ÝÐK°D´JÐKÐKÀ!Ä'ÐKÐKÑLÔLÐLð	Ø—’˜Q‘”ˆAˆAøÝð 	ð 	ð 	Ý˜‰{Œ{ð Õ0°Ñ3Ô3ð ÝðBñô ð ðð øøøøð	øøøõ �a�œÑ#Ô#ð 	Ý˜‘”ˆAàˆs   ÂB( Â(
C&Â2/C!Ã!C&c                 ó&  — t          |¦  «        s#t          |¦  «        st          j        |¦  «        }|j        dk    rt          d|j        z  ¦  «        ‚|j        d         | j        d         k    rt          d| j        › d|j        › �¦  «        ‚	 |                      |¦  «        }nA# t          $ r4}t          |¦  «        st          |¦  «        rt          d¦  «        |‚‚ d}~ww xY wt          |t          j        ¦  «        rt          |¦  «        }|S )a;  Adjoint matrix-matrix multiplication.

        Performs the operation y = A^H @ x where A is an MxN linear
        operator and x is a column vector or 1-d array, or 2-d array.
        The default implementation defers to the adjoint.

        Parameters
        ----------
        X : {matrix, ndarray}
            A matrix or 2D array.

        Returns
        -------
        Y : {matrix, ndarray}
            A matrix or 2D array depending on the type of the input.

        Notes
        -----
        This rmatmat wraps the user-specified rmatmat routine.

        r   z(expected 2-d ndarray or matrix, not %d-dr   rW   rX   zfUnable to multiply a LinearOperator with a sparse matrix. Wrap the matrix in aslinearoperator() first.N)r   r   r    rE   rH   r#   r$   rQ   rY   rZ   rF   rG   r   r[   s       r   ÚrmatmatzLinearOperator.rmatmat|  s4  € õ, ˜‘”ð 	!Õ1°!Ñ4Ô4ð 	!Ý”˜aÑ Ô ˆAàŒ6�QŠ;ˆ;ÝÐGØ œvñ&ñ 'ô 'ð 'ð Œ7�1Œ:˜œ AœÒ&Ð&ÝÐK°D´JÐKÐKÀ!Ä'ÐKÐKÑLÔLÐLð	Ø—’˜aÑ Ô ˆAˆAøÝð 	ð 	ð 	Ý˜‰{Œ{ð Õ0°Ñ3Ô3ð ÝðDñô ð ðð øøøøð	øøøõ �a�œÑ#Ô#ð 	Ý˜‘”ˆAØˆs   ÂB' Â'
C%Â1/C Ã C%c                 óÆ   ‡ — t          ‰ ¦  «        j        t          j        k    r%t          j        ˆ fd„|j        D ¦   «         ¦  «        S ‰ j                             |¦  «        S )z@Default implementation of _rmatmat defers to rmatvec or adjoint.c                 ób   •— g | ]+}‰                      |                     d d¦  «        ¦  «        ‘Œ,S r4   )rO   r6   r7   s     €r   r:   z+LinearOperator._rmatmat.<locals>.<listcomp>­  s3   ø€ ÐNÐNÐNÀ3˜dŸlšl¨3¯;ª;°r¸1Ñ+=Ô+=Ñ>Ô>ÐNÐNÐNr   )r   rR   r   r    r;   r<   rU   r@   r=   s   ` r   rQ   zLinearOperator._rmatmatª  sU   ø€ å�‰:Œ:Ô¥.Ô"9Ò9Ð9Ý”9ÐNÐNÐNÐNÈ!Ì#ÐNÑNÔNÑOÔOÐOà”6—=’= Ñ#Ô#Ð#r   c                 ó   — | |z  S ©N© rA   s     r   Ú__call__zLinearOperator.__call__±  s   € Ø�A‰vˆr   c                 ó,   — |                       |¦  «        S rc   )ÚdotrA   s     r   Ú__mul__zLinearOperator.__mul__´  s   € Ø�xŠx˜‰{Œ{Ðr   c                 ón   — t          j        |¦  «        st          d¦  «        ‚t          | d|z  ¦  «        S )Nz.Can only divide a linear operator by a scalar.g      ð?)r    Úisscalarr#   Ú_ScaledLinearOperator©r%   Úothers     r   Ú__truediv__zLinearOperator.__truediv__·  s8   € ÝŒ{˜5Ñ!Ô!ð 	OÝÐMÑNÔNÐNå$ T¨3¨u©9Ñ5Ô5Ð5r   c                 óÔ  — t          |t          ¦  «        rt          | |¦  «        S t          j        |¦  «        rt          | |¦  «        S t          |¦  «        s#t          |¦  «        st          j        |¦  «        }|j	        dk    s|j	        dk    r&|j
        d         dk    r|                      |¦  «        S |j	        dk    r|                      |¦  «        S t          d|›�¦  «        ‚)ar  Matrix-matrix or matrix-vector multiplication.

        Parameters
        ----------
        x : array_like
            1-d or 2-d array, representing a vector or matrix.

        Returns
        -------
        Ax : array
            1-d or 2-d array (depending on the shape of x) that represents
            the result of applying this linear operator on x.

        r5   r   ú)expected 1-d or 2-d array or matrix, got )rF   r   Ú_ProductLinearOperatorr    rj   rk   r   r   r+   rH   r$   r,   r@   r#   rA   s     r   rg   zLinearOperator.dot½  sØ   € õ �a�Ñ(Ô(ð 	TÝ)¨$°Ñ2Ô2Ð2ÝŒ[˜‰^Œ^ð 	TÝ(¨¨qÑ1Ô1Ð1å˜A‘;”;ð "Õ'9¸!Ñ'<Ô'<ð "å”J˜q‘M”M�àŒv˜Š{ˆ{˜aœf¨šk˜k¨a¬g°a¬j¸Aªo¨oØ—{’{ 1‘~”~Ð%Ø”˜1’�Ø—{’{ 1‘~”~Ð%å Ð!RÈQÐ!RÐ!RÑSÔSÐSr   c                 ór   — t          j        |¦  «        rt          d¦  «        ‚|                      |¦  «        S ©Nz0Scalar operands are not allowed, use '*' instead)r    rj   r#   rh   rl   s     r   Ú
__matmul__zLinearOperator.__matmul__Ü  s=   € ÝŒ;�uÑÔð 	0Ýð /ñ 0ô 0ð 0à�|Š|˜EÑ"Ô"Ð"r   c                 ór   — t          j        |¦  «        rt          d¦  «        ‚|                      |¦  «        S rs   )r    rj   r#   Ú__rmul__rl   s     r   Ú__rmatmul__zLinearOperator.__rmatmul__â  s=   € ÝŒ;�uÑÔð 	0Ýð /ñ 0ô 0ð 0à�}Š}˜UÑ#Ô#Ð#r   c                 ót   — t          j        |¦  «        rt          | |¦  «        S |                      |¦  «        S rc   )r    rj   rk   Ú_rdotrA   s     r   rv   zLinearOperator.__rmul__è  s2   € ÝŒ;�q‰>Œ>ð 	!Ý(¨¨qÑ1Ô1Ð1à—:’:˜a‘=”=Ð r   c                 ó  — t          |t          ¦  «        rt          || ¦  «        S t          j        |¦  «        rt          | |¦  «        S t          |¦  «        s#t          |¦  «        st          j        |¦  «        }|j	        dk    s|j	        dk    r5|j
        d         dk    r$| j                             |j        ¦  «        j        S |j	        dk    r$| j                             |j        ¦  «        j        S t          d|›�¦  «        ‚)aï  Matrix-matrix or matrix-vector multiplication from the right.

        Parameters
        ----------
        x : array_like
            1-d or 2-d array, representing a vector or matrix.

        Returns
        -------
        xA : array
            1-d or 2-d array (depending on the shape of x) that represents
            the result of applying this linear operator on x from the right.

        Notes
        -----
        This is copied from dot to implement right multiplication.
        r5   r   r   rp   )rF   r   rq   r    rj   rk   r   r   r+   rH   r$   r<   r,   r@   r#   rA   s     r   ry   zLinearOperator._rdotî  sì   € õ$ �a�Ñ(Ô(ð 	TÝ)¨!¨TÑ2Ô2Ð2ÝŒ[˜‰^Œ^ð 	TÝ(¨¨qÑ1Ô1Ð1å˜A‘;”;ð "Õ'9¸!Ñ'<Ô'<ð "å”J˜q‘M”M�ð Œv˜Š{ˆ{˜aœf¨šk˜k¨a¬g°a¬j¸Aªo¨oØ”v—}’} Q¤SÑ)Ô)Ô+Ð+Ø”˜1’�Ø”v—}’} Q¤SÑ)Ô)Ô+Ð+å Ð!RÈQÐ!RÐ!RÑSÔSÐSr   c                 óX   — t          j        |¦  «        rt          | |¦  «        S t          S rc   )r    rj   Ú_PowerLinearOperatorÚNotImplemented)r%   Úps     r   Ú__pow__zLinearOperator.__pow__  s(   € ÝŒ;�q‰>Œ>ð 	"Ý'¨¨aÑ0Ô0Ð0å!Ð!r   c                 óZ   — t          |t          ¦  «        rt          | |¦  «        S t          S rc   )rF   r   Ú_SumLinearOperatorr}   rA   s     r   Ú__add__zLinearOperator.__add__  s*   € Ý�a�Ñ(Ô(ð 	"Ý% d¨AÑ.Ô.Ð.å!Ð!r   c                 ó"   — t          | d¦  «        S )Nr(   )rk   ©r%   s    r   Ú__neg__zLinearOperator.__neg__  s   € Ý$ T¨2Ñ.Ô.Ð.r   c                 ó.   — |                       | ¦  «        S rc   )r‚   rA   s     r   Ú__sub__zLinearOperator.__sub__!  s   € Ø�|Š|˜Q˜BÑÔÐr   c                 ó~   — | j         \  }}| j        €d}ndt          | j        ¦  «        z   }d||| j        j        |fz  S )Nzunspecified dtypezdtype=z<%dx%d %s with %s>)r$   r!   Ústrr   Ú__name__)r%   rJ   rK   Údts       r   Ú__repr__zLinearOperator.__repr__$  sG   € ØŒj‰ˆˆ!ØŒ:ÐØ$ˆBˆBà�C ¤
™OœOÑ+ˆBà# q¨!¨T¬^Ô-DÀbÐ&IÑIÐIr   c                 ó*   — |                       ¦   «         S )aƒ  Hermitian adjoint.

        Returns the Hermitian adjoint of self, aka the Hermitian
        conjugate or Hermitian transpose. For a complex matrix, the
        Hermitian adjoint is equal to the conjugate transpose.

        Can be abbreviated self.H instead of self.adjoint().

        Returns
        -------
        A_H : LinearOperator
            Hermitian adjoint of self.
        )rR   r„   s    r   ÚadjointzLinearOperator.adjoint-  s   € ð �}Š}‰ŒÐr   c                 ó*   — |                       ¦   «         S )z´Transpose this linear operator.

        Returns a LinearOperator that represents the transpose of this one.
        Can be abbreviated self.T instead of self.transpose().
        )Ú
_transposer„   s    r   Ú	transposezLinearOperator.transpose?  s   € ð �ŠÑ Ô Ð r   c                 ó    — t          | ¦  «        S )z6Default implementation of _adjoint; defers to rmatvec.)Ú_AdjointLinearOperatorr„   s    r   rR   zLinearOperator._adjointI  s   € å% dÑ+Ô+Ð+r   c                 ó    — t          | ¦  «        S )z? Default implementation of _transpose; defers to rmatvec + conj)Ú_TransposedLinearOperatorr„   s    r   r�   zLinearOperator._transposeM  s   € å(¨Ñ.Ô.Ð.r   )&rŠ   Ú
__module__Ú__qualname__Ú__doc__rH   Ú__array_ufunc__r   r&   r1   r   r   r,   rO   rN   r@   r_   rQ   re   rh   rn   rg   rt   rw   rv   ry   r   r‚   r…   r‡   rŒ   rŽ   ÚpropertyrU   r‘   r<   rR   r�   Ú__classcell__©r   s   @r   r   r   7   s  ø€ € € € € ð\ð \ð| €Dà€Oðð ð ð ð ðð ð ð ,ð ,ð ,ð*Jð Jð Jð
-ð 
-ð 
-ð-ð -ð -ð^-ð -ð -ð^
$ð 
$ð 
$ð-ð -ð -ð^,ð ,ð ,ð\$ð $ð $ðð ð ðð ð ð6ð 6ð 6ðTð Tð Tð>#ð #ð #ð$ð $ð $ð!ð !ð !ð"Tð "Tð "TðH"ð "ð "ð"ð "ð "ð/ð /ð /ð ð  ð  ðJð Jð Jðð ð ð  	ˆ�ÑÔ€Að!ð !ð !ð 	ˆ�ÑÔ€Að,ð ,ð ,ð/ð /ð /ð /ð /ð /ð /r   c                   óN   ‡ — e Zd ZdZ	 	 d	ˆ fd„	Zˆ fd„Zd„ Zd„ Zˆ fd„Zd„ Z	ˆ xZ
S )
r   z>Linear operator defined in terms of user-specified operations.Nc                 óº   •— t          ¦   «                              ||¦  «         d| _        || _        || _        || _        || _        |                      ¦   «          d S )Nrd   )r   r&   r   Ú"_CustomLinearOperator__matvec_implÚ#_CustomLinearOperator__rmatvec_implÚ#_CustomLinearOperator__rmatmat_implÚ"_CustomLinearOperator__matmat_implr1   )r%   r$   r,   rO   r@   r!   r_   r   s          €r   r&   z_CustomLinearOperator.__init__U  s\   ø€ å‰Œ×Ò˜ Ñ&Ô&Ð&àˆŒ	à#ˆÔØ%ˆÔØ%ˆÔØ#ˆÔà×ÒÑÔÐÐÐr   c                 ó~   •— | j         �|                       |¦  «        S t          ¦   «                              |¦  «        S rc   )r¢   r   r   ©r%   r>   r   s     €r   r   z_CustomLinearOperator._matmatb  s6   ø€ ØÔÐ)Ø×%Ò% aÑ(Ô(Ð(å‘7”7—?’? 1Ñ%Ô%Ð%r   c                 ó,   — |                       |¦  «        S rc   )rŸ   rA   s     r   r   z_CustomLinearOperator._matvech  s   € Ø×!Ò! !Ñ$Ô$Ð$r   c                 ó\   — | j         }|€t          d¦  «        ‚|                       |¦  «        S )Nzrmatvec is not defined)r    rT   )r%   rB   Úfuncs      r   rN   z_CustomLinearOperator._rmatveck  s2   € ØÔ"ˆØˆ<Ý%Ð&>Ñ?Ô?Ð?Ø×"Ò" 1Ñ%Ô%Ð%r   c                 ó~   •— | j         �|                       |¦  «        S t          ¦   «                              |¦  «        S rc   )r¡   r   rQ   r¤   s     €r   rQ   z_CustomLinearOperator._rmatmatq  s8   ø€ ØÔÐ*Ø×&Ò& qÑ)Ô)Ð)å‘7”7×#Ò# AÑ&Ô&Ð&r   c                 óŽ   — t          | j        d         | j        d         f| j        | j        | j        | j        | j        ¬¦  «        S )Nr5   r   )r$   r,   rO   r@   r_   r!   )r   r$   r    rŸ   r¡   r¢   r!   r„   s    r   rR   z_CustomLinearOperator._adjointw  sI   € Ý$¨D¬J°q¬M¸4¼:Àa¼=Ð+IØ,0Ô,?Ø-1Ô-?Ø,0Ô,?Ø-1Ô-?Ø+/¬:ð7ñ 7ô 7ð 	7r   )NNNN)rŠ   r–   r—   r˜   r&   r   r   rN   rQ   rR   r›   rœ   s   @r   r   r   R  s¨   ø€ € € € € ØHÐHà;?Ø%)ðð ð ð ð ð ð&ð &ð &ð &ð &ð%ð %ð %ð&ð &ð &ð'ð 'ð 'ð 'ð 'ð7ð 7ð 7ð 7ð 7ð 7ð 7r   r   c                   ó:   ‡ — e Zd ZdZˆ fd„Zd„ Zd„ Zd„ Zd„ Zˆ xZ	S )r“   z$Adjoint of arbitrary Linear Operatorc                 óª   •— |j         d         |j         d         f}t          ¦   «                              |j        |¬¦  «         || _        |f| _        d S ©Nr5   r   )r!   r$   ©r$   r   r&   r!   ÚAr   ©r%   r®   r$   r   s      €r   r&   z_AdjointLinearOperator.__init__ƒ  óL   ø€ Ø”˜”˜QœW QœZÐ(ˆÝ‰Œ×Ò˜qœw¨eÐÑ4Ô4Ð4ØˆŒØ�DˆŒ	ˆ	ˆ	r   c                 ó6   — | j                              |¦  «        S rc   )r®   rN   rA   s     r   r   z_AdjointLinearOperator._matvec‰  ó   € ØŒv�Š˜qÑ!Ô!Ð!r   c                 ó6   — | j                              |¦  «        S rc   )r®   r   rA   s     r   rN   z_AdjointLinearOperator._rmatvecŒ  ó   € ØŒv�~Š~˜aÑ Ô Ð r   c                 ó6   — | j                              |¦  «        S rc   )r®   rQ   rA   s     r   r   z_AdjointLinearOperator._matmat�  r²   r   c                 ó6   — | j                              |¦  «        S rc   )r®   r   rA   s     r   rQ   z_AdjointLinearOperator._rmatmat’  r´   r   ©
rŠ   r–   r—   r˜   r&   r   rN   r   rQ   r›   rœ   s   @r   r“   r“   €  sz   ø€ € € € € Ø.Ð.ðð ð ð ð ð"ð "ð "ð!ð !ð !ð"ð "ð "ð!ð !ð !ð !ð !ð !ð !r   r“   c                   ó:   ‡ — e Zd ZdZˆ fd„Zd„ Zd„ Zd„ Zd„ Zˆ xZ	S )r•   z*Transposition of arbitrary Linear Operatorc                 óª   •— |j         d         |j         d         f}t          ¦   «                              |j        |¬¦  «         || _        |f| _        d S r¬   r­   r¯   s      €r   r&   z"_TransposedLinearOperator.__init__˜  r°   r   c                 ó~   — t          j        | j                             t          j        |¦  «        ¦  «        ¦  «        S rc   )r    Úconjr®   rN   rA   s     r   r   z!_TransposedLinearOperator._matvecž  ó(   € åŒw�t”v—’¥r¤w¨q¡z¤zÑ2Ô2Ñ3Ô3Ð3r   c                 ó~   — t          j        | j                             t          j        |¦  «        ¦  «        ¦  «        S rc   )r    r»   r®   r   rA   s     r   rN   z"_TransposedLinearOperator._rmatvec¢  ó(   € ÝŒw�t”v—~’~¥b¤g¨a¡j¤jÑ1Ô1Ñ2Ô2Ð2r   c                 ó~   — t          j        | j                             t          j        |¦  «        ¦  «        ¦  «        S rc   )r    r»   r®   rQ   rA   s     r   r   z!_TransposedLinearOperator._matmat¥  r¼   r   c                 ó~   — t          j        | j                             t          j        |¦  «        ¦  «        ¦  «        S rc   )r    r»   r®   r   rA   s     r   rQ   z"_TransposedLinearOperator._rmatmat©  r¾   r   r·   rœ   s   @r   r•   r•   •  sz   ø€ € € € € Ø4Ð4ðð ð ð ð ð4ð 4ð 4ð3ð 3ð 3ð4ð 4ð 4ð3ð 3ð 3ð 3ð 3ð 3ð 3r   r•   c                 óˆ   — |€g }| D ].}|�*t          |d¦  «        r|                     |j        ¦  «         Œ/t          j        |Ž S )Nr!   )rS   Úappendr!   r    Úresult_type)Ú	operatorsÚdtypesr   s      r   Ú
_get_dtyperÆ   ¬  sP   € Ø€~ØˆØð %ð %ˆØˆ?�w s¨GÑ4Ô4ˆ?Ø�MŠM˜#œ)Ñ$Ô$Ð$øÝŒ>˜6Ð"Ð"r   c                   ó<   ‡ — e Zd Zˆ fd„Zd„ Zd„ Zd„ Zd„ Zd„ Zˆ xZ	S )r�   c                 óD  •— t          |t          ¦  «        rt          |t          ¦  «        st          d¦  «        ‚|j        |j        k    rt          d|› d|› d�¦  «        ‚||f| _        t          ¦   «                              t          ||g¦  «        |j        ¦  «         d S )Nú)both operands have to be a LinearOperatorzcannot add ú and ú: shape mismatch)rF   r   r#   r$   r   r   r&   rÆ   ©r%   r®   ÚBr   s      €r   r&   z_SumLinearOperator.__init__¶  s¢   ø€ Ý˜!�^Ñ,Ô,ð 	JÝ˜q¥.Ñ1Ô1ð	JåÐHÑIÔIÐIØŒ7�a”gÒÐÝÐF¨1ÐFÐF°1ÐFÐFÐFÑGÔGÐGØ˜�FˆŒ	Ý‰Œ×Ò� Q¨ FÑ+Ô+¨Q¬WÑ5Ô5Ð5Ð5Ð5r   c                 ó„   — | j         d                              |¦  «        | j         d                              |¦  «        z   S ©Nr   r5   ©r   r,   rA   s     r   r   z_SumLinearOperator._matvec¿  ó5   € ØŒy˜Œ|×"Ò" 1Ñ%Ô%¨¬	°!¬×(;Ò(;¸AÑ(>Ô(>Ñ>Ð>r   c                 ó„   — | j         d                              |¦  «        | j         d                              |¦  «        z   S rÏ   ©r   rO   rA   s     r   rN   z_SumLinearOperator._rmatvecÂ  ó5   € ØŒy˜Œ|×#Ò# AÑ&Ô&¨¬°1¬×)=Ò)=¸aÑ)@Ô)@Ñ@Ð@r   c                 ó„   — | j         d                              |¦  «        | j         d                              |¦  «        z   S rÏ   ©r   r_   rA   s     r   rQ   z_SumLinearOperator._rmatmatÅ  rÔ   r   c                 ó„   — | j         d                              |¦  «        | j         d                              |¦  «        z   S rÏ   ©r   r@   rA   s     r   r   z_SumLinearOperator._matmatÈ  rÑ   r   c                 ó4   — | j         \  }}|j        |j        z   S rc   ©r   rU   ©r%   r®   rÍ   s      r   rR   z_SumLinearOperator._adjointË  ó   € ØŒy‰ˆˆ1ØŒs�Q”S‰yÐr   ©
rŠ   r–   r—   r&   r   rN   rQ   r   rR   r›   rœ   s   @r   r�   r�   µ  s‰   ø€ € € € € ð6ð 6ð 6ð 6ð 6ð?ð ?ð ?ðAð Að AðAð Að Að?ð ?ð ?ðð ð ð ð ð ð r   r�   c                   ó<   ‡ — e Zd Zˆ fd„Zd„ Zd„ Zd„ Zd„ Zd„ Zˆ xZ	S )rq   c                 ó‚  •— t          |t          ¦  «        rt          |t          ¦  «        st          d¦  «        ‚|j        d         |j        d         k    rt          d|› d|› d�¦  «        ‚t	          ¦   «                              t          ||g¦  «        |j        d         |j        d         f¦  «         ||f| _        d S )NrÉ   r5   r   zcannot multiply rÊ   rË   )rF   r   r#   r$   r   r&   rÆ   r   rÌ   s      €r   r&   z_ProductLinearOperator.__init__Ñ  sÁ   ø€ Ý˜!�^Ñ,Ô,ð 	JÝ˜q¥.Ñ1Ô1ð	JåÐHÑIÔIÐIØŒ7�1Œ:˜œ œÒ#Ð#ÝÐK°ÐKÐK¸ÐKÐKÐKÑLÔLÐLÝ‰Œ×Ò� Q¨ FÑ+Ô+Ø67´g¸a´jÀ!Ä'È!Ä*Ð5Mñ	Oô 	Oð 	Oà˜�FˆŒ	ˆ	ˆ	r   c                 ó~   — | j         d                              | j         d                              |¦  «        ¦  «        S rÏ   rÐ   rA   s     r   r   z_ProductLinearOperator._matvecÛ  ó0   € ØŒy˜Œ|×"Ò" 4¤9¨Q¤<×#6Ò#6°qÑ#9Ô#9Ñ:Ô:Ð:r   c                 ó~   — | j         d                              | j         d                              |¦  «        ¦  «        S ©Nr5   r   rÓ   rA   s     r   rN   z_ProductLinearOperator._rmatvecÞ  ó0   € ØŒy˜Œ|×#Ò# D¤I¨a¤L×$8Ò$8¸Ñ$;Ô$;Ñ<Ô<Ð<r   c                 ó~   — | j         d                              | j         d                              |¦  «        ¦  «        S rã   rÖ   rA   s     r   rQ   z_ProductLinearOperator._rmatmatá  rä   r   c                 ó~   — | j         d                              | j         d                              |¦  «        ¦  «        S rÏ   rØ   rA   s     r   r   z_ProductLinearOperator._matmatä  rá   r   c                 ó4   — | j         \  }}|j        |j        z  S rc   rÚ   rÛ   s      r   rR   z_ProductLinearOperator._adjointç  rÜ   r   rÝ   rœ   s   @r   rq   rq   Ð  sƒ   ø€ € € € € ðð ð ð ð ð;ð ;ð ;ð=ð =ð =ð=ð =ð =ð;ð ;ð ;ðð ð ð ð ð ð r   rq   c                   ó<   ‡ — e Zd Zˆ fd„Zd„ Zd„ Zd„ Zd„ Zd„ Zˆ xZ	S )rk   c                 ó|  •— t          |t          ¦  «        st          d¦  «        ‚t          j        |¦  «        st          d¦  «        ‚t          |t
          ¦  «        r|j        \  }}||z  }t          |gt          |¦  «        g¦  «        }t          ¦   «          
                    ||j        ¦  «         ||f| _        d S )NúLinearOperator expected as Azscalar expected as alpha)rF   r   r#   r    rj   rk   r   rÆ   r   r   r&   r$   )r%   r®   ÚalphaÚalpha_originalr!   r   s        €r   r&   z_ScaledLinearOperator.__init__í  s´   ø€ Ý˜!�^Ñ,Ô,ð 	=ÝÐ;Ñ<Ô<Ð<ÝŒ{˜5Ñ!Ô!ð 	9ÝÐ7Ñ8Ô8Ð8Ý�aÕ.Ñ/Ô/ð 	+Ø !¤ÑˆAˆ~ð ˜NÑ*ˆEå˜A˜3¥ e¡¤ Ñ.Ô.ˆÝ‰Œ×Ò˜ ¤Ñ(Ô(Ð(Ø˜�JˆŒ	ˆ	ˆ	r   c                 ó^   — | j         d         | j         d                              |¦  «        z  S rã   rÐ   rA   s     r   r   z_ScaledLinearOperator._matvecý  ó'   € ØŒy˜Œ|˜dœi¨œl×1Ò1°!Ñ4Ô4Ñ4Ð4r   c                 ó‚   — t          j        | j        d         ¦  «        | j        d                              |¦  «        z  S rã   )r    r»   r   rO   rA   s     r   rN   z_ScaledLinearOperator._rmatvec   ó1   € ÝŒw�t”y ”|Ñ$Ô$ t¤y°¤|×';Ò';¸AÑ'>Ô'>Ñ>Ð>r   c                 ó‚   — t          j        | j        d         ¦  «        | j        d                              |¦  «        z  S rã   )r    r»   r   r_   rA   s     r   rQ   z_ScaledLinearOperator._rmatmat  rð   r   c                 ó^   — | j         d         | j         d                              |¦  «        z  S rã   rØ   rA   s     r   r   z_ScaledLinearOperator._matmat  rî   r   c                 óN   — | j         \  }}|j        t          j        |¦  «        z  S rc   )r   rU   r    r»   )r%   r®   rë   s      r   rR   z_ScaledLinearOperator._adjoint	  s"   € Ø”9‰ˆˆ5ØŒs•R”W˜U‘^”^Ñ#Ð#r   rÝ   rœ   s   @r   rk   rk   ì  sƒ   ø€ € € € € ðð ð ð ð ð 5ð 5ð 5ð?ð ?ð ?ð?ð ?ð ?ð5ð 5ð 5ð$ð $ð $ð $ð $ð $ð $r   rk   c                   óB   ‡ — e Zd Zˆ fd„Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	ˆ xZ
S )r|   c                 óp  •— t          |t          ¦  «        st          d¦  «        ‚|j        d         |j        d         k    rt          d|›�¦  «        ‚t	          |¦  «        r|dk     rt          d¦  «        ‚t          ¦   «                              t          |g¦  «        |j        ¦  «         ||f| _        d S )Nrê   r   r5   z$square LinearOperator expected, got z"non-negative integer expected as p)	rF   r   r#   r$   r   r   r&   rÆ   r   )r%   r®   r~   r   s      €r   r&   z_PowerLinearOperator.__init__  s«   ø€ Ý˜!�^Ñ,Ô,ð 	=ÝÐ;Ñ<Ô<Ð<ØŒ7�1Œ:˜œ œÒ#Ð#ÝÐIÀAÐIÐIÑJÔJÐJÝ˜‰|Œ|ð 	C˜q 1šu˜uÝÐAÑBÔBÐBå‰Œ×Ò� Q C™œ¨!¬'Ñ2Ô2Ð2Ø˜�FˆŒ	ˆ	ˆ	r   c                 ó‚   — t          j        |d¬¦  «        }t          | j        d         ¦  «        D ]} ||¦  «        }Œ|S )NT)Úcopyr5   )r    ÚarrayÚranger   )r%   ÚfunrB   ÚresÚis        r   Ú_powerz_PowerLinearOperator._power  sG   € ÝŒh�q˜tÐ$Ñ$Ô$ˆÝ�t”y ”|Ñ$Ô$ð 	ð 	ˆAØ�#�c‘(”(ˆCˆCØˆ
r   c                 óN   — |                       | j        d         j        |¦  «        S ©Nr   )rý   r   r,   rA   s     r   r   z_PowerLinearOperator._matvec   ó   € Ø�{Š{˜4œ9 Qœ<Ô.°Ñ2Ô2Ð2r   c                 óN   — |                       | j        d         j        |¦  «        S rÿ   )rý   r   rO   rA   s     r   rN   z_PowerLinearOperator._rmatvec#  ó   € Ø�{Š{˜4œ9 Qœ<Ô/°Ñ3Ô3Ð3r   c                 óN   — |                       | j        d         j        |¦  «        S rÿ   )rý   r   r_   rA   s     r   rQ   z_PowerLinearOperator._rmatmat&  r  r   c                 óN   — |                       | j        d         j        |¦  «        S rÿ   )rý   r   r@   rA   s     r   r   z_PowerLinearOperator._matmat)  r   r   c                 ó*   — | j         \  }}|j        |z  S rc   rÚ   )r%   r®   r~   s      r   rR   z_PowerLinearOperator._adjoint,  s   € ØŒy‰ˆˆ1ØŒs�a‰xˆr   )rŠ   r–   r—   r&   rý   r   rN   rQ   r   rR   r›   rœ   s   @r   r|   r|     s’   ø€ € € € € ð	ð 	ð 	ð 	ð 	ðð ð ð3ð 3ð 3ð4ð 4ð 4ð4ð 4ð 4ð3ð 3ð 3ðð ð ð ð ð ð r   r|   c                   ó*   ‡ — e Zd Zˆ fd„Zd„ Zd„ Zˆ xZS )ÚMatrixLinearOperatorc                 óŒ   •— t          ¦   «                              |j        |j        ¦  «         || _        d | _        |f| _        d S rc   )r   r&   r!   r$   r®   Ú_MatrixLinearOperator__adjr   )r%   r®   r   s     €r   r&   zMatrixLinearOperator.__init__2  s<   ø€ Ý‰Œ×Ò˜œ !¤'Ñ*Ô*Ð*ØˆŒØˆŒ
Ø�DˆŒ	ˆ	ˆ	r   c                 ó6   — | j                              |¦  «        S rc   )r®   rg   r=   s     r   r   zMatrixLinearOperator._matmat8  s   € ØŒv�zŠz˜!‰}Œ}Ðr   c                 óP   — | j         €t          | j        ¦  «        | _         | j         S rc   )r	  Ú_AdjointMatrixOperatorr®   r„   s    r   rR   zMatrixLinearOperator._adjoint;  s#   € ØŒ:ÐÝ/°´Ñ7Ô7ˆDŒJØŒzÐr   )rŠ   r–   r—   r&   r   rR   r›   rœ   s   @r   r  r  1  sV   ø€ € € € € ðð ð ð ð ðð ð ðð ð ð ð ð ð r   r  c                   ó0   — e Zd Zd„ Zed„ ¦   «         Zd„ ZdS )r  c                 ó�   — |j                              ¦   «         | _        |f| _        |j        d         |j        d         f| _        d S rã   )r<   r»   r®   r   r$   )r%   Úadjoint_arrays     r   r&   z_AdjointMatrixOperator.__init__B  sA   € Ø”×%Ò%Ñ'Ô'ˆŒØ"Ð$ˆŒ	Ø"Ô(¨Ô+¨]Ô-@ÀÔ-CÐCˆŒ
ˆ
ˆ
r   c                 ó&   — | j         d         j        S rÿ   )r   r!   r„   s    r   r!   z_AdjointMatrixOperator.dtypeG  s   € àŒy˜Œ|Ô!Ð!r   c                 ó6   — t          | j        d         ¦  «        S rÿ   )r  r   r„   s    r   rR   z_AdjointMatrixOperator._adjointK  s   € Ý# D¤I¨a¤LÑ1Ô1Ð1r   N)rŠ   r–   r—   r&   rš   r!   rR   rd   r   r   r  r  A  sP   € € € € € ðDð Dð Dð
 ð"ð "ñ „Xð"ð2ð 2ð 2ð 2ð 2r   r  c                   ó>   ‡ — e Zd Zdˆ fd„	Zd„ Zd„ Zd„ Zd„ Zd„ Zˆ xZ	S )	ÚIdentityOperatorNc                 óL   •— t          ¦   «                              ||¦  «         d S rc   )r   r&   )r%   r$   r!   r   s      €r   r&   zIdentityOperator.__init__P  s#   ø€ Ý‰Œ×Ò˜ Ñ&Ô&Ð&Ð&Ð&r   c                 ó   — |S rc   rd   rA   s     r   r   zIdentityOperator._matvecS  ó   € Øˆr   c                 ó   — |S rc   rd   rA   s     r   rN   zIdentityOperator._rmatvecV  r  r   c                 ó   — |S rc   rd   rA   s     r   rQ   zIdentityOperator._rmatmatY  r  r   c                 ó   — |S rc   rd   rA   s     r   r   zIdentityOperator._matmat\  r  r   c                 ó   — | S rc   rd   r„   s    r   rR   zIdentityOperator._adjoint_  s   € Øˆr   rc   rÝ   rœ   s   @r   r  r  O  sˆ   ø€ € € € € ð'ð 'ð 'ð 'ð 'ð 'ðð ð ðð ð ðð ð ðð ð ðð ð ð ð ð ð r   r  c                 óÀ  — t          | t          ¦  «        r| S t          | t          j        ¦  «        st          | t          j        ¦  «        rO| j        dk    rt          d¦  «        ‚t          j        t          j        | ¦  «        ¦  «        } t          | ¦  «        S t          | ¦  «        st          | ¦  «        rt          | ¦  «        S t          | d¦  «        ryt          | d¦  «        rid}d}d}t          | d¦  «        r| j        }t          | d¦  «        r| j        }t          | d¦  «        r| j        }t          | j        | j        |||¬	¦  «        S t%          d
¦  «        ‚)aÿ  Return A as a LinearOperator.

    'A' may be any of the following types:
     - ndarray
     - matrix
     - sparse array (e.g. csr_array, lil_array, etc.)
     - LinearOperator
     - An object with .shape and .matvec attributes

    See the LinearOperator documentation for additional information.

    Notes
    -----
    If 'A' has no .dtype attribute, the data type is determined by calling
    :func:`LinearOperator.matvec()` - set the .dtype attribute to prevent this
    call upon the linear operator creation.

    Examples
    --------
    >>> import numpy as np
    >>> from scipy.sparse.linalg import aslinearoperator
    >>> M = np.array([[1,2,3],[4,5,6]], dtype=np.int32)
    >>> aslinearoperator(M)
    <2x3 MatrixLinearOperator with dtype=int32>
    r   zarray must have ndim <= 2r$   r,   NrO   r_   r!   )rO   r_   r!   ztype not understood)rF   r   r    ÚndarrayrG   rH   r#   Ú
atleast_2dr+   r  r   r   rS   rO   r_   r!   r$   r,   rZ   )r®   rO   r_   r!   s       r   r	   r	   c  sg  € õ4 �!•^Ñ$Ô$ð 3Øˆå	�A•r”zÑ	"Ô	"ð 3¥j°µB´IÑ&>Ô&>ð 3ØŒ6�AŠ:ˆ:ÝÐ8Ñ9Ô9Ð9ÝŒM�"œ* Q™-œ-Ñ(Ô(ˆÝ# AÑ&Ô&Ð&å	�!‰Œð 3Õ*¨1Ñ-Ô-ð 3Ý# AÑ&Ô&Ð&õ �1�gÑÔð 	3¥7¨1¨hÑ#7Ô#7ð 	3ØˆGØˆGØˆEå�q˜)Ñ$Ô$ð $Øœ)�Ý�q˜)Ñ$Ô$ð $Øœ)�Ý�q˜'Ñ"Ô"ð  Øœ�Ý! !¤'¨1¬8¸WØ*1¸ð@ñ @ô @ð @õ Ð1Ñ2Ô2Ð2r   rc   )r˜   r   Únumpyr    Úscipy.sparser   Úscipy.sparse._sputilsr   r   r   r   Ú__all__r   r   r“   r•   rÆ   r�   rq   rk   r|   r  r  r  r	   rd   r   r   ú<module>r"     sn  ðð*ð *ðX €€€à Ð Ð Ð à !Ð !Ð !Ð !Ð !Ð !Ø RÐ RÐ RÐ RÐ RÐ RÐ RÐ RÐ RÐ RÐ RÐ RàÐ/Ð
0€ðX/ð X/ð X/ð X/ð X/ñ X/ô X/ð X/ðv+7ð +7ð +7ð +7ð +7˜Nñ +7ô +7ð +7ð\!ð !ð !ð !ð !˜^ñ !ô !ð !ð*3ð 3ð 3ð 3ð 3 ñ 3ô 3ð 3ð.#ð #ð #ð #ðð ð ð ð ˜ñ ô ð ð6ð ð ð ð ˜^ñ ô ð ð8$ð $ð $ð $ð $˜Nñ $ô $ð $ðD ð  ð  ð  ð  ˜>ñ  ô  ð  ðFð ð ð ð ˜>ñ ô ð ð 2ð 2ð 2ð 2ð 2Ð1ñ 2ô 2ð 2ðð ð ð ð �~ñ ô ð ð(63ð 63ð 63ð 63ð 63r   