+
    ùª¨j  ã                   óv   € ^ RI t^ RIHt ^RIHt ^RIHt R.t]! RR7      RRR	R
RRRRRRRRR/R ll4       t	R# )é    N)Úxp_capabilities)Ú_get_atol_rtol)Úmake_systemÚtfqmrT)Únp_onlyÚrtolgñhãˆµøä>Úatolç        ÚmaxiterÚMÚcallbackÚshowFc               óp  € V P                   p	\        P                  ! V	\        P                  4      '       d   \        p	V P                  V	4      p \        P                  ! VP                   \        P                  4      '       d   VP                  V	4      p\        WW!4      w  rr¡\        P                  P                  V4      R8X  d   VP                  4       p
V
^ 3# V P                  ^ ,          pVf   \        RV^
,          4      pVf   VP                  4       pMWP                  V
4      ,
          pTpVP                  4       pTpVP                  V P                  V4      4      pTpR;p;pp\        P                  ! VP                  4       V4      P                  pTp\        P                   ! V4      pTpV^ 8X  d   V
^ 3# \#        RVWC4      w  pp\%        V4       EF6  pV^,          ^ 8H  pV'       dL   \        P                  ! VP                  4       V4      pVR8X  d   V
R3u # VV,          pVVV,          ,
          pVXV,          ,          pVV^,          V,          V,          V,          ,           p\        P                  P                  V4      V,          p\        P                   ! R^V^,          ,           ,          4      pVVV,          ,          pV^,          V,          pVP                  V4      p V
VV ,          ,          p
Ve	   V! V
4       V\        P                   ! V^,           4      ,          V8  d$   V'       d   \'        RV^,            24       V
^ 3u # V'       g‰   \        P                  ! VP                  4       V4      pVV,          p!VV!V,          ,           pV!V,          V!^,          V,          ,           pVP                  V P                  V4      4      pVV,          pEK  VP                  V P                  X4      4      pTpTpEK9  	  V'       d   \'        RX^,            24       W¥3# )a  
Solve ``Ax = b`` with the Transpose-Free Quasi-Minimal Residual method.

Parameters
----------
A : {sparse array, ndarray, LinearOperator}
    The real or complex N-by-N matrix of the linear system.
    Alternatively, `A` can be a linear operator which can
    produce ``Ax`` using, e.g.,
    `scipy.sparse.linalg.LinearOperator`.
b : {ndarray}
    Right hand side of the linear system. Has shape (N,) or (N,1).
x0 : {ndarray}
    Starting guess for the solution.
rtol, atol : float, optional
    Parameters for the convergence test. For convergence,
    ``norm(b - A @ x) <= max(rtol*norm(b), atol)`` should be satisfied.
    The default is ``rtol=1e-5``, the default for ``atol`` is ``0.0``.
maxiter : int, optional
    Maximum number of iterations.  Iteration will stop after maxiter
    steps even if the specified tolerance has not been achieved.
    Default is ``min(10000, ndofs * 10)``, where ``ndofs = A.shape[0]``.
M : {sparse array, ndarray, LinearOperator}
    Inverse of the preconditioner of A.  M should approximate the
    inverse of A and be easy to solve for (see Notes).  Effective
    preconditioning dramatically improves the rate of convergence,
    which implies that fewer iterations are needed to reach a given
    error tolerance.  By default, no preconditioner is used.
callback : function, optional
    User-supplied function to call after each iteration.  It is called
    as ``callback(xk)``, where ``xk`` is the current solution vector.
show : bool, optional
    Specify ``show = True`` to show the convergence, ``show = False`` is
    to close the output of the convergence.
    Default is `False`.

Returns
-------
x : ndarray
    The converged solution.
info : int
    Provides convergence information:

    - 0  : successful exit
    - >0 : convergence to tolerance not achieved, number of iterations
    - <0 : illegal input or breakdown

Notes
-----
The Transpose-Free QMR algorithm is derived from the CGS algorithm.
However, unlike CGS, the convergence curves for the TFQMR method is
smoothed by computing a quasi minimization of the residual norm. The
implementation supports left preconditioner, and the "residual norm"
to compute in convergence criterion is actually an upper bound on the
actual residual norm ``||b - Axk||``.

References
----------
.. [1] R. W. Freund, A Transpose-Free Quasi-Minimal Residual Algorithm for
       Non-Hermitian Linear Systems, SIAM J. Sci. Comput., 14(2), 470-482,
       1993.
.. [2] Y. Saad, Iterative Methods for Sparse Linear Systems, 2nd edition,
       SIAM, Philadelphia, 2003.
.. [3] C. T. Kelley, Iterative Methods for Linear and Nonlinear Equations,
       number 16 in Frontiers in Applied Mathematics, SIAM, Philadelphia,
       1995.

Examples
--------
>>> import numpy as np
>>> from scipy.sparse import csc_array
>>> from scipy.sparse.linalg import tfqmr
>>> A = csc_array([[3, 2, 0], [1, -1, 0], [0, 5, 1]], dtype=float)
>>> b = np.array([2, 4, -1], dtype=float)
>>> x, exitCode = tfqmr(A, b, atol=0.0)
>>> print(exitCode)            # 0 indicates successful convergence
0
>>> np.allclose(A.dot(x), b)
True
r
   i'  r   g      ð?z:TFQMR: Linear solve converged due to reach TOL iterations z@TFQMR: Linear solve not converged due to reach MAXIT iterations éÿÿÿÿ)ÚdtypeÚnpÚ
issubdtypeÚint64ÚfloatÚastyper   ÚlinalgÚnormÚcopyÚshapeÚminÚmatvecÚinnerÚ	conjugateÚrealÚsqrtr   ÚrangeÚprint)"ÚAÚbÚx0r   r	   r   r   r   r   r   ÚxÚndofsÚrÚuÚwÚrstarÚvÚuhatÚdÚthetaÚetaÚrhoÚrhoLastÚr0normÚtauÚ_ÚiterÚevenÚvtrstarÚalphaÚuNextÚcÚzÚbetas"   &&&$$$$$$                         Ú]C:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\scipy\sparse\linalg\_isolve\tfqmr.pyr   r      sY  € ðj �G‰G€EÜ	‡}‚}�UœBŸH™H×%Ò%ÜˆØ�H‰H�U‹OˆÜ	‡}‚}�Q—W‘WœbŸh™h×'Ò'Ø�H‰H�U‹Oˆä˜Q 2Ó)�J€Aˆ!ô 
‡y�y‡~�~�aÓ˜BÔØ�F‰F‹HˆØ�1ˆvˆà�G‰G�A�J€EØ‚Ü�e˜U R�ZÓ(ˆà	‚zØ�F‰F‹H‰à—‘˜“�OˆØ	€AØ	�‰‹€Aà€EØ	�‰�—‘˜!“Ó€AØ€DØÐ€AÐˆ�ä
�(Š(�5—?‘?Ó$ aÓ
(×
-Ñ
-€CØ€GÜ�WŠW�S‹\€FØ
€CØ�„{Ø�1ˆvˆô ˜W f¨dÓ9�G€Dˆ!ä�g—ˆØ�a�x˜1‰}ˆßÜ—h’h˜uŸ™Ó0°!Ó4ˆGà˜"Œ}Ø˜2�w’Ø˜'•MˆEØ˜ �	•MˆEØ	ˆU�T�\ÕˆØ�˜•˜EÕ! SÕ(¨1Õ,Õ,ˆä—	‘	—‘˜qÓ! CÕ'ˆÜ�GŠG�B˜!˜e Q�h�,Õ'Ó(ˆØˆu�q�yÕˆà�!�t�u�nˆØ�H‰H�Q‹KˆØ	ˆS�1�W�ˆàÒÙ�QŒKð ”—’˜˜a�“Õ  4Ô'ßÜð $Ø$(¨¥F 8ð-ô .à�q�6ŠMçä—(’(˜5Ÿ?™?Ó,¨aÓ0ˆCØ˜•=ˆDØ�D˜1•H•ˆAØ�t•˜t Q�w¨!�mÕ+ˆAØ—8‘8˜AŸH™H Q›KÓ(ˆDØ��I‹Aà—8‘8˜AŸH™H U›OÓ,ˆDØˆAØ‹GñS ÷V 	Üð Ø  �F˜8ð%ô 	&àˆ<Ðó    )N)
Únumpyr   Úscipy._lib._array_apir   Ú	iterativer   Úutilsr   Ú__all__r   © r?   r>   Ú<module>rF      sg   ðÛ å 1Ý %Ý ð ˆ)€ñ ˜Ôñj ð j¨Bð j¸ð jÀð jØðjØ#ôjó òjr?   