Ë
    ÏÍ:jŸ¡  ã                   óÂ  — d Z ddlZddlZddlZddlZddlmZ ddlm	Z
 ddlmZmZmZmZmZmZmZmZmZmZ ddlmZ ddlmZmZmZmZ dd	gZ e«        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) e«       d „ «       Z*y)"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)Úsparse)Úarray_api_extra)
ÚSCIPY_ARRAY_APIÚ_asarrayÚarray_namespaceÚis_array_api_objÚis_pydata_sparse_arrayÚ	np_compatÚxp_capabilitiesÚxp_copyÚxp_isscalarÚxp_result_type)Úissparse)ÚasmatrixÚis_pydata_spmatrixÚ	isintlikeÚisshapeÚLinearOperatorÚaslinearoperatorc                   óR  ‡ — e Zd ZU dZdZ eej                  «      Zee	d<   e
e	d<   ˆ fd„Zd)d„Zd„ Zd„ Zd	„ Zd
„ Zd„ Zd*defd„Zd„ Zd„ Zd„ Zd*de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)e*d$„ «       Z+d%„ Z,e*d&„ «       Z-d'„ Z.d(„ Z/ˆ xZ0S )+r   aÐ  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, optionally with additional batch dimensions at the front)
    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.

    The defined operator may have additional "batch" dimensions
    prepended to the core shape, to represent a batch of 2-D operators;
    see :ref:`linalg_batch` for details.

    Parameters
    ----------
    shape : tuple
        Matrix dimensions ``(..., M, N)``,
        where ``...`` represents any additional batch dimensions.
    matvec : callable f(v)
        Applies ``A`` to ``v``, where ``v`` is a dense vector
        with shape ``(..., N)``.
    rmatvec : callable f(v)
        Applies ``A^H`` to ``v``, where ``A^H`` is the conjugate transpose of ``A``,
        and ``v`` is a dense vector of shape ``(..., M)``.
    matmat : callable f(V)
        Returns ``A @ V``, where ``V`` is a dense matrix
        with dimensions ``(..., N, K)``.
    rmatmat : callable f(V)
        Returns ``A^H @ V``, where ``A^H`` is the conjugate transpose of ``A``,
        and where ``V`` is a dense matrix with dimensions ``(..., M, K)``.
    dtype : dtype
        Data type of the matrix or matrices.
    xp : array_namespace, optional
        A namespace compatible with the array API standard for use in array operations.
        Default: ``numpy``.

    Attributes
    ----------
    args : tuple
        For linear operators describing products etc. of other linear
        operators, the operands of the binary operation.
    ndim : int
        Number of dimensions (greater than 2 in the case of batch dimensions).
    T : LinearOperator
        Transpose.
    H : LinearOperator
        Hermitian adjoint.

    Methods
    -------
    matvec
    matmat
    adjoint
    transpose
    rmatvec
    rmatmat
    dot
    rdot
    __mul__
    __matmul__
    __call__
    __add__
    __truediv__
    __rmul__
    __rmatmul__

    See Also
    --------
    aslinearoperator : Construct a `LinearOperator`.

    Notes
    -----
    The user-defined `matvec` function must properly handle the case
    where ``v`` has shape ``(..., N)``.

    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.
    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 raised to integral powers, 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.])

    NÚ__class_getitem__Úndimc                 ó,  •— | t         u rt        ‰| �	  t        «      S t        ‰| �	  | «      }t	        |«      j
                  t         j
                  k(  rBt	        |«      j                  t         j                  k(  rt        j                  dt        d¬«       |S )NzMLinearOperator subclass should implement at least one of _matvec and _matmat.é   )ÚcategoryÚ
stacklevel)
r   ÚsuperÚ__new__Ú_CustomLinearOperatorÚtypeÚ_matvecÚ_matmatÚwarningsÚwarnÚRuntimeWarning)ÚclsÚargsÚkwargsÚobjÚ	__class__s       €ús/home/mcse/projects/srt_converter/srt-converter-venv/lib/python3.12/site-packages/scipy/sparse/linalg/_interface.pyr   zLinearOperator.__new__Ï   sy   ø€ Ø”.Ñ ä‘7‘?Ô#8Ó9Ð9ä‘'‘/ #Ó&ˆCô �S“	×!Ñ!¤^×%;Ñ%;Ò;Ü˜“I×%Ñ%¬×)?Ñ)?Ò?ä—‘ð<ä+Ø õ	ð ˆJó    c                 ó&  — |€t         n|}|�|j                  d|¬«      j                  }t        |«      }t	        |«      dk  rt        d|›d�«      ‚t        |d¬«      st        d|›�«      ‚|| _        || _        t	        |«      | _        || _	        y)	z£Initialize this LinearOperator.

        To be called by subclasses. ``dtype`` may be None; ``shape`` should
        be convertible to a length >=2 tuple.
        Nr   ©Údtyper   zinvalid shape z (must be at least 2-d)F)Úcheck_nd)
r
   Úemptyr/   ÚtupleÚlenÚ
ValueErrorr   Úshaper   Ú_xp)Úselfr/   r5   Úxps       r+   Ú__init__zLinearOperator.__init__ã   s’   € ð ˜*�Y¨"ˆØÐØ—H‘H˜Q e�HÓ,×2Ñ2ˆEä�e“ˆÜˆu‹:˜Š>Ü˜~¨e¨YÐ6MÐNÓOÐOÜ�u uÕ-Ü˜~¨e¨YÐ7Ó8Ð8àˆŒ
ØˆŒ
Ü˜“JˆŒ	Øˆ�r,   c                 óh   — | j                   j                  «       }|d   j                  d«      |d<   |S )Nr6   r   )Ú__dict__Úcopyr1   ©r7   Ústates     r+   Ú__getstate__zLinearOperator.__getstate__ø   s1   € Ø—‘×"Ñ"Ó$ˆØ˜U‘|×)Ñ)¨!Ó,ˆˆe‰Øˆr,   c                 óx   — t        |j                  d«      «      | _        | j                  j	                  |«       y )Nr6   )r   Úpopr6   r;   Úupdater=   s     r+   Ú__setstate__zLinearOperator.__setstate__ý   s)   € Ü" 5§9¡9¨UÓ#3Ó4ˆŒØ�‰×Ñ˜UÕ#r,   c                 óZ  — | j                   €i| j                  }|j                  | j                  d   |j                  ¬«      }	 |j                  | j                  |«      «      }|j                   | _         yy# t        t        t        f$ r t        j                  |d¬«      | _         Y yw xY w)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.   Úintegral)r8   Úkind)r/   r6   Úzerosr5   Úint8ÚasarrayÚmatvecÚOverflowErrorÚ	TypeErrorÚRuntimeErrorÚxpxÚdefault_dtype)r7   r8   ÚvÚmatvec_vs       r+   Ú_init_dtypezLinearOperator._init_dtype  s�   € ð �:‰:ÐØ—‘ˆBØ—‘˜Ÿ™ B™¨r¯w©w�Ó7ˆAð,ØŸ:™: d§k¡k°!£nÓ5�ð &Ÿ^™^�•
ð øô
 "¤9¬lÐ;ò GÜ ×.Ñ.°"¸:ÔF�–
ðGús   Á A7 Á70B*Â)B*c                óÀ   — | j                   }|j                  t        |j                  d   «      D �cg c]  }| j	                  |ddd…|f   «      ‘Œ c}d¬«      S c c}w )a�  Default matrix-matrix multiplication handler.

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

        Falls back to `_matvec`, so defining that will
        define matrix multiplication too (though in a very suboptimal way).
        rE   .N©Úaxis)r6   ÚstackÚranger5   r!   ©r7   ÚXr8   Úis       r+   r"   zLinearOperator._matmat  sX   € ð �X‰Xˆð �x‰xÜ16°q·w±w¸r±{Ó1CÖD¨AˆT�\‰\˜!˜C¢ A˜I™,Õ'ÒDÈ2ð ó 
ð 	
ùÚDs   ² Ac                 ó`   — | j                   }| j                  |d|j                  f   «      d   S )al  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)`` array,
        and should return a shape ``(..., M)`` array.

        Falls back to `_matmat`, so defining that
        will define matrix-vector multiplication as well.
        .©.r   )r6   r"   Únewaxis©r7   Úxr8   s      r+   r!   zLinearOperator._matvec*  s.   € ð �X‰XˆØ�|‰|˜A˜c 2§:¡:˜oÑ.Ó/°Ñ7Ð7r,   Úadjointc                 óÚ  — | j                   }t        |d|¬«      }| j                  �^ }}}|r||fn||f\  }}t        |t        j
                  «      rR|r| j                  |«      n| j                  |«      }	|j                  |dfk(  r|	j                  |d«      }	t        |	«      S d}
d}|j                  |dfk(  x}rj|rdnd}|rdnd	}d
|› d|› d|› d�}t        j                  |t        t        j                  j                  t         «      f¬«       |j                  ||f«      }n2|j"                  dk\  r#|j                  d   |k(  x}r|j                  d d }
|s"|s d|› d|› d|j                  › �}t%        |«      ‚|r| j                  |«      n| j                  |«      }	t'        j(                  ||
«      }|r|j                  |	g |¢|‘­«      }	|	S |r|j                  |	g |¢|‘d‘­«      }	|	S )NT©Úsubokr8   é   © Fz	`rmatvec`z`matvec`z	`rmatmat`z`matmat`zCalling z  on 'column vectors' of shape `(za, 1)` was deprecated in SciPy 1.18.0 and will no longer be possible in SciPy 1.20.0. Please call z! instead for identical behaviour.)Úskip_file_prefixesrE   z6Dimension mismatch: `x` must have a shape ending in `(z,)`, or shape `(z, 1)`. Given shape: )r6   r   r5   Ú
isinstanceÚnpÚmatrixÚ_rmatvecr!   Úreshaper   r#   r$   ÚFutureWarningÚosÚpathÚdirnameÚ__file__r   r4   rO   Úbroadcast_shapes)r7   r`   ra   r8   Úself_broadcast_dimsÚMÚNÚ	inner_dimÚ	outer_dimÚyÚx_broadcast_dimsÚ
row_vectorÚcolumn_vectorÚ	func_nameÚmatmat_func_nameÚmsgÚbroadcasted_dimss                    r+   Ú_shared_matveczLinearOperator._shared_matvec8  s  € Ø�X‰Xˆä�Q˜d rÔ*ˆà%)§Z¡ZÑ"Ð	˜a Ù)0  1™v°q¸!°fÑˆ	�9ô �aœŸ™Ô#Ù$+�—‘˜aÔ °·±¸a³ˆAØ�w‰w˜9 a˜.Ò(Ø—I‘I˜i¨Ó+�Ü˜A“;Ðà,.ÐØ ˆ
ØŸG™G¨	°1 ~Ñ5Ð5ˆ=Ð5Ù'.™°JˆIÙ.5™{¸:Ðà˜9˜+ð &Ø�Kð  à/Ð0Ð0QðSð ô �M‰MØ”]¼¿¹¿¹ÌÓ8QÐ7Sõð —
‘
˜1˜y˜lÓ+‰AØ�V‰V�qŠ[¨A¯G©G°B©K¸9Ñ,DÐD˜jÐDØ Ÿw™w s¨˜|Ðá™mðØ�KÐ/°	¨{ð ; Ø !§¡˜yð*ð ô
 ˜S“/Ð!á 'ˆD�M‰M˜!Ô¨T¯\©\¸!«_ˆä×/Ñ/Ð0CÐEUÓVÐÙØ—
‘
˜1Ð<Ð 0Ð<°)Ñ<Ó=ˆAð ˆñ Ø—
‘
˜1Ð?Ð 0Ð?°)Ð?¸QÑ?Ó@ˆAàˆr,   c                 ó$   — | j                  |«      S )aÏ  Matrix-vector multiplication.

        Applies ``A`` to `x`, where ``A`` is an ``M`` x ``N``
        linear operator (or batch of linear operators)
        and `x` is a row vector (or batch of such vectors).

        Parameters
        ----------
        x : {matrix, ndarray}
            An array with shape ``(..., N)`` representing a row vector
            (or batch of row vectors).

            .. versionadded:: 1.18.0
                A ``FutureWarning`` is emitted for column vector input of shape
                ``(N, 1)``, for which an array with shape ``(M, 1)`` is returned.
                `matmat` can be called instead for identical behaviour on such input.

        Returns
        -------
        y : {matrix, ndarray}
            An array with shape ``(..., M)``.

        Notes
        -----
        This method wraps the user-specified ``matvec`` routine or overridden
        ``_matvec`` method to ensure that `y` has the correct shape and type.
        ©r€   ©r7   r`   s     r+   rK   zLinearOperator.matveck  s   € ð8 ×"Ñ" 1Ó%Ð%r,   c                 ó(   — | j                  |d¬«      S )a,  Adjoint matrix-vector multiplication.

        Applies ``A^H`` to `x`, where ``A`` is an
        ``M`` x ``N`` linear operator (or batch of linear operators)
        and `x` is a row vector (or batch of such vectors).

        Parameters
        ----------
        x : {matrix, ndarray}
            An array with shape ``(..., M)`` representing a row vector
            (or batch of row vectors),
            or an array with shape ``(M, 1)`` representing a column vector.

            .. versionadded:: 1.18.0
                A ``FutureWarning`` is now emitted for column vector input of shape
                ``(M, 1)``, for which an array with shape ``(N, 1)`` is returned.
                `rmatmat` can be called instead for identical behaviour on such input.

        Returns
        -------
        y : {matrix, ndarray}
            An array with shape ``(..., N)``.

        Notes
        -----
        This method wraps the user-specified ``rmatvec`` routine or overridden
        ``_rmatvec`` method to ensure that `y` has the correct shape and type.
        T©ra   r‚   rƒ   s     r+   ÚrmatveczLinearOperator.rmatvec‰  s   € ð: ×"Ñ" 1¨dÐ"Ó3Ð3r,   c                 óR  — t        | «      j                  t        j                  k(  rgt        | d«      rUt        | «      j                  t        j                  k7  r/| j
                  }| j	                  |d|j                  f   «      d   S t        ‚| j                  j                  |«      S )zPDefault implementation of `_rmatvec`.
        Defers to `_rmatmat` or `adjoint`.Ú_rmatmat.r]   )
r    Ú_adjointr   Úhasattrrˆ   r6   r^   ÚNotImplementedErrorÚHr!   r_   s      r+   rk   zLinearOperator._rmatvec¨  sƒ   € ô �‹:×Ñ¤.×"9Ñ"9Ò9ô ˜˜jÔ)Ü˜“J×'Ñ'¬>×+BÑ+BÒBà—X‘X�à—}‘} Q s¨B¯J©J Ñ%7Ó8¸Ñ@Ð@Ü%Ð%à—6‘6—>‘> !Ó$Ð$r,   c                 óX  — t        |«      s#t        |«      st        |d| j                  ¬«      }|j                  dk  rt        d|j                  › d�«      ‚|j                  d   |r| j                  d   n| j                  d   k7  r%t        d| j                  › d	|j                  › �«      ‚	 |r| j                  |«      n| j                  |«      }t        |t        j                  «      rt        |«      }|S # t        $ r(}t        |«      st        |«      rt        d
«      |‚‚ d }~ww xY w)NTrc   r   z-Expected at least 2-d ndarray or matrix, not z-déþÿÿÿrE   zDimension mismatch: z, z³Multipliying LinearOperator with a sparse matrix failed. Try wrapping the matrix with `aslinearoperator` first, or ensuring the operator's `matmat` function supports sparse input.)r   r   r   r6   r   r4   r5   rˆ   r"   Ú	ExceptionrM   rh   ri   rj   r   )r7   rZ   ra   ÚYÚes        r+   Ú_shared_matmatzLinearOperator._shared_matmat¸  s  € Ü˜”Ô1°!Ô4Ü˜ $¨4¯8©8Ô4ˆAà�6‰6�AŠ:ÜÐLÈQÏVÉVÈHÐTVÐWÓXÐXà�7‰7�2‰;©W˜4Ÿ:™: bš>¸$¿*¹*ÀR¹.ÒIÜÐ3°D·J±J°<¸rÀ!Ç'Á'ÀÐKÓLÐLð
	Ù$+�—‘˜aÔ °·±¸a³ˆAô �aœŸ™Ô#Ü˜“ˆAàˆøô ò 	Ü˜Œ{Ô0°Ô3Üð.óð
 ðð ûð	ús   Â-$C8 Ã8	D)Ä#D$Ä$D)c                 ó$   — | j                  |«      S )aÙ  Matrix-matrix multiplication.

        Performs the operation ``A @ X`` where ``A`` is an ``M`` x ``N``
        linear operator (or batch of linear operators)
        and `X` is a dense ``N`` x ``K`` matrix
        (or batch of dense matrices).

        Parameters
        ----------
        X : {matrix, ndarray}
            An array with shape ``(..., N, K)`` representing the dense matrix
            (or batch of dense matrices).

        Returns
        -------
        Y : {matrix, ndarray}
            An array with shape ``(..., M, K)``.

        Notes
        -----
        This method wraps any user-specified ``matmat`` routine or overridden
        ``_matmat`` method to ensure that `Y` has the correct type.
        ©r’   ©r7   rZ   s     r+   ÚmatmatzLinearOperator.matmatÓ  s   € ð0 ×"Ñ" 1Ó%Ð%r,   c                 ó(   — | j                  |d¬«      S )a   Adjoint matrix-matrix multiplication.

        Performs the operation ``A^H @ X`` where ``A`` is an ``M`` x ``N``
        linear operator (or batch of linear operators)
        and `X` is a dense ``M`` x ``K`` matrix
        (or batch of dense matrices).
        The default implementation defers to the adjoint.

        Parameters
        ----------
        X : {matrix, ndarray}
            An array with shape ``(..., M, K)`` representing the dense matrix
            (or batch of dense matrices).

        Returns
        -------
        Y : {matrix, ndarray}
            An array with shape ``(..., N, K)``.

        Notes
        -----
        This method wraps any user-specified ``rmatmat`` routine or overridden
        ``_rmatmat`` method to ensure that `Y` has the correct type.

        Tr…   r”   r•   s     r+   ÚrmatmatzLinearOperator.rmatmatí  s   € ð4 ×"Ñ" 1¨dÐ"Ó3Ð3r,   c                óB  — t        | «      j                  t        j                  k(  rZ| j                  }|j	                  t        |j                  d   «      D �cg c]  }| j                  |ddd…|f   «      ‘Œ c}d¬«      S | j                  j                  |«      S c c}w )zGDefault implementation of `_rmatmat`; defers to `rmatvec` or `adjoint`.rE   .NrU   )
r    r‰   r   r6   rW   rX   r5   rk   rŒ   r"   rY   s       r+   rˆ   zLinearOperator._rmatmat	  s‡   € ä�‹:×Ñ¤.×"9Ñ"9Ò9Ø—‘ˆBð —8‘8Ü6;¸A¿G¹GÀB¹KÓ6HÖI°�—‘˜q ¢a¨ ™|Õ,ÒIÐPRð ó ð ð —6‘6—>‘> !Ó$Ð$ùò Js   Á Bc                 ó   — | |z  S )zIApply this linear operator.

        Equivalent to `__matmul__`.
        rf   rƒ   s     r+   Ú__call__zLinearOperator.__call__  s   € ð
 �a‰xˆr,   c                 ó$   — | j                  |«      S )zRMultiplication.

        Used by the ``*`` operator. Equivalent to `dot`.
        )Údotrƒ   s     r+   Ú__mul__zLinearOperator.__mul__  s   € ð
 �x‰x˜‹{Ðr,   c                 ód   — t        |«      st        d«      ‚t        | d|z  | j                  ¬«      S )zKScalar Division.

        Returns a lazily scaled linear operator.
        z.Can only divide a linear operator by a scalar.g      ð?©r8   )r   r4   Ú_ScaledLinearOperatorr6   ©r7   Úothers     r+   Ú__truediv__zLinearOperator.__truediv__$  s/   € ô
 ˜5Ô!ÜÐMÓNÐNä$ T¨3°©;¸4¿8¹8ÔDÐDr,   c                 óÈ   — t        |dd «      }|€'t        || j                  j                  d«      d¬«      }|| j                  k7  rd| j                  › d|› �}t	        |«      ‚y )Nr6   r   T)Ú	sparse_okz2Mismatched array namespaces.Namespace for self is z, namespace for x is )Úgetattrr   r6   r1   rM   )r7   r`   Úxp_xr~   s       r+   Ú_check_matching_namespacez(LinearOperator._check_matching_namespace.  sm   € Ü�q˜% Ó&ˆØˆ<Ü" 1 d§h¡h§n¡n°QÓ&7À4ÔHˆDØ�4—8‘8Òð)Ø)-¯©¨
Ð2GÈÀvðOð ô ˜C“.Ð ð r,   c                 ó6  — | j                  |«       t        |t        «      rt        | || j                  ¬«      S t        |«      rt        | || j                  ¬«      S t        |«      s&t        |«      s| j                  j                  |«      }| j                  d   }|j                  |fk(  }|j                  dk\  xr |j                  d   |k(  }|s"|s d|› d|› d|j                  › �}t        |«      ‚|r| j                  |«      S |r| j                  |«      S y)	a˜  Multi-purpose multiplication method.

        Parameters
        ----------
        x : array_like or `LinearOperator` or scalar
            Array-like input will be interpreted as a 1-D row vector or
            2-D matrix (or batch of matrices)
            depending on its shape. See the Returns section for details.

        Returns
        -------
        Ax : array or `LinearOperator`
            - For `LinearOperator` input, operator composition is performed.

            - For scalar input, a lazily scaled operator is returned.

            - Otherwise, the input is expected to take the form of a dense
              1-D vector or 2-D matrix (or batch of matrices),
              interpreted as follows
              (where ``self`` is an ``M`` by ``N`` linear operator):

              - If `x` has shape ``(N,)``
                it is interpreted as a row vector
                and `matvec` is called.
              - If `x` has shape ``(..., N, K)`` for some
                integer ``K``, it is interpreted as a matrix
                (or batch of matrices if there are batch dimensions)
                and `matmat` is called.

        See Also
        --------
        __mul__ : Equivalent method used by the ``*`` operator.
        __matmul__ :
            Method used by the ``@`` operator which rejects scalar
            input before calling this method.

        Notes
        -----
        To perform matrix-vector multiplication on batches of vectors,
        use `matvec`.

        For clarity, it is recommended to use the `matvec` or
        `matmat` methods directly instead of this method
        when interacting with dense vectors and matrices.

        r    rE   r   rŽ   z6Dimension mismatch: array input `x` must have shape `(z,)` or a shape ending in `(z), K)` for some integer `K`. Given shape: N)r©   rh   r   Ú_ProductLinearOperatorr6   r   r¡   r   r   rJ   r5   r   r4   rK   r–   )r7   r`   ru   Úvectorrj   r~   s         r+   r�   zLinearOperator.dot9  s  € ð^ 	×&Ñ& qÔ)Ü�aœÔ(Ü)¨$°°d·h±hÔ?Ð?Ü˜Œ^Ü(¨¨q°T·X±XÔ>Ð>ä˜A”;Ô'9¸!Ô'<ð —H‘H×$Ñ$ QÓ'�à—
‘
˜2‘ˆAð —W‘W  ‘_ˆFØ—V‘V˜q‘[Ò5 Q§W¡W¨R¡[°AÑ%5ˆFá™fàLÈQÈCð P.Ø./¨Sð 1$Ø$%§G¡G 9ð.ð ô
 ! “oÐ%áØ—{‘{ 1“~Ð%ÙØ—{‘{ 1“~Ð%ð r,   c                 óP   — t        |«      rt        d«      ‚| j                  |«      S )zŠMatrix Multiplication.

        Used by the ``@`` operator.
        Rejects scalar input.
        Otherwise, equivalent to `dot`.
        ú0Scalar operands are not allowed, use '*' instead)r   r4   rž   r¢   s     r+   Ú
__matmul__zLinearOperator.__matmul__‡  s'   € ô �uÔÜÐOÓPÐPØ�|‰|˜EÓ"Ð"r,   c                 óP   — t        |«      rt        d«      ‚| j                  |«      S )z©Matrix Multiplication from the right.

        Used by the ``@`` operator from the right.
        Rejects scalar input.
        Otherwise, equivalent to `rdot`.
        r®   )r   r4   Ú__rmul__r¢   s     r+   Ú__rmatmul__zLinearOperator.__rmatmul__’  s'   € ô �uÔÜÐOÓPÐPØ�}‰}˜UÓ#Ð#r,   c                 ó$   — | j                  |«      S )zqMultiplication from the right.

        Used by the ``*`` operator from the right. Equivalent to `rdot`.
        )Úrdotrƒ   s     r+   r±   zLinearOperator.__rmul__�  s   € ð
 �y‰y˜‹|Ðr,   c                 ó�  ‡ — ‰ j                  |«       t        |t        «      rt        |‰ ‰ j                  ¬«      S t        |«      rt        ‰ |‰ j                  ¬«      S t        |«      s&t        |«      s‰ j                  j                  |«      }‰ j                  d   }|j                  |fk(  }|j                  dk\  xr |j                  d   |k(  }|s#|s!d|› d|› d|j                  › d�}t        |«      ‚ˆ fd	„}|r!‰ j                  j                   ||«      «      S |r' |‰ j                  j                   ||«      «      «      S y
)a�  Multi-purpose multiplication method from the right.

        .. note ::

            This method returns ``x A``.
            To perform adjoint multiplication instead, use one of
            `rmatvec` or `rmatmat`, or take the adjoint first,
            like ``self.H.rdot(x)`` or ``x * self.H``.

        Parameters
        ----------
        x : array_like or `LinearOperator` or scalar
            Array-like input will be interpreted as a 1-D row vector or
            2-D matrix (or batch of matrices)
            depending on its shape. See the Returns section for details.

        Returns
        -------
        xA : array or `LinearOperator`
            - For `LinearOperator` input, operator composition is performed.

            - For scalar input, a lazily scaled operator is returned.

            - Otherwise, the input is expected to take the form of a dense
              1-D vector or 2-D matrix (or batch of matrices),
              interpreted as follows
              (where ``self`` is an ``M`` by ``N`` linear operator):

              - If `x` has shape ``(M,)``
                it is interpreted as a row vector.
              - If `x` has shape ``(..., K, M)`` for some
                integer ``K``, it is interpreted as a matrix
                (or batch of matrices if there are batch dimensions).

        See Also
        --------
        dot : Multi-purpose multiplication method from the left.
        __rmul__ :
            Equivalent method, used by the ``*`` operator from the right.
        __rmatmul__ :
            Method used by the ``@`` operator from the right
            which rejects scalar input before calling this method.
        r    rŽ   r   rE   z*Dimension mismatch: `x` must have shape `(z,)` or a shape ending in `(K, z&)` for some integer `K`. Given shape: ú.c                 óž   •— | j                   xxdk(  r  | S xdk(  r  | S  dk(  r| j                  S 	 ‰j                  j                  | dd«      S )Nr   re   r   rŽ   rE   )r   ÚTr6   Úmoveaxis)r`   r7   s    €r+   ÚmTzLinearOperator.rdot.<locals>.mTí  sO   ø€ Ø—f‘fØœ™Ø ˜ô ™Ø ˜ð ãØ Ÿs™s˜
ØØ#Ÿx™x×0Ñ0°°B¸Ó;Ð;r,   N)r©   rh   r   r«   r6   r   r¡   r   r   rJ   r5   r   r4   r¸   rK   r–   )r7   r`   rt   r¬   rj   r~   rº   s   `      r+   r´   zLinearOperator.rdot¤  s/  ø€ ðX 	×&Ñ& qÔ)Ü�aœÔ(Ü)¨!¨T°d·h±hÔ?Ð?Ü˜Œ^Ü(¨¨q°T·X±XÔ>Ð>ä˜A”;Ô'9¸!Ô'<ð —H‘H×$Ñ$ QÓ'�à—
‘
˜2‘ˆAð —W‘W  ‘_ˆFØ—V‘V˜q‘[Ò5 Q§W¡W¨R¡[°AÑ%5ˆFá™fà@ÀÀð D1Ø12°ð 4$Ø$%§G¡G 9¨Að/ð ô
 ! “oÐ%ô
<ñ Ø—v‘v—}‘}¡R¨£UÓ+Ð+ÙÙ˜$Ÿ&™&Ÿ-™-©¨1«Ó.Ó/Ð/ð r,   c                 óv   — | j                  |«       t        |«      rt        | || j                  ¬«      S t        S ©Nr    )r©   r   Ú_PowerLinearOperatorr6   ÚNotImplemented)r7   Úps     r+   Ú__pow__zLinearOperator.__pow__ú  s0   € Ø×&Ñ& qÔ)Ü�qŒ>Ü'¨¨a°D·H±HÔ=Ð=ä!Ð!r,   c                 ó€   — | j                  |«       t        |t        «      rt        | || j                  ¬«      S t
        S )z†Linear operator addition.

        The input must be a `LinearOperator`.
        A lazily summed linear operator is returned.
        r    )r©   rh   r   Ú_SumLinearOperatorr6   r¾   rƒ   s     r+   Ú__add__zLinearOperator.__add__  s5   € ð 	×&Ñ& qÔ)Ü�aœÔ(Ü% d¨A°$·(±(Ô;Ð;ä!Ð!r,   c                 ó2   — t        | d| j                  ¬«      S )NrE   r    )r¡   r6   ©r7   s    r+   Ú__neg__zLinearOperator.__neg__  s   € Ü$ T¨2°$·(±(Ô;Ð;r,   c                 ó&   — | j                  | «      S ©N)rÃ   rƒ   s     r+   Ú__sub__zLinearOperator.__sub__  s   € Ø�|‰|˜Q˜BÓÐr,   c                 óÔ   — | j                   €d}ndt        | j                   «      z   }dj                  d„ | j                  D «       «      }d|› d| j                  j
                  › d|› d�S )	Nzunspecified dtypezdtype=r`   c              3   ó2   K  — | ]  }t        |«      –— Œ y ­wrÈ   )Ústr)Ú.0Údims     r+   ú	<genexpr>z*LinearOperator.__repr__.<locals>.<genexpr>  s   è ø€ Ò8 cœ˜SŸÑ8ùs   ‚ú<ú z with ú>)r/   rÌ   Újoinr5   r*   Ú__name__)r7   Údtr5   s      r+   Ú__repr__zLinearOperator.__repr__  sa   € Ø�:‰:ÐØ$‰BàœC §
¡
›OÑ+ˆBà—‘Ñ8¨T¯Z©ZÔ8Ó8ˆØ�5�'˜˜4Ÿ>™>×2Ñ2Ð3°6¸"¸¸QÐ?Ð?r,   c                 ó"   — | j                  «       S )aÔ  Hermitian adjoint.

        Returns the Hermitian adjoint of this linear operator,
        also known as the Hermitian
        conjugate or Hermitian transpose. For a complex matrix, the
        Hermitian adjoint is equal to the conjugate transpose.

        Returns
        -------
        `LinearOperator`
            Hermitian adjoint of self.

        See Also
        --------
        :attr:`~scipy.sparse.linalg.LinearOperator.H` : Equivalent attribute.
        )r‰   rÅ   s    r+   ra   zLinearOperator.adjoint  s   € ð" �}‰}‹Ðr,   c                 ó"   — | j                  «       S )z†Hermitian adjoint.

        See Also
        --------
        scipy.sparse.linalg.LinearOperator.adjoint : Equivalent method.
        r…   rÅ   s    r+   rŒ   zLinearOperator.H/  s   € ð �|‰|‹~Ðr,   c                 ó"   — | j                  «       S )zìTranspose.

        Returns
        -------
        `LinearOperator`
            Transpose of the linear operator.

        See Also
        --------
        :attr:`~scipy.sparse.linalg.LinearOperator.T` : Equivalent attribute.
        )Ú
_transposerÅ   s    r+   Ú	transposezLinearOperator.transpose9  s   € ð �‰Ó Ð r,   c                 ó"   — | j                  «       S )z€Transpose.

        See Also
        --------
        scipy.sparse.linalg.LinearOperator.transpose : Equivalent method.
        )rÛ   rÅ   s    r+   r¸   zLinearOperator.TG  s   € ð �~‰~ÓÐr,   c                 ó0   — t        | | j                  ¬«      S )ziDefault implementation of `_adjoint`.
        Defers to adjoint functions, e.g. `_rmatvec` for `_matvec`.r    )Ú_AdjointLinearOperatorr6   rÅ   s    r+   r‰   zLinearOperator._adjointQ  s   € ô & d¨t¯x©xÔ8Ð8r,   c                 ó0   — t        | | j                  ¬«      S )z`Default implementation of `_transpose`.
        For `_matvec`, defers to `_rmatvec` + `np.conj`.r    )Ú_TransposedLinearOperatorr6   rÅ   s    r+   rÚ   zLinearOperator._transposeV  s   € ô )¨°$·(±(Ô;Ð;r,   rÈ   )F)1rÔ   Ú
__module__Ú__qualname__Ú__doc__Ú__array_ufunc__ÚclassmethodÚtypesÚGenericAliasr   Ú__annotations__Úintr   r9   r?   rC   rS   r"   r!   Úboolr€   rK   r†   rk   r’   r–   r˜   rˆ   r›   rž   r¤   r©   r�   r¯   r²   r±   r´   rÀ   rÃ   rÆ   rÉ   rÖ   ra   ÚpropertyrŒ   rÛ   r¸   r‰   rÚ   Ú__classcell__©r*   s   @r+   r   r   G   s  ø… ñ|ð~ €Oñ &1°×1CÑ1CÓ%DÐ�{ÓDà
ƒIôó(ò*ò
$ò,ò*
ò(8ñ1¨ó 1òf&ò<4ò>%ñ ¨ó ò6&ò44ò8%òòòEò	!òL&ò\	#ò	$òòT0òl"ò
"ò<ò ò@òð& ñó ðò!ð ñ ó ð ò9ö
<r,   c                   óT   ‡ — 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.c                 óŽ   •— t         ‰| �  |||«       d| _        || _        || _        || _        || _        | j                  «        y )Nrf   )r   r9   r'   Ú"_CustomLinearOperator__matvec_implÚ#_CustomLinearOperator__rmatvec_implÚ#_CustomLinearOperator__rmatmat_implÚ"_CustomLinearOperator__matmat_implrS   )	r7   r5   rK   r†   r–   r/   r˜   r8   r*   s	           €r+   r9   z_CustomLinearOperator.__init___  sI   ø€ ô 	‰Ñ˜  rÔ*àˆŒ	à#ˆÔØ%ˆÔØ%ˆÔØ#ˆÔà×ÑÕr,   c                 ó\   •— | j                   �| j                  |«      S t        ‰| �	  |«      S rÈ   )ró   r   r"   ©r7   rZ   r*   s     €r+   r"   z_CustomLinearOperator._matmatt  s/   ø€ Ø×ÑÐ)Ø×%Ñ% aÓ(Ð(ä‘7‘? 1Ó%Ð%r,   c                 ó$   — | j                  |«      S rÈ   )rð   rƒ   s     r+   r!   z_CustomLinearOperator._matvecz  s   € Ø×!Ñ! !Ó$Ð$r,   c                 óV   — | j                   }|€t        d«      ‚| j                  |«      S )Nzrmatvec is not defined)rñ   r‹   )r7   r`   Úfuncs      r+   rk   z_CustomLinearOperator._rmatvec}  s/   € Ø×"Ñ"ˆØˆ<Ü%Ð&>Ó?Ð?Ø×"Ñ" 1Ó%Ð%r,   c                 ó\   •— | j                   �| j                  |«      S t        ‰| �	  |«      S rÈ   )rò   r   rˆ   rõ   s     €r+   rˆ   z_CustomLinearOperator._rmatmatƒ  s0   ø€ Ø×ÑÐ*Ø×&Ñ& qÓ)Ð)ä‘7Ñ# AÓ&Ð&r,   c           	      óú   — t        g | j                  d d ¢| j                  d   ‘| j                  d   ‘­| j                  | j                  | j                  | j
                  | j                  | j                  ¬«      S )NrŽ   rE   )r5   rK   r†   r–   r˜   r/   r8   )r   r5   rñ   rð   rò   ró   r/   r6   rÅ   s    r+   r‰   z_CustomLinearOperator._adjoint‰  sm   € Ü$ØD�D—J‘J˜s �OÐD T§Z¡Z°¡^ÐD°T·Z±ZÀ±^ÑDØ×&Ñ&Ø×&Ñ&Ø×&Ñ&Ø×&Ñ&Ø—*‘*Ø�x‰xô
ð 	
r,   )NNNNN)rÔ   rá   râ   rã   r9   r"   r!   rk   rˆ   r‰   rì   rí   s   @r+   r   r   \  s5   ø„ ÙHð ØØØØõô*&ò%ò&ô'ö	
r,   r   c                   ó<   ‡ — e Zd ZdZdˆ fd„	Zd„ Zd„ Zd„ Zd„ Zˆ xZ	S )rÞ   z$Adjoint of arbitrary Linear Operatorc                 óº   •— g |j                   d d ¢|j                   d   ‘|j                   d   ‘­}t        ‰| �	  |j                  ||«       || _        |f| _        y ©NrŽ   rE   ©r5   r   r9   r/   ÚAr'   ©r7   rÿ   r8   r5   r*   s       €r+   r9   z_AdjointLinearOperator.__init__˜  óV   ø€ Ø9�!—'‘'˜#˜2�,Ð9 §¡¨¡Ð9¨Q¯W©W°R©[Ñ9ˆÜ‰Ñ˜Ÿ™ %¨Ô,ØˆŒØ�Dˆ�	r,   c                 ó8   — | j                   j                  |«      S rÈ   )rÿ   rk   rƒ   s     r+   r!   z_AdjointLinearOperator._matvecž  ó   € Ø�v‰v�‰˜qÓ!Ð!r,   c                 ó8   — | j                   j                  |«      S rÈ   )rÿ   r!   rƒ   s     r+   rk   z_AdjointLinearOperator._rmatvec¡  ó   € Ø�v‰v�~‰~˜aÓ Ð r,   c                 ó8   — | j                   j                  |«      S rÈ   )rÿ   rˆ   rƒ   s     r+   r"   z_AdjointLinearOperator._matmat¤  r  r,   c                 ó8   — | j                   j                  |«      S rÈ   )rÿ   r"   rƒ   s     r+   rˆ   z_AdjointLinearOperator._rmatmat§  r  r,   rÈ   ©
rÔ   rá   râ   rã   r9   r!   rk   r"   rˆ   rì   rí   s   @r+   rÞ   rÞ   •  s   ø„ Ù.õò"ò!ò"ö!r,   rÞ   c                   ó<   ‡ — e Zd ZdZdˆ fd„	Zd„ Zd„ Zd„ Zd„ Zˆ xZ	S )rà   z*Transposition of arbitrary Linear Operatorc                 óº   •— g |j                   d d ¢|j                   d   ‘|j                   d   ‘­}t        ‰| �	  |j                  ||«       || _        |f| _        y rý   rþ   r   s       €r+   r9   z"_TransposedLinearOperator.__init__®  r  r,   c                 óœ   — | j                   j                  | j                  j                  | j                   j                  |«      «      «      S rÈ   )r6   Úconjrÿ   rk   rƒ   s     r+   r!   z!_TransposedLinearOperator._matvec´  ó/   € Ø�x‰x�}‰}˜TŸV™VŸ_™_¨T¯X©X¯]©]¸1Ó-=Ó>Ó?Ð?r,   c                 óœ   — | j                   j                  | j                  j                  | j                   j                  |«      «      «      S rÈ   )r6   r  rÿ   r!   rƒ   s     r+   rk   z"_TransposedLinearOperator._rmatvec·  ó/   € Ø�x‰x�}‰}˜TŸV™VŸ^™^¨D¯H©H¯M©M¸!Ó,<Ó=Ó>Ð>r,   c                 óœ   — | j                   j                  | j                  j                  | j                   j                  |«      «      «      S rÈ   )r6   r  rÿ   rˆ   rƒ   s     r+   r"   z!_TransposedLinearOperator._matmatº  r  r,   c                 óœ   — | j                   j                  | j                  j                  | j                   j                  |«      «      «      S rÈ   )r6   r  rÿ   r"   rƒ   s     r+   rˆ   z"_TransposedLinearOperator._rmatmat½  r  r,   rÈ   r  rí   s   @r+   rà   rà   «  s!   ø„ Ù4õò@ò?ò@ö?r,   rà   c                 ó˜   — |€t         n|}|€g }| D ]-  }|€Œt        |d«      sŒ|j                  |j                  «       Œ/ t	        |d|iŽS )z;Returns the promoted dtype from input dtypes and operators.r/   r8   )r
   rŠ   Úappendr/   r   )Ú	operatorsÚdtypesr8   r)   s       r+   Ú
_get_dtyper  Á  sV   € à�j� b€BØ€~ØˆØò %ˆØ‰?œw s¨GÕ4Ø�M‰M˜#Ÿ)™)Õ$ð%ô ˜6Ð) bÑ)Ð)r,   c                   óB   ‡ — e Zd ZdZdˆ fd„	Zd„ Zd„ Zd„ Zd„ Zd„ Z	ˆ xZ
S )	rÂ   zRepresenting ``A + B``c                 óZ  •— t        |t        «      rt        |t        «      st        d«      ‚|j                  �^ }}}|j                  �^ }}}	||f||	fk7  rt        d|› d|› d�«      ‚t	        j
                  ||«      }
||f| _        t        ‰| �!  t        ||g|¬«      g |
¢|‘|‘­|«       y )Nú)both operands have to be a LinearOperatorzcannot add ú and ú: shape mismatchr    )
rh   r   r4   r5   rO   rr   r'   r   r9   r  ©r7   rÿ   ÚBr8   ÚA_broadcast_dimsÚA_MÚA_NÚB_broadcast_dimsÚB_MÚB_Nr   r*   s              €r+   r9   z_SumLinearOperator.__init__Ï  s½   ø€ Ü˜!œ^Ô,´J¸qÄ.Ô4QÜÐHÓIÐIØ&'§g¡gÑ#Ð	˜3 Ø&'§g¡gÑ#Ð	˜3 Ø�ˆ:˜#˜s˜Ò#Ü˜{¨1¨#¨U°1°#Ð5EÐFÓGÐGÜ×/Ñ/Ð0@ÐBRÓSÐØ˜�FˆŒ	Ü‰Ñœ Q¨ F¨rÔ2Ð4QÐ6FÐ4QÈÐ4QÈSÑ4QÐSUÕVr,   c                 ó|   — | j                   d   j                  |«      | j                   d   j                  |«      z   S ©Nr   re   ©r'   rK   rƒ   s     r+   r!   z_SumLinearOperator._matvecÚ  ó3   € Ø�y‰y˜‰|×"Ñ" 1Ó%¨¯	©	°!©×(;Ñ(;¸AÓ(>Ñ>Ð>r,   c                 ó|   — | j                   d   j                  |«      | j                   d   j                  |«      z   S r%  ©r'   r†   rƒ   s     r+   rk   z_SumLinearOperator._rmatvecÝ  ó3   € Ø�y‰y˜‰|×#Ñ# AÓ&¨¯©°1©×)=Ñ)=¸aÓ)@Ñ@Ð@r,   c                 ó|   — | j                   d   j                  |«      | j                   d   j                  |«      z   S r%  ©r'   r˜   rƒ   s     r+   rˆ   z_SumLinearOperator._rmatmatà  r*  r,   c                 ó|   — | j                   d   j                  |«      | j                   d   j                  |«      z   S r%  ©r'   r–   rƒ   s     r+   r"   z_SumLinearOperator._matmatã  r'  r,   c                 óR   — | j                   \  }}|j                  |j                  z   S rÈ   ©r'   rŒ   ©r7   rÿ   r  s      r+   r‰   z_SumLinearOperator._adjointæ  ó!   € Ø�y‰y‰ˆˆ1Ø�s‰s�Q—S‘S‰yÐr,   rÈ   ©rÔ   rá   râ   rã   r9   r!   rk   rˆ   r"   r‰   rì   rí   s   @r+   rÂ   rÂ   Ì  s'   ø„ Ù õ	Wò?òAòAò?ör,   rÂ   c                   óB   ‡ — e Zd ZdZdˆ fd„	Zd„ Zd„ Zd„ Zd„ Zd„ Z	ˆ xZ
S )	r«   zRepresenting ``A @ B``c                 óR  •— t        |t        «      rt        |t        «      st        d«      ‚|j                  �^ }}}|j                  �^ }}}	||k7  rt        d|› d|› d�«      ‚t	        j
                  ||«      }
t        ‰| �  t        ||g|¬«      g |
¢|‘|	‘­|«       ||f| _	        y )Nr  zcannot multiply r  r  r    )
rh   r   r4   r5   ri   rr   r   r9   r  r'   r  s              €r+   r9   z_ProductLinearOperator.__init__î  sµ   ø€ Ü˜!œ^Ô,´J¸qÄ.Ô4QÜÐHÓIÐIØ&'§g¡gÑ#Ð	˜3 Ø&'§g¡gÑ#Ð	˜3 Ø�#Š:ÜÐ/°¨s°%¸°sÐ:JÐKÓLÐLÜ×.Ñ.Ð/?ÐAQÓRÐÜ‰Ñœ Q¨ F¨rÔ2Ð4QÐ6FÐ4QÈÐ4QÈSÑ4QÐSUÔVØ˜�Fˆ�	r,   c                 óv   — | j                   d   j                  | j                   d   j                  |«      «      S r%  r&  rƒ   s     r+   r!   z_ProductLinearOperator._matvecù  ó.   € Ø�y‰y˜‰|×"Ñ" 4§9¡9¨Q¡<×#6Ñ#6°qÓ#9Ó:Ð:r,   c                 óv   — | j                   d   j                  | j                   d   j                  |«      «      S ©Nre   r   r)  rƒ   s     r+   rk   z_ProductLinearOperator._rmatvecü  ó.   € Ø�y‰y˜‰|×#Ñ# D§I¡I¨a¡L×$8Ñ$8¸Ó$;Ó<Ð<r,   c                 óv   — | j                   d   j                  | j                   d   j                  |«      «      S r9  r,  rƒ   s     r+   rˆ   z_ProductLinearOperator._rmatmatÿ  r:  r,   c                 óv   — | j                   d   j                  | j                   d   j                  |«      «      S r%  r.  rƒ   s     r+   r"   z_ProductLinearOperator._matmat  r7  r,   c                 óR   — | j                   \  }}|j                  |j                  z  S rÈ   r0  r1  s      r+   r‰   z_ProductLinearOperator._adjoint  r2  r,   rÈ   r3  rí   s   @r+   r«   r«   ë  s$   ø„ Ù õ	ò;ò=ò=ò;ör,   r«   c                   óB   ‡ — e Zd ZdZdˆ fd„	Zd„ Zd„ Zd„ Zd„ Zd„ Z	ˆ xZ
S )	r¡   zRepresenting ``alpha * A``c                 ó,  •— t        |t        «      st        d«      ‚t        j                  |«      st        d«      ‚t        |t
        «      r|j                  \  }}||z  }t        |g|g|¬«      }t        ‰| �%  ||j                  |«       ||f| _        y )NúLinearOperator expected as Azscalar expected as alphar    )rh   r   r4   ri   Úisscalarr¡   r'   r  r   r9   r5   )r7   rÿ   Úalphar8   Úalpha_originalr/   r*   s         €r+   r9   z_ScaledLinearOperator.__init__  sˆ   ø€ Ü˜!œ^Ô,ÜÐ;Ó<Ð<Ü�{‰{˜5Ô!ÜÐ7Ó8Ð8Ü�aÔ.Ô/Ø !§¡ÑˆAˆ~ð ˜NÑ*ˆEä˜A˜3  ¨BÔ/ˆÜ‰Ñ˜ §¡¨Ô,Ø˜�Jˆ�	r,   c                 ó^   — | j                   d   | j                   d   j                  |«      z  S r9  r&  rƒ   s     r+   r!   z_ScaledLinearOperator._matvec  ó(   € Ø�y‰y˜‰|˜dŸi™i¨™l×1Ñ1°!Ó4Ñ4Ð4r,   c                 óz   — | j                   d   j                  «       | j                   d   j                  |«      z  S r9  )r'   Ú	conjugater†   rƒ   s     r+   rk   z_ScaledLinearOperator._rmatvec   ó1   € Ø�y‰y˜‰|×%Ñ%Ó'¨$¯)©)°A©,×*>Ñ*>¸qÓ*AÑAÐAr,   c                 óz   — | j                   d   j                  «       | j                   d   j                  |«      z  S r9  )r'   rG  r˜   rƒ   s     r+   rˆ   z_ScaledLinearOperator._rmatmat#  rH  r,   c                 ó^   — | j                   d   | j                   d   j                  |«      z  S r9  r.  rƒ   s     r+   r"   z_ScaledLinearOperator._matmat&  rE  r,   c                 óZ   — | j                   \  }}|j                  |j                  «       z  S rÈ   )r'   rŒ   rG  )r7   rÿ   rB  s      r+   r‰   z_ScaledLinearOperator._adjoint)  s%   € Ø—9‘9‰ˆˆ5Ø�s‰s�U—_‘_Ó&Ñ&Ð&r,   rÈ   r3  rí   s   @r+   r¡   r¡   
  s&   ø„ Ù$õò 5òBòBò5ö'r,   r¡   c                   óH   ‡ — e Zd ZdZd	ˆ fd„	Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
ˆ xZS )
r½   zRepresenting ``A ** p``c                 ó0  •— t        |t        «      st        d«      ‚|j                  d   |j                  d   k7  rd|›�}t        |«      ‚t	        |«      r|dk  rt        d«      ‚t
        ‰| �  t        |g|¬«      |j                  |«       ||f| _        y )Nr@  rŽ   rE   z7square core-dimensions of LinearOperator expected, got r   z"non-negative integer expected as pr    )	rh   r   r4   r5   r   r   r9   r  r'   )r7   rÿ   r¿   r8   r~   r*   s        €r+   r9   z_PowerLinearOperator.__init__1  s‰   ø€ Ü˜!œ^Ô,ÜÐ;Ó<Ð<Ø�7‰7�2‰;˜!Ÿ'™' "™+Ò%ØKÈAÈ5ÐQˆCÜ˜S“/Ð!Ü˜Œ|˜q 1šuÜÐAÓBÐBä‰Ñœ Q C¨BÔ/°·±¸"Ô=Ø˜�Fˆ�	r,   c                 óf   — t        |«      }t        | j                  d   «      D ]
  } ||«      }Œ |S )Nre   )r   rX   r'   )r7   Úfunr`   Úresr[   s        r+   Ú_powerz_PowerLinearOperator._power=  s5   € Ü�a‹jˆÜ�t—y‘y ‘|Ó$ò 	ˆAÙ�c“(‰Cð	àˆ
r,   c                 óT   — | j                  | j                  d   j                  |«      S ©Nr   )rQ  r'   rK   rƒ   s     r+   r!   z_PowerLinearOperator._matvecC  ó!   € Ø�{‰{˜4Ÿ9™9 Q™<×.Ñ.°Ó2Ð2r,   c                 óT   — | j                  | j                  d   j                  |«      S rS  )rQ  r'   r†   rƒ   s     r+   rk   z_PowerLinearOperator._rmatvecF  ó!   € Ø�{‰{˜4Ÿ9™9 Q™<×/Ñ/°Ó3Ð3r,   c                 óT   — | j                  | j                  d   j                  |«      S rS  )rQ  r'   r˜   rƒ   s     r+   rˆ   z_PowerLinearOperator._rmatmatI  rV  r,   c                 óT   — | j                  | j                  d   j                  |«      S rS  )rQ  r'   r–   rƒ   s     r+   r"   z_PowerLinearOperator._matmatL  rT  r,   c                 ó>   — | j                   \  }}|j                  |z  S rÈ   r0  )r7   rÿ   r¿   s      r+   r‰   z_PowerLinearOperator._adjointO  s   € Ø�y‰y‰ˆˆ1Ø�s‰s�A‰vˆr,   rÈ   )rÔ   rá   râ   rã   r9   rQ  r!   rk   rˆ   r"   r‰   rì   rí   s   @r+   r½   r½   .  s)   ø„ Ù!õ
òò3ò4ò4ò3ör,   r½   c                   ó0   ‡ — e Zd ZdZdˆ fd„	Zd„ Zd„ Zˆ xZS )ÚMatrixLinearOperatorz8Operator defined by a matrix `A` which implements ``@``.c                 ó|   •— t         ‰| �  |j                  |j                  |«       || _        d | _        |f| _        y rÈ   )r   r9   r/   r5   rÿ   Ú_MatrixLinearOperator__adjr'   )r7   rÿ   r8   r*   s      €r+   r9   zMatrixLinearOperator.__init__W  s3   ø€ Ü‰Ñ˜Ÿ™ !§'¡'¨2Ô.ØˆŒØˆŒ
Ø�Dˆ�	r,   c                 ó    — | j                   |z  S rÈ   )rÿ   r•   s     r+   r"   zMatrixLinearOperator._matmat]  s   € Ø�v‰v˜‰zÐr,   c                 ó~   — | j                   €&t        | j                  | j                  ¬«      | _         | j                   S r¼   )r]  Ú_AdjointMatrixOperatorrÿ   r6   rÅ   s    r+   r‰   zMatrixLinearOperator._adjoint`  s,   € Ø�:‰:ÐÜ/°·±¸4¿8¹8ÔDˆDŒJØ�z‰zÐr,   rÈ   )rÔ   rá   râ   rã   r9   r"   r‰   rì   rí   s   @r+   r[  r[  T  s   ø„ ÙBõòör,   r[  c                   ó*   ‡ — e Zd ZdZdˆ fd„	Zd„ Zˆ xZS )r`  z5Representing ``A.H``, for `MatrixLinearOperator` `A`.c                 ó   •— |€t         n|}|j                  dkD  r0t        |«      rt        j                  |dd«      }n|j
                  }n|j                  }t        ‰| �!  |j                  |«      |¬«       |f| _
        y )Nr   rE   rŽ   r    )r
   r   r   r   Úswapaxesrº   r¸   r   r9   r  r'   )r7   rÿ   r8   ÚA_Tr*   s       €r+   r9   z_AdjointMatrixOperator.__init__i  sg   ø€ Ø˜*�Y¨"ˆØ�6‰6�AŠ:Ü˜Œ{Ü—o‘o a¨¨RÓ0‘à—d‘d‘à—#‘#ˆCÜ‰Ñ˜Ÿ™ ›¨"ÐÔ-Ø�Dˆ�	r,   c                 óJ   — t        | j                  d   | j                  ¬«      S )Nr   r    )r[  r'   r6   rÅ   s    r+   r‰   z_AdjointMatrixOperator._adjointu  s   € Ü# D§I¡I¨a¡L°T·X±XÔ>Ð>r,   rÈ   )rÔ   rá   râ   rã   r9   r‰   rì   rí   s   @r+   r`  r`  f  s   ø„ Ù?õ
ö?r,   r`  c                   ó>   ‡ — e Zd Zdˆ fd„	Zd„ Zd„ Zd„ Zd„ Zd„ Zˆ xZ	S )ÚIdentityOperatorc                 ó(   •— t         ‰| �  |||«       y rÈ   )r   r9   )r7   r5   r/   r8   r*   s       €r+   r9   zIdentityOperator.__init__z  s   ø€ Ü‰Ñ˜  rÕ*r,   c                 ó   — |S rÈ   rf   rƒ   s     r+   r!   zIdentityOperator._matvec}  ó   € Øˆr,   c                 ó   — |S rÈ   rf   rƒ   s     r+   rk   zIdentityOperator._rmatvec€  rj  r,   c                 ó   — |S rÈ   rf   rƒ   s     r+   rˆ   zIdentityOperator._rmatmatƒ  rj  r,   c                 ó   — |S rÈ   rf   rƒ   s     r+   r"   zIdentityOperator._matmat†  rj  r,   c                 ó   — | S rÈ   rf   rÅ   s    r+   r‰   zIdentityOperator._adjoint‰  s   € Øˆr,   ©NN)
rÔ   rá   râ   r9   r!   rk   rˆ   r"   r‰   rì   rí   s   @r+   rg  rg  y  s!   ø„ õ+òòòòör,   rg  c                 óä  — t        | t        «      r| S t        | «      r\t        | t        j                  «      sBt        | «      }t        | «      rt        snt        j                  | d|¬«      } t        | |¬«      S t        | «      rt        | «      S t        | t        j                  «      r3t        j                  t        j                  | «      «      } t        | «      S t        | d«      r~t        | d«      rrd}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`.

    See the `LinearOperator` documentation for additional information.

    Parameters
    ----------
    A : object
        Object to convert to a `LinearOperator`. May be any one of the following types:

        - `numpy.ndarray`
        - `numpy.matrix`
        - `scipy.sparse` array
          (e.g. `~scipy.sparse.csr_array`, `~scipy.sparse.lil_array`, etc.)
        - `LinearOperator`
        - An object with ``.shape`` and ``.matvec`` attributes

    Returns
    -------
    B : LinearOperator
        A `LinearOperator` corresponding with `A`

    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   )r   r8   r    r5   rK   Nr†   r˜   r/   )r†   r˜   r/   ztype not understood)rh   r   r   ri   rj   r   r	   r   rO   Ú
atleast_ndr[  r   Ú
atleast_2drJ   rŠ   r†   r˜   r/   r5   rK   rM   )rÿ   r8   r†   r˜   r/   s        r+   r   r   �  s+  € ôJ �!”^Ô$Øˆô ˜Ô¤:¨a´·±Ô#;Ü˜QÓˆÜ! !Ô$­_Øä—‘˜q q¨RÔ0ˆAÜ# A¨"Ô-Ð-ä�„{Ü# AÓ&Ð&ä�!”R—Y‘YÔÜ�M‰Mœ"Ÿ*™* Q›-Ó(ˆÜ# AÓ&Ð&äˆq�'Ôœw q¨(Ô3ØˆØˆØˆä�1�iÔ Ø—i‘iˆGÜ�1�iÔ Ø—i‘iˆGÜ�1�gÔØ—G‘GˆEÜØ�G‰G�Q—X‘X w¸Àuô
ð 	
ô Ð)Ó
*Ð*r,   ro  )+rã   rn   ræ   r#   Únumpyri   Úscipyr   Úscipy._externalr   rO   Úscipy._lib._array_apir   r   r   r   r	   r
   r   r   r   r   Úscipy.sparser   Úscipy.sparse._sputilsr   r   r   r   Ú__all__r   r   rÞ   rà   r  rÂ   r«   r¡   r½   r[  r`  rg  r   rf   r,   r+   ú<module>rz     sþ   ðñ*óX 
Û Û ã å Ý 2÷÷ ÷ õ "ß RÓ RàÐ/Ð
0€ñ Ó÷Q<ð Q<ó ðQ<ôh6
˜Nô 6
ôr!˜^ô !ô,? ô ?ó,*ô˜ô ô>˜^ô ô>!'˜Nô !'ôH#˜>ô #ôL˜>ô ô$?Ð1ô ?ô&�~ô ñ( ÓñF+ó ñF+r,   