+
    ùª¨jö?  ã                   ó¼   € ^ RI t^ RIHt ^ RIHtHtHtHtH	t	H
t
 ^RIHt ^ RIHt ^ RIHt R.tRR	 lt]! R
R7      RRRRRRRRRRRR^RRRRRRRR/
R ll4       tR# )é    N)ÚLinAlgError)Úget_blas_funcsÚqrÚsolveÚsvdÚ	qr_insertÚlstsq)Ú_get_atol_rtol)Úmake_system)Úxp_capabilitiesÚgcrotmkFc	                ó,	  € Vf   R pVf   R p\        . ROV34      w  ršr¼V.p. pRp\        P                  pV\        V4      ,           p\        P                  ! \        V4      V3VP
                  R7      p\        P                  ! RVP
                  R7      p\        P                  ! RVP
                  R7      p\        P                  ! VP
                  4      P                  pRp\        V4       EFô  pV'       d   V\        V4      8  d   VV,          w  ppMwV'       d   V\        V4      8X  d   V! V4      pRpMTV'       g<   VV\        V4      ,
          8¼  d%   VVV\        V4      ,
          ,
          ,          w  ppMV! VR,          4      pRpVf   V! V ! V4      4      pMVP                  4       pV! V4      p\        V4       F3  w  ppV
! VV4      pVVVV3&   V	! VVVP                  ^ ,          V) 4      pK5  	  \        P                  ! V^,           VP
                  R7      p\        V4       F1  w  ppV
! VV4      pVVV&   V	! VVVP                  ^ ,          V) 4      pK3  	  V! V4      VX^,           &   \        P                  ! RRR7      ;_uu_ 4        ^VR,          ,          pRRR4       \        P                  ! X4      '       d
   V! VV4      pVR,          VV,          8”  g   RpVP                  V4       VP                  V4       \        P                  ! V^,           V^,           3VP
                  R	R
7      pVVRV^,           1RV^,           13&   ^VV^,           V^,           3&   \        P                  ! V^,           V3VP
                  R	R
7      p VV RV^,           1R3&   \!        VV VVRRRR7      w  pp\#        VR,          4      pVV8  g   V'       g   EKõ   M	  \        P                  ! VXV3,          4      '       g   \%        4       h\'        VRV^,           1RV^,           13,          V^ RV^,           13,          P)                  4       4      w  p  p!VRRV^,           13,          pVVVWÞVV3#   + '       g   i     ELà; i)aß  
FGMRES Arnoldi process, with optional projection or augmentation

Parameters
----------
matvec : callable
    Operation A*x
v0 : ndarray
    Initial vector, normalized to nrm2(v0) == 1
m : int
    Number of GMRES rounds
atol : float
    Absolute tolerance for early exit
lpsolve : callable
    Left preconditioner L
rpsolve : callable
    Right preconditioner R
cs : list of (ndarray, ndarray)
    Columns of matrices C and U in GCROT
outer_v : list of ndarrays
    Augmentation vectors in LGMRES
prepend_outer_v : bool, optional
    Whether augmentation vectors come before or after
    Krylov iterates

Raises
------
LinAlgError
    If nans encountered

Returns
-------
Q, R : ndarray
    QR decomposition of the upper Hessenberg H=QR
B : ndarray
    Projections corresponding to matrix C
vs : list of ndarray
    Columns of matrix V
zs : list of ndarray
    Columns of matrix Z
y : ndarray
    Solution to ||H y - e_1||_2 = min!
res : float
    The final (preconditioned) residual norm

Nc                 ó   € V # ©N© ©Úxs   &Ú`C:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\scipy\sparse\linalg\_isolve\_gcrotmk.pyÚlpsolveÚ_fgmres.<locals>.lpsolveB   ó   € ØˆHó    c                 ó   € V # r   r   r   s   &r   ÚrpsolveÚ_fgmres.<locals>.rpsolveE   r   r   )ÚdtypeFÚignore)ÚoverÚdivideTÚF©r   ÚorderºNNNÚcol)ÚwhichÚoverwrite_qruÚcheck_finite©ÚaxpyÚdotÚscalÚnrm2)é   r-   )r-   r   éÿÿÿÿ)r   r.   )r   ÚnpÚnanÚlenÚzerosr   ÚonesÚfinfoÚepsÚrangeÚcopyÚ	enumerateÚshapeÚerrstateÚisfiniteÚappendr   Úabsr   r	   Úconj)"ÚmatvecÚv0ÚmÚatolr   r   ÚcsÚouter_vÚprepend_outer_vr)   r*   r+   r,   ÚvsÚzsÚyÚresÚBÚQÚRr5   Ú	breakdownÚjÚzÚwÚw_normÚiÚcÚalphaÚhcurÚvÚQ2ÚR2Ú_s"   &&&&&&&&&                         r   Ú_fgmresrZ      sñ  € ðb ‚ò	à‚ò	ô +Ò+JÈRÈEÓRÑ€Dˆtà
ˆ€BØ	€BØ€AÜ
�&‰&€Cà	ŒC�‹LÕ€Aô 	�Š”#�b“'˜1� R§X¡XÔ.€Aô 	�Š�˜bŸh™hÔ'€AÜ
�Š�˜rŸx™xÔ(€Aä
�(Š(�2—8‘8Ó
×
 Ñ
 €Cà€Iô �1�Xˆ÷ ˜q¤3 w£<Ô/Ø˜1•:‰DˆA‰qß ¤c¨'£lÔ!2Ù˜“ˆAØ‰Aß  Q¨!¬c°'«lÕ*:Ô%:Ø˜1 ¤C¨£LÕ 0Õ1Õ2‰DˆA‰qá˜˜2�“ˆAØˆAàŠ9Ù™˜q›	Ó"‰Að —‘“ˆAá�a“ˆô ˜b–M‰DˆAˆqÙ˜˜1“IˆEØˆAˆa�ˆc‰FÙ�Q˜˜1Ÿ7™7 1�:¨ vÓ.ŠAñ "ô �xŠx˜˜!� 1§7¡7Ô+ˆÜ˜b–M‰DˆAˆqÙ˜˜1“IˆEØˆD�‰GÙ�Q˜˜1Ÿ7™7 1�:¨ vÓ.ŠAñ "ñ ˜“GˆˆQˆq�S‰	ä�[Š[˜h¨x×8Ö8à�d˜2•h•JˆE÷ 9ô �;Š;�u×ÒÙ�U˜A“ˆAà�R•˜3 �<Ô'ð ˆIà
�	‰	�!ŒØ
�	‰	�!Œô
 �XŠX�q˜•s˜A˜a�C�j¨¯©°sÔ;ˆØˆˆ4ˆAˆa�Cˆ4���1•�ˆ9‰Øˆˆ1ˆQ�3ˆq��sˆ7‰ä�XŠX�q˜•s˜A�h a§g¡g°SÔ9ˆØˆˆ4ˆAˆa�Cˆ4�ˆ6‰
ä˜˜R  q°Ø'+¸%ôA‰ˆˆ1ô �!�D•'‹lˆð �Œ:ŸšÙñW ôZ �;Š;�q˜˜1˜•v×Òä‹mÐô ˜˜$˜1˜Q�3˜$˜t  !¥˜t˜)� a¨¨$¨1¨Q­3¨$¨¥i§n¡nÓ&6Ó7�K€A€qˆ!ˆQà	ˆ!ˆDˆQˆq�SˆDˆ&�	€Aàˆa��B˜A˜sÐ"Ð"÷k 9×8Ð8ús   ÊRÒRT)Únp_onlyÚrtolgñhãˆµøä>rB   g        Úmaxiteriè  ÚMÚcallbackrA   ÚkÚCUÚ	discard_CÚtruncateÚoldestc       
        óî  € \        WW!4      w  rrÑ\        P                  ! V4      P                  4       '       g   \	        R4      hVR9  d   \	        RV: 24      hV P
                  pVP
                  pV
f   . p
V	f   Tp	RRRpppVf   VP                  4       pMW! V4      ,
          p\        . ROVV34      w  ppppV! V4      p\        RVWC4      w  rCV^ 8X  d   TpV^ 3# V'       d   V
 UUu. uF
  w  ppRV3NK  	  uppV
R	&   V
'       Ed¼   V
P                  R
 R7       \        P                  ! V P                  ^ ,          \        V
4      3VP                  RR7      p. p^ pV
'       dD   V
P                  ^ 4      w  ppVf	   V! V4      pVVR	V3&   V^,          pVP                  V4       KK  \!        VRRRR7      w  ppp?\#        VP$                  4      p. p\'        \        V4      4       Fµ  pVVV,          ,          p\'        V4       F7  p V! VVV ,          ,          VVP                  ^ ,          VV V3,          ) 4      pK9  	  \)        VVV3,          4      R\)        VR,          4      ,          8  d    M.V! RVVV3,          ,          V4      pVP                  V4       K·  	  \#        \+        VV4      4      RRR1,          V
R	&   V
'       d`   \        RR.V34      w  ppV
 FG  w  ppV! VV4      p!V! VWÝP                  ^ ,          V!4      pV! VVVP                  ^ ,          V!) 4      pKI  	  \'        V4       EF•  p"Ve	   V! V4       V! V4      p#\-        WCV,          4      p$V#V$8:  d&   V"^ 8”  g	   V
'       d   W! V4      ,
          pV! V4      p#V#V$8:  d   Rp" EM8V\-        V	\        V
4      ,
          ^ 4      ,           p%V
 UUu. uF  w  ppVNK
  	  ppp \/        VVV#,          V%V\-        WCV,          4      V#,          VR7      w  ppp&p'p(p)p*V)V#,          p)T(^ ,          T)^ ,          ,          p+\+        T(R,          T)R,          4       F"  w  p,p!T! T,T+T+P                  ^ ,          T!4      p+K$  	  T&P3                  T)4      p-\+        T
T-4       F(  w  p.p/T.w  ppT! TT+T+P                  ^ ,          T/) 4      p+K*  	  \        P4                  ! RR7      ;_uu_ 4        TP3                  TP3                  T)4      4      p0RRR4       T'^ ,          X0^ ,          ,          p1\+        T'R,          T0R,          4       F"  w  p2p3T! T2T1T1P                  ^ ,          T34      p1K$  	   ^T! T14      ,          p4\        P                  ! T44      '       g   \7        4       h T! T4T14      p1T! T4T+4      p+T! T1T4      p5T! T1TTP                  ^ ,          T5) 4      pT! T+YÝP                  ^ ,          T54      pTR8X  d    \        T
4      T	8¼  d   T
'       d   T
^  K  EM·TR8X  Ed°   \        T
4      T	8¼  EdŸ   T
'       Ed–   \;        TRR1R	3,          P$                  T&P$                  4      P$                  p6\=        T64      w  p7p8p9. p:\?        T7R	RT	^,
          13,          P$                  4       EF  w  pp;T
^ ,          w  ppTT;^ ,          ,          pTT;^ ,          ,          p\+        T
R,          T;R,          4       FC  w  p<p=T<w  p>p?T! T>TTP                  ^ ,          T=4      pT! T?TTP                  ^ ,          T=4      pKE  	  T: FI  w  p>p?T! T>T4      p4T! T>TTP                  ^ ,          T4) 4      pT! T?TTP                  ^ ,          T4) 4      pKK  	  T! T4      p4T! RT4,          T4      pT! RT4,          T4      pT:P                  TT34       EK!  	  T:T
R	&   T
P                  T1T+34       EK˜  	  V
P                  RVP                  4       34       V'       d   V
 U@UAu. uF
  w  p@pARVA3NK  	  upAp@V
R	&   VX"^,           3# u uppi u uppi   \0         d      Kk  i ; i  + '       g   i     ELV; i  \6        \8        3 d     EK2  i ; iu upAp@i )a�  
Solve ``Ax = b`` with the flexible GCROT(m,k) algorithm.

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.,
    `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`` and ``atol=0.0``.
maxiter : int, optional
    Maximum number of iterations.  Iteration will stop after maxiter
    steps even if the specified tolerance has not been achieved. The
    default is ``1000``.
M : {sparse array, ndarray, LinearOperator}, optional
    Preconditioner for `A`.  The preconditioner should approximate the
    inverse of `A`. gcrotmk is a 'flexible' algorithm and the preconditioner
    can vary from iteration to iteration. Effective preconditioning
    dramatically improves the rate of convergence, which implies that
    fewer iterations are needed to reach a given error tolerance.
callback : function, optional
    User-supplied function to call after each iteration.  It is called
    as ``callback(xk)``, where ``xk`` is the current solution vector.
m : int, optional
    Number of inner FGMRES iterations per each outer iteration.
    Default: 20
k : int, optional
    Number of vectors to carry between inner FGMRES iterations.
    According to [2]_, good values are around `m`.
    Default: `m`
CU : list of tuples, optional
    List of tuples ``(c, u)`` which contain the columns of the matrices
    C and U in the GCROT(m,k) algorithm. For details, see [2]_.
    The list given and vectors contained in it are modified in-place.
    If not given, start from empty matrices. The ``c`` elements in the
    tuples can be ``None``, in which case the vectors are recomputed
    via ``c = A u`` on start and orthogonalized as described in [3]_.
discard_C : bool, optional
    Discard the C-vectors at the end. Useful if recycling Krylov subspaces
    for different linear systems.
truncate : {'oldest', 'smallest'}, optional
    Truncation scheme to use. Drop: oldest vectors, or vectors with
    smallest singular values using the scheme discussed in [1,2].
    See [2]_ for detailed comparison.
    Default: 'oldest'

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

    * 0  : successful exit
    * >0 : convergence to tolerance not achieved, number of iterations

References
----------
.. [1] E. de Sturler, ''Truncation strategies for optimal Krylov subspace
       methods'', SIAM J. Numer. Anal. 36, 864 (1999).
.. [2] J.E. Hicken and D.W. Zingg, ''A simplified and flexible variant
       of GCROT for solving nonsymmetric linear systems'',
       SIAM J. Sci. Comput. 32, 172 (2010).
.. [3] M.L. Parks, E. de Sturler, G. Mackey, D.D. Johnson, S. Maiti,
       ''Recycling Krylov subspaces for sequences of linear systems'',
       SIAM J. Sci. Comput. 28, 1651 (2006).

Examples
--------
>>> import numpy as np
>>> from scipy.sparse import csc_array
>>> from scipy.sparse.linalg import gcrotmk
>>> R = np.random.randn(5, 5)
>>> A = csc_array(R)
>>> b = np.random.randn(5)
>>> x, exit_code = gcrotmk(A, b, atol=1e-5)
>>> print(exit_code)
0
>>> np.allclose(A.dot(x), b)
True

z$RHS must contain only finite numbersrd   ÚsmallestzInvalid value for 'truncate': Nr)   r*   r   r#   c                 ó   € V ^ ,          RJ# )r   Nr   )Úcus   &r   Ú<lambda>Úgcrotmk.<locals>.<lambda>@  s   € ˜r !�u¨DÑ0r   )Úkeyr    r!   TÚeconomic)Úoverwrite_aÚmodeÚpivotinggê-�™—q=g      ð?)r   rB   rC   :r-   NNr   )Úinvalid)rd   rf   r(   )r   r   r.   ) r   r/   r;   ÚallÚ
ValueErrorr?   r7   r   r
   ÚsortÚemptyr9   r1   r   Úpopr<   r   ÚlistÚTr6   r=   ÚzipÚmaxrZ   r   r*   r:   ÚFloatingPointErrorÚZeroDivisionErrorr   r   r8   )BÚAÚbÚx0r\   rB   r]   r^   r_   rA   r`   ra   rb   rc   r   r?   Úpsolver)   r*   r+   Úrr,   Úb_normrS   ÚuÚCÚusrN   rK   rL   ÚPrC   Únew_usrR   ÚycÚj_outerÚbetaÚbeta_tolÚmlrJ   rF   rG   rH   ÚpresÚuxrO   Úbyrh   ÚbycÚhyÚcxrV   ÚhycrT   ÚgammaÚDÚWÚsigmaÚVÚnew_CUrP   ÚcupÚwpÚcpÚupÚczÚuzsB   &&&$$$$$$$$$$                                                     r   r   r   º   s±  € ôz ˜!˜bÓ#�G€Aˆä�;Š;�q‹>×Ñ×ÒÜÐ?Ó@Ð@àÐ-Ô-ÜÐ9¸(¹ÐFÓGÐGà�X‰X€FØ�X‰X€Fà	‚zØˆà‚yØˆà˜D $ˆtˆ#€Dà	‚zØ�F‰F‹H‰à��q“	�Mˆä*Ò+JÈQÐPQÈFÓSÑ€Dˆ#ˆt�Tá�!‹W€Fô   	¨6°4Ó>�J€Dà�„{ØˆØ�1ˆvˆçÙ')Ô*¡r™t˜q !�$˜“¡rÒ*ˆˆ1‰÷ 
€rà
�‰Ñ0ˆÔ1ô �HŠH�a—g‘g˜a•j¤# b£'Ð*°!·'±'ÀÔEˆØˆØˆßà—6‘6˜!“9‰DˆAˆqØŠyÙ˜1“I�ØˆAˆa�ˆc‰FØ��FˆAØ�I‰I�aŽLô �Q D¨zÀDÔI‰ˆˆ1ˆaØô �!—#‘#‹Yˆð ˆÜ”s˜2“w–ˆAØ�1�Q•4•ˆAÜ˜1–X�Ù˜˜A˜a�D� 1 a§g¡g¨a¥j°1°Q°q°Sµ6°'Ó:’ñ ä�1�Q�q�S•6‹{˜U¤S¨¨3­£[Õ0Ô0áÙ�S˜˜1˜Q˜3�•Z Ó#ˆAØ�M‰M˜!Öñ  ô ”S˜˜V“_Ó%¡d¨ dÕ+ˆˆ1‰ç	Ü" F¨E ?°Q°DÓ9‰	ˆˆcó ‰DˆAˆqÙ�Q˜“ˆBÙ�Q˜Ÿ7™7 1�: rÓ*ˆAÙ�Q˜˜1Ÿ7™7 1�:¨ sÓ+ŠAñ ô ˜—>ˆàÒÙ�QŒKá�A‹wˆô �t F�]Ó+ˆà�8Ô ¨1¤·à�F˜1“I•ˆAÙ˜“7ˆDà�8ÔØˆGÚà”�Qœ˜R›•[ !Ó$Õ$ˆáÔ™B‘D�A�q‹a™BˆÑð	Ü'.¨vØ/0°­vØ/1Ø7=Ü47¸À6½kÓ4JÈ4Õ4OØ24ô(6Ñ$ˆAˆq�!�R˜˜Q ð ��IˆAð4 ��U�1�Q•4�ZˆÜ˜˜B�  2¥Ö'‰EˆAˆrÙ�a˜˜RŸX™X a�[¨"Ó-ŠBñ (à�U‰U�1‹XˆÜ˜2˜r–{‰GˆB�Ø‰DˆAˆqÙ�a˜˜RŸX™X a�[¨3¨$Ó/ŠBñ #ô
 �[Š[ ×*Ö*Ø—‘�q—u‘u˜Q“x“ˆB÷ +à��U�R˜•U�]ˆÜ˜"˜R�& " R¥&Ö)‰FˆAˆsÙ�a˜˜RŸX™X a�[¨#Ó.ŠBñ *ð
	Ø‘d˜2“h•JˆEÜ—;’;˜u×%Ò%Ü(Ó*Ð*ð &ñ �%˜‹_ˆÙ�%˜‹_ˆñ �B˜“
ˆÙ��Q˜Ÿ™ �
 U FÓ+ˆÙ��QŸ™ �
 EÓ*ˆð �xÔÜ�b“'˜Q”,§2Ø�q’EùØ˜Õ#Ü�2‹w˜!�|§ ä˜!˜C˜R˜C ˜E�(Ÿ*™* a§c¡cÓ*×,Ñ,�Ü! !›f‘��5˜!ð �Ü% a¨¨$¨1¨Q­3¨$¨¥i§k¡k×2‘D�A�qØ˜a�5‘D�A�qØ˜A˜a�D��AØ˜A˜a�D��AÜ#& r¨"¥v¨q°­uÖ#5™˜˜RØ!$™˜˜BÙ   Q¨¯©°­
°BÓ7˜Ù   Q¨¯©°­
°BÓ7šñ $6ó #)™˜˜BÙ # B¨£
˜Ù   Q¨¯©°­
°U°FÓ;˜Ù   Q¨¯©°­
°U°FÓ;šñ #)ñ ! ›G�EÙ˜S �Y¨Ó*�AÙ˜S �Y¨Ó*�Aà—M‘M 1 a &×)ñ) 3ð* ��1‘ð 	�	‰	�2�r�(×ñ{ "ð@ ‡I�Iˆt�Q—V‘V“XÐÔßÙ*,Ô-©"¡  B�$˜“©"Ò-ˆˆ1‰àˆg˜�kˆ>Ðùó +ùó`  øô ô 	ó ð	ú÷D +×*Ð*ûô #Ô$5Ð6ô 	ãð	üój .sI   Ã.`%Ï`+ÏA `1Ó!aÕ*aÖ
aàa1à1aá aáaáa.á-a.)NNr   r   Fr   )Únumpyr/   Únumpy.linalgr   Úscipy.linalgr   r   r   r   r   r	   Ú	iterativer
   Ú!scipy.sparse.linalg._isolve.utilsr   Úscipy._lib._array_apir   Ú__all__rZ   r   r   r   r   Ú<module>r¦      s�   ðó Ý $ç I× IÝ %Ý 9Ý 1ð ˆ+€ôg#ñT ˜Ôñ 4ð ¨bð ¸$ð À$ð ÐQUð ØðØðØ!ðØ-2ðØ=Eôó òr   