+
    Y°³jÈÌ  ã                   ót  € ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIHtHtHt ^ RI	H
t
HtHtHtHtHt ^ RIt^ RIt^ RI	Ht ^ RIHtHt ^ RIHt ^RIHtHt ^ RI Ht ^ R	IHt ^ R
IH t  . R;Ot! ! R R]"4      t#R t$R t%R t&R t'](! ]! R4      PS                  4       ]! R4      PS                  4       R7      t*R t+R t,R<R  lt-]+! ]-4       R=R! lt. ! R" R#4      t/ ! R$ R%4      t0 ! R& R4      t1R' t2 ! R( R)]04      t3 ! R* R+4      t4]! R,4      PS                  4       ]*R-&    ! R. R]34      t5 ! R/ R0]54      t6 ! R1 R2]34      t7 ! R3 R4]34      t8 ! R5 R6]34      t9 ! R7 R8]34      t: ! R9 R]04      t;R: t<]<! R]54      t=]<! R]64      t>]<! R]74      t?]<! R]94      t@]<! R]84      tA]<! R]:4      tB]<! R];4      tC],! ]54       ],! ];4       R# )>é    N)ÚasarrayÚdotÚvdot)ÚnormÚsolveÚinvÚqrÚsvdÚLinAlgError)Úget_blas_funcs)Úcopy_if_neededÚ_dedent_for_py313)Úgetfullargspec_no_self)Úscalar_search_wolfe1Úscalar_search_armijo)Ú	signature)Úget_close_matches)ÚGenericAliasÚbroyden1Úbroyden2ÚandersonÚlinearmixingÚdiagbroydenÚexcitingmixingÚnewton_krylovÚBroydenFirstÚKrylovJacobianÚInverseJacobianÚNoConvergencec                   ó   € ] tR t^"tRtRtR# )r   zXException raised when nonlinear solver fails to converge within the specified
`maxiter`.© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__static_attributes__r!   ó    ÚW/home/luca/screen-checking/.venv/lib/python3.14/site-packages/scipy/optimize/_nonlin.pyr   r   "   s
   † ñãr(   c                 óJ   € \         P                  ! V 4      P                  4       # ©N)ÚnpÚabsoluteÚmax©Úxs   &r)   Úmaxnormr1   (   s   € Ü�;Š;�q‹>×ÑÓÐr(   c                ó¼   € \        V 4      p \        P                  ! V P                  \        P                  4      '       g   \        V \        P
                  R7      # V # )z:Return `x` as an array, of either floats or complex floats©Údtype)r   r,   Ú
issubdtyper4   ÚinexactÚfloat64r/   s   &r)   Ú_as_inexactr8   ,   s:   € ä�‹
€AÜ�=Š=˜Ÿ™¤"§*¡*×-Ò-Ü�q¤§
¡
Ô+Ð+Ø€Hr(   c                ó–   € \         P                  ! V \         P                  ! V4      4      p \        VRV P                  4      pV! V 4      # )z;Return ndarray `x` as same array subclass and shape as `x0`Ú__array_wrap__)r,   ÚreshapeÚshapeÚgetattrr:   )r0   Úx0Úwraps   && r)   Ú_array_liker@   4   s8   € ä
�
Š
�1”b—h’h˜r“lÓ#€AÜ�2Ð'¨×)9Ñ)9Ó:€DÙ�‹7€Nr(   c                 ó´   € \         P                  ! V 4      P                  4       '       g%   \         P                  ! \         P                  4      # \        V 4      # r+   )r,   ÚisfiniteÚallÚarrayÚinfr   )Úvs   &r)   Ú
_safe_normrG   ;   s5   € Ü�;Š;�q‹>×Ñ×ÒÜ�xŠxœŸ™ÓÐÜ�‹7€Nr(   z´
    F : function(x) -> f
        Function whose root to find; should take and return an array-like
        object.
    xin : array_like
        Initial guess for the solution
    a€  
    iter : int, optional
        Number of iterations to make. If omitted (default), make as many
        as required to meet tolerances.
    verbose : bool, optional
        Print status to stdout on every iteration.
    maxiter : int, optional
        Maximum number of iterations to make. If more are needed to
        meet convergence, `NoConvergence` is raised.
    f_tol : float, optional
        Absolute tolerance (in max-norm) for the residual.
        If omitted, default is 6e-6.
    f_rtol : float, optional
        Relative tolerance for the residual. If omitted, not used.
    x_tol : float, optional
        Absolute minimum step size, as determined from the Jacobian
        approximation. If the step size is smaller than this, optimization
        is terminated as successful. If omitted, not used.
    x_rtol : float, optional
        Relative minimum step size. If omitted, not used.
    tol_norm : function(vector) -> scalar, optional
        Norm to use in convergence check. Default is the maximum norm.
    line_search : {None, 'armijo' (default), 'wolfe'}, optional
        Which type of a line search to use to determine the step size in the
        direction given by the Jacobian approximation. Defaults to 'armijo'.
    callback : function, optional
        Optional callback function. It is called on every iteration as
        ``callback(x, f)`` where `x` is the current solution and `f`
        the corresponding residual.

    Returns
    -------
    sol : ndarray
        An array (of similar array type as `x0`) containing the final solution.

    Raises
    ------
    NoConvergence
        When a solution was not found.

    )Úparams_basicÚparams_extrac                 óf   € V P                   '       d   V P                   \        ,          V n         R # R # r+   )r&   Ú
_doc_parts)Úobjs   &r)   Ú_set_docrM   y   s    € Ø
‡{‡{€{Ø—k‘k¤JÕ.ˆŽñ r(   c                 óš   € V P                   '       d9   \        P                  4       pR VR&   R VR&   V P                   V,          V n         R# R# )Ú rH   rI   N)r&   rK   Úcopy)rL   Ú	doc_partss   & r)   Ú_set_doc_classrR   ~   s@   € Ø
‡{‡{€{Ü—O‘OÓ%ˆ	Ø$&ˆ	�.Ñ!Ø$&ˆ	�.Ñ!Ø—k‘k IÕ-ˆŽñ	 r(   c                óü  a a€ V
f   \         MT
p
\        WgW‰W:R7      p\        S4      oV V3R lpSP                  4       p\        P
                  ! V\        P                  4      pV! V4      p\        V4      p\        V4      pVP                  VP                  4       VV4       Vf)   Ve   V^,           pM^dVP                  ^,           ,          pVRJ d   RpMVRJ d   RpVR9  d   \        R4      hRpR	pR
pRp\        V4       EF�  pVP                  VVV4      pV'       d    EM‘\        VVV,          4      pVP!                  VVR7      ) p\        V4      ^ 8X  d   \        R4      hV'       d   \#        VVVVV4      w  ppppMRpVV,           pV! V4      p\        V4      pVP%                  VP                  4       V4       V'       d
   V! VV4       VV^,          ,          V^,          ,          pVV^,          ,          V8  d   \        VV4      pM$\        V\'        VVV^,          ,          4      4      pTpV'       g   EKA  \(        P*                  P-                  V RV
! V4      R RVR R24       \(        P*                  P/                  4        EK’  	  V'       d   \1        \3        VS4      4      h^pV'       d3   RVP4                  RVRVRV^8H  R^R^R/V,          /p\3        VS4      V3# \3        VS4      # )a>  
Find a root of a function, in a way suitable for large-scale problems.

Parameters
----------
%(params_basic)s
jacobian : Jacobian
    A Jacobian approximation: `Jacobian` object or something that
    `asjacobian` can transform to one. Alternatively, a string specifying
    which of the builtin Jacobian approximations to use:

        krylov, broyden1, broyden2, anderson
        diagbroyden, linearmixing, excitingmixing

%(params_extra)s
full_output : bool
    If true, returns a dictionary `info` containing convergence
    information.
raise_exception : bool
    If True, a `NoConvergence` exception is raise if no solution is found.

See Also
--------
asjacobian, Jacobian

Notes
-----
This algorithm implements the inexact Newton method, with
backtracking or full line searches. Several Jacobian
approximations are available, including Krylov and Quasi-Newton
methods.

References
----------
.. [KIM] C. T. Kelley, "Iterative Methods for Linear and Nonlinear
   Equations". Society for Industrial and Applied Mathematics. (1995)
   https://archive.siam.org/books/kelley/fr16/

N)Úf_tolÚf_rtolÚx_tolÚx_rtolÚiterr   c                 óV   <€ \        S! \        V S4      4      4      P                  4       # r+   )r8   r@   Úflatten)ÚzÚFr>   s   &€€r)   ÚfuncÚnonlin_solve.<locals>.func¹   s#   ø€ Ü™1œ[¨¨BÓ/Ó0Ó1×9Ñ9Ó;Ð;r(   TÚarmijoFzInvalid line searchgÍÌÌÌÌÌì?g§èH.ÿï?gš™™™™™¹?gü©ñÒMbP?)Útolz[Jacobian inversion yielded zero vector. This indicates a bug in the Jacobian approximation.ç      ð?z:  |F(x)| = Úgz; step Ú
ÚnitÚfunÚstatusÚsuccessÚmessagez0A solution was found at the specified tolerance.z:The maximum number of iterations allowed has been reached.)Nr_   Úwolfe)r1   ÚTerminationConditionr8   rZ   r,   Ú	full_likerE   r   Ú
asjacobianÚsetuprP   ÚsizeÚ
ValueErrorÚrangeÚcheckÚminr   Ú_nonlin_line_searchÚupdater.   ÚsysÚstdoutÚwriteÚflushr   r@   Ú	iteration) r\   r>   ÚjacobianrX   ÚverboseÚmaxiterrT   rU   rV   rW   Útol_normÚline_searchÚcallbackÚfull_outputÚraise_exceptionÚ	conditionr]   r0   ÚdxÚFxÚFx_normÚgammaÚeta_maxÚeta_tresholdÚetaÚnrf   r`   ÚsÚFx_norm_newÚeta_AÚinfos    ff&&&&&&&&&&&&&                 r)   Únonlin_solver�   †   sá  ù€ ðZ #Ò*�w°€HÜ$¨5Ø+0Ø*.ô?€Iô 
�R‹€Bö<à
�
‰
‹€Aä	�Š�aœŸ™Ó	 €BÙ	ˆa‹€BÜ�2‹h€Gä˜(Ó#€HØ‡N�N�1—6‘6“8˜R Ô&à‚ØÒØ˜Q•h‰Gà˜1Ÿ6™6 !�8•nˆGà�dÓØ‰Ø	˜Ó	ØˆàÐ3Ô3ÜÐ.Ó/Ð/ð €EØ€GØ€LØ
€Cä�7�^ˆØ—‘  Q¨Ó+ˆßÚô �#�s˜7•{Ó#ˆØ�n‰n˜R SˆnÓ)Ð)ˆä�‹8�qŒ=Üð .ó /ð /÷
 Ü$7¸¸aÀÀRØ8Có%EÑ!ˆAˆq�"‘kð ˆAØ�B•ˆAÙ�a“ˆBÜ˜r›(ˆKà�‰˜Ÿ™› "Ô%çÙ�Q˜ŒOð ˜ Q�Õ&¨°!­Õ3ˆØ�3˜•6�>˜LÔ(Ü�g˜uÓ%‰Cä�gœs 5¨%°°Qµ­,Ó7Ó8ˆCàˆ÷ Š7Ü�J‰J×Ñ ˜s ,©x¸«|¸AÐ.>¸gÀaÈÀUÈ"ÐMÔNÜ�J‰J×Ñ×ñS ÷V Ü¤¨A¨rÓ 2Ó3Ð3àˆFçØ�y×*Ñ*Ø�rØ˜&Ø˜6 Q™;Ø˜Að  ,àð  3ðð %õ	&ð		ˆô ˜1˜bÓ! 4Ð'Ð'ä˜1˜bÓ!Ð!r(   c                 óÄ  a aaaaaaaa€ ^ .oV.o\        V4      ^,          .o\        S4      \        S4      ,          oR	VV VVVV3R lloVVV3R lpVR8X  d   \        SVS^ ,          RVR7      w  r‰p
M'VR8X  d!   \        SS^ ,          S^ ,          ) VR7      w  r‰Xf   RpSVS,          ,           oVS^ ,          8X  d   S^ ,          pMS ! S4      p\        V4      pVSW+3# )
r   c                 ó¸   <€ V S	^ ,          8X  d
   S^ ,          # S
V S,          ,           pS! V4      p\        V4      ^,          pV'       d   V S	^ &   VS^ &   VS^ &   V# ©r   )rG   )r‹   ÚstoreÚxtrF   Úprƒ   r]   Útmp_FxÚtmp_phiÚtmp_sr0   s   &&   €€€€€€r)   ÚphiÚ _nonlin_line_search.<locals>.phi"  s_   ø€ Ø��a•Œ=Ø˜1•:ÐØ��2•�XˆÙ�‹HˆÜ�q‹M˜1ÕˆßØˆE�!‰HØˆG�A‰JØˆF�1‰IØˆr(   c                 óŒ   <€ \        V 4      S,           ^,           S,          pS! W,           RR7      S! V 4      ,
          V,          # )é   F)r“   )Úabs)r‹   Údsr™   ÚrdiffÚs_norms   & €€€r)   ÚderphiÚ#_nonlin_line_search.<locals>.derphi.  s7   ø€ Ü�!‹f�v�o Õ! UÕ*ˆÙ�A•D Ô&©¨Q«Õ/°2Õ5Ð5r(   ri   ç{®Gáz„?)ÚxtolÚaminr_   )r¥   ra   )T)r   r   r   )r]   r0   r„   rƒ   Úsearch_typerŸ   Úsminr¡   r‹   Úphi1Úphi0r…   r™   r    r–   r—   r˜   s   ff&f&f&     @@@@@r)   rs   rs     sß   ÿø€ àˆC€EØˆT€FÜ�B‹x˜�{ˆm€GÜ�!‹W”t˜B“xÕ€F÷
ô 
÷6ð �gÔÜ,¨S°&¸'À!½*Ø26¸TôC‰ˆ‘à	˜Ô	 Ü& s¨G°A­J¸À½¸Ø,0ô2‰ˆð 	‚yð ˆà	ˆAˆb�D�€AØˆE�!�H„}Ø�A�Y‰á�!‹WˆÜ�2‹h€Gàˆa�ÐÐr(   c                   ó@   a € ] tR tRt o RtRRRRR]3R ltR tRtV t	R# )rj   iH  z•
Termination condition for an iteration. It is terminated if

- |F| < f_rtol*|F_0|, AND
- |F| < f_tol

AND

- |dx| < x_rtol*|x|, AND
- |dx| < x_tol

Nc                óT  € Vf6   \         P                  ! \         P                  4      P                  R,          pVf   \         P                  pVf   \         P                  pVf   \         P                  pW0n        W@n        Wn        W n        W`n	        WPn
        R V n        ^ V n        R # )NgUUUUUUÕ?)r,   Úfinfor7   ÚepsrE   rV   rW   rT   rU   r   rX   Úf0_normry   )ÚselfrT   rU   rV   rW   rX   r   s   &&&&&&&r)   Ú__init__ÚTerminationCondition.__init__U  s|   € ð Š=Ü—H’HœRŸZ™ZÓ(×,Ñ,°Õ6ˆEØŠ>Ü—V‘VˆFØŠ=Ü—F‘FˆEØŠ>Ü—V‘VˆFàŒ
ØŒØŒ
ØŒàŒ	àŒ	àˆŒØˆŽr(   c                ó  € V ;P                   ^,          un         V P                  V4      pV P                  V4      pV P                  V4      pV P                  f   W@n        V^ 8X  d   ^# V P                  e!   ^V P                   V P                  8„  ,          # \	        W@P
                  8*  ;'       dS    W@P                  ,          V P                  8*  ;'       d,    W`P                  8*  ;'       d    W`P                  ,          V8*  4      # )rœ   )	ry   r   r®   rX   ÚintrT   rU   rV   rW   )r¯   Úfr0   rƒ   Úf_normÚx_normÚdx_norms   &&&&   r)   rq   ÚTerminationCondition.checkm  sÔ   € Ø�Š˜!Õ�Ø—‘˜1“ˆØ—‘˜1“ˆØ—)‘)˜B“-ˆà�<‰<ÒØ!ŒLà�QŒ;Ùà�9‰9Ò à˜Ÿ™¨¯©Ñ2Õ3Ð3ô �FŸj™jÑ(÷ ;ð ;ØŸ{™{Õ*¨d¯l©lÑ:÷;ð ;à§:¡:Ñ-÷ :ð :Ø#§K¡KÕ/°6Ñ9ó<ð 	<r(   )r®   rU   rT   rX   ry   r   rW   rV   )
r"   r#   r$   r%   r&   r1   r°   rq   r'   Ú__classdictcell__©Ú__classdict__s   @r)   rj   rj   H  s)   ø‡ € ñð "¨$°dÀ4Ø ô÷0<ð <r(   rj   c                   ób   a € ] tR tRt o Rt]! ]4      tR tR t	RR lt
R tR tV 3R ltR	tV tR
# )ÚJacobianiˆ  a.  
Common interface for Jacobians or Jacobian approximations.

The optional methods come useful when implementing trust region
etc., algorithms that often require evaluating transposes of the
Jacobian.

Methods
-------
solve
    Returns J^-1 * v
update
    Updates Jacobian to point `x` (where the function has residual `Fx`)

matvec : optional
    Returns J * v
rmatvec : optional
    Returns A^H * v
rsolve : optional
    Returns A^-H * v
matmat : optional
    Returns A * V, where V is a dense matrix with dimensions (N,K).
todense : optional
    Form the dense Jacobian matrix. Necessary for dense trust region
    algorithms, and useful for testing.

Attributes
----------
shape
    Matrix dimensions (M, N)
dtype
    Data type of the matrix.
func : callable, optional
    Function the Jacobian corresponds to

c                óÊ   € . ROpVP                  4        F1  w  r4W29  d   \        RV 24      hVf   K  \        WW,          4       K3  	  \        V R4      '       d   RR lpR# R# )r   ÚtodensezUnknown keyword argument Nc                 óF   € Ve   \        RV 24      hV P                  4       # )Nz`dtype` must be None, was )ro   r¿   )r¯   r4   rP   s   &&&r)   Ú	__array__Ú$Jacobian.__init__.<locals>.__array__¼  s'   € ØÒ$Ü$Ð'AÀ%ÀÐ%IÓJÐJØ—|‘|“~Ð%r(   )	r   rt   ÚmatvecÚrmatvecÚrsolveÚmatmatr¿   r<   r4   ©NN)Úitemsro   ÚsetattrÚhasattr)r¯   ÚkwÚnamesÚnameÚvaluerÁ   s   &,    r)   r°   ÚJacobian.__init__±  s_   € ò8ˆàŸ8™8ž:‰KˆDØÔ Ü Ð#<¸T¸FÐ!CÓDÐDØÔ Ü˜ B¥HÖ-ñ	 &ô �4˜×#Ò#ö&ñ $r(   c                ó   € \        V 4      # r+   )r   ©r¯   s   &r)   ÚaspreconditionerÚJacobian.aspreconditionerÁ  s   € Ü˜tÓ$Ð$r(   c               ó   € \         hr+   ©ÚNotImplementedError©r¯   rF   r`   s   ""&r)   r   ÚJacobian.solveÄ  ó   € Ü!Ð!r(   c               ó   € R # r+   r!   ©r¯   r0   r\   s   """r)   rt   ÚJacobian.updateÇ  ó   € Ùr(   c               óä   € W0n         VP                  VP                  3V n        VP                  V n        V P                  P
                  \        P
                  J d   V P                  W4       R # R # r+   )r]   rn   r<   r4   Ú	__class__rm   r½   rt   ©r¯   r0   r\   r]   s   """"r)   rm   ÚJacobian.setupÊ  sM   € ØŒ	Ø—f‘f˜aŸf™fÐ%ˆŒ
Ø—W‘WˆŒ
Ø�>‰>×Ñ¤8§>¡>Ó1à�K‰K˜Öñ 2r(   c                ó&   <€ V ^8„  d   Qh/ S[ ;R&   # ©é   Ú__class_getitem__©Úclassmethod)Úformatr»   s   "€r)   Ú__annotate__ÚJacobian.__annotate__ˆ  s   ø‡ ‚ ñN #Ñ>òO r(   )r4   r]   r<   Nr’   )r"   r#   r$   r%   r&   rç   r   rå   r°   rÒ   r   rt   rm   Ú__annotate_func__r'   r¹   rº   s   @r)   r½   r½   ˆ  s9   ø‡ € ñ#ñL &1°Ó%>Ðò&ò %ô"òò÷E ƒ r(   r½   c                   óf   a € ] tR tRt o Rt]! ]4      tR t]	R 4       t
]	R 4       tV 3R ltRtV tR# )	r   iÓ  aG  
A simple wrapper that inverts the Jacobian using the `solve` method.

.. legacy:: class

    See the newer, more consistent interfaces in :mod:`scipy.optimize`.

Parameters
----------
jacobian : Jacobian
    The Jacobian to invert.

Attributes
----------
shape
    Matrix dimensions (M, N)
dtype
    Data type of the matrix.

c                óæ   € Wn         VP                  V n        VP                  V n        \	        VR 4      '       d   VP
                  V n        \	        VR4      '       d   VP                  V n        R# R# )rm   rÅ   N)rz   r   rÃ   rt   rÊ   rm   rÅ   rÄ   )r¯   rz   s   &&r)   r°   ÚInverseJacobian.__init__ì  sR   € Ø ŒØ—n‘nˆŒØ—o‘oˆŒÜ�8˜W×%Ò%Ø!Ÿ™ˆDŒJÜ�8˜X×&Ò&Ø#Ÿ?™?ˆDŽLñ 'r(   c                ó.   € V P                   P                  # r+   )rz   r<   rÑ   s   &r)   r<   ÚInverseJacobian.shapeõ  ó   € à�}‰}×"Ñ"Ð"r(   c                ó.   € V P                   P                  # r+   )rz   r4   rÑ   s   &r)   r4   ÚInverseJacobian.dtypeù  rñ   r(   c                ó&   <€ V ^8„  d   Qh/ S[ ;R&   # rã   ræ   )rè   r»   s   "€r)   ré   ÚInverseJacobian.__annotate__Ó  s   ø‡ ‚ ñ. #Ñ>ò/ r(   )rz   rÃ   rÄ   rm   rt   N)r"   r#   r$   r%   r&   rç   r   rå   r°   Úpropertyr<   r4   rë   r'   r¹   rº   s   @r)   r   r   Ó  sL   ø‡ € ññ, &1°Ó%>Ðò+ð ñ#ó ð#ð ñ#ó ð#÷O ƒ r(   c                óü  a a€ \         P                  P                  P                  o\	        S \
        4      '       d   S # \        P                  ! S 4      '       d   \        S \
        4      '       d   S ! 4       # \	        S \        P                  4      '       d´   S P                  ^8”  d   \        R4      h\        P                  ! \        P                  ! S 4      4      o S P                  ^ ,          S P                  ^,          8w  d   \        R4      h\        V 3R lV 3R lRV 3R llRV 3R llS P                   S P                  R7      # \         P                  P#                  S 4      '       dp   S P                  ^ ,          S P                  ^,          8w  d   \        R4      h\        V 3R	 lV 3R
 lRV V3R llRV V3R llS P                   S P                  R7      # \%        S R4      '       dˆ   \%        S R4      '       dv   \%        S R4      '       dd   \        \'        S R4      \'        S R4      S P(                  \'        S R4      \'        S R4      \'        S R4      S P                   S P                  R7      # \+        S 4      '       d    ! V V3R lR\
        4      pV! 4       # \	        S \,        4      '       d;   \/        \0        \2        \4        \6        \8        \:        \<        R7      S ,          ! 4       # \?        R4      h)z=
Convert given object to one suitable for use as a Jacobian.
zarray must have rank <= 2zarray must be squarec                 ó   <€ \        SV 4      # r+   )r   ©rF   ÚJs   &€r)   Ú<lambda>Úasjacobian.<locals>.<lambda>  s   ø€ ¬¨Q°¬r(   c                 óL   <€ \        SP                  4       P                  V 4      # r+   )r   ÚconjÚTrù   s   &€r)   rû   rü     s   ø€ ¬#¨a¯f©f«h¯j©j¸!Ô*<r(   c                 ó   <€ \        SV 4      # r+   )r   ©rF   r`   rú   s   &&€r)   rû   rü     s   ø€ ¬u°Q¸¬{r(   c                 óL   <€ \        SP                  4       P                  V 4      # r+   )r   rþ   rÿ   r  s   &&€r)   rû   rü     s   ø€ ´°a·f±f³h·j±jÀ!Ô0Dr(   )rÃ   rÄ   r   rÅ   r4   r<   zmatrix must be squarec                 ó   <€ SV ,          # r+   r!   rù   s   &€r)   rû   rü     s	   ø€ ¨¨Q®r(   c                 óF   <€ SP                  4       P                  V ,          # r+   ©rþ   rÿ   rù   s   &€r)   rû   rü     s   ø€ ¨!¯&©&«(¯*©*°q®.r(   c                 ó   <€ S! SV 4      # r+   r!   ©rF   r`   rú   Úspsolves   &&€€r)   rû   rü     s   ø€ ©w°q¸!¬}r(   c                 óF   <€ S! SP                  4       P                  V 4      # r+   r  r  s   &&€€r)   rû   rü     s   ø€ ±¸¿¹»¿
¹
ÀAÔ0Fr(   r<   r4   r   rÃ   rÄ   rÅ   rt   rm   )rÃ   rÄ   r   rÅ   rt   rm   r4   r<   c                   ód   <a € ] tR tRt o R tR	VV3R lltV3R ltR	VV3R lltV3R ltRt	V t
R# )
Úasjacobian.<locals>.Jaci&  c                ó   € Wn         R # r+   r/   rÛ   s   &&&r)   rt   Úasjacobian.<locals>.Jac.update'  s   € Ø–r(   c                óî   <€ S! V P                   4      p\        V\        P                  4      '       d   \	        W14      # \
        P                  P                  V4      '       d	   S! W14      # \        R 4      h©zUnknown matrix type)	r0   Ú
isinstancer,   Úndarrayr   ÚscipyÚsparseÚissparsero   ©r¯   rF   r`   Úmrú   r  s   &&& €€r)   r   Úasjacobian.<locals>.Jac.solve*  sV   ø€ Ù�d—f‘f“I�Ü˜a¤§¡×,Ò,Ü  ›;Ð&Ü—\‘\×*Ñ*¨1×-Ò-Ù" 1›=Ð(ä$Ð%:Ó;Ð;r(   c                óî   <€ S! V P                   4      p\        V\        P                  4      '       d   \	        W!4      # \
        P                  P                  V4      '       d	   W!,          # \        R 4      hr  )	r0   r  r,   r  r   r  r  r  ro   ©r¯   rF   r  rú   s   && €r)   rÃ   Úasjacobian.<locals>.Jac.matvec3  sS   ø€ Ù�d—f‘f“I�Ü˜a¤§¡×,Ò,Ü˜q›9Ð$Ü—\‘\×*Ñ*¨1×-Ò-Ø�5�Lä$Ð%:Ó;Ð;r(   c                óR  <€ S! V P                   4      p\        V\        P                  4      '       d%   \	        VP                  4       P                  V4      # \        P                  P                  V4      '       d"   S! VP                  4       P                  V4      # \        R 4      hr  )r0   r  r,   r  r   rþ   rÿ   r  r  r  ro   r  s   &&& €€r)   rÅ   Úasjacobian.<locals>.Jac.rsolve<  sp   ø€ Ù�d—f‘f“I�Ü˜a¤§¡×,Ò,Ü  §¡£§¡¨QÓ/Ð/Ü—\‘\×*Ñ*¨1×-Ò-Ù" 1§6¡6£8§:¡:¨qÓ1Ð1ä$Ð%:Ó;Ð;r(   c                óR  <€ S! V P                   4      p\        V\        P                  4      '       d%   \	        VP                  4       P                  V4      # \        P                  P                  V4      '       d"   VP                  4       P                  V,          # \        R 4      hr  )r0   r  r,   r  r   rþ   rÿ   r  r  r  ro   r  s   && €r)   rÄ   Úasjacobian.<locals>.Jac.rmatvecE  sm   ø€ Ù�d—f‘f“I�Ü˜a¤§¡×,Ò,Ü˜qŸv™v›xŸz™z¨1Ó-Ð-Ü—\‘\×*Ñ*¨1×-Ò-ØŸ6™6›8Ÿ:™:¨�>Ð)ä$Ð%:Ó;Ð;r(   r/   Nr’   )r"   r#   r$   r%   rt   r   rÃ   rÅ   rÄ   r'   r¹   )r»   rú   r  s   @€€r)   ÚJacr  &  s-   ù‡ € ò÷<ð <õ<÷<ð <÷<ó <r(   r  )r   r   r   r   r   r   Úkrylovz#Cannot convert object to a Jacobianr’   ) r  r  Úlinalgr  r  r½   ÚinspectÚisclassÚ
issubclassr,   r  Úndimro   Ú
atleast_2dr   r<   r4   r  rÊ   r=   r   ÚcallableÚstrÚdictr   ÚBroydenSecondÚAndersonÚDiagBroydenÚLinearMixingÚExcitingMixingr   Ú	TypeError)rú   r  r  s   f @r)   rl   rl   þ  s!  ù€ ô �l‰l×!Ñ!×)Ñ)€GÜ�!”X×ÒØˆÜ	�Š˜×	Ò	¤
¨1¬h× 7Ò 7Ù‹sˆ
Ü	�A”r—z‘z×	"Ò	"Ø�6‰6�AŒ:ÜÐ8Ó9Ð9Ü�MŠMœ"Ÿ*š* Q›-Ó(ˆØ�7‰7�1�:˜Ÿ™ �Ô#ÜÐ3Ó4Ð4äÔ2Ü <Þ:ÞDØŸg™g¨Q¯W©Wô	6ð 	6ô
 
�‰×	Ñ	˜q×	!Ò	!Ø�7‰7�1�:˜Ÿ™ �Ô#ÜÐ4Ó5Ð5ÜœÜ 8ß<ßFØŸg™g¨Q¯W©Wô	6ð 	6ô
 
��G×	Ò	¤¨¨G×!4Ò!4¼ÀÀG×9LÒ9LÜœw q¨(Ó3Ü '¨¨9Ó 5ØŸg™gÜ& q¨(Ó3Ü& q¨(Ó3Ü% a¨Ó1ØŸg™gØŸg™gô'ð 	'ô 
�!�Š÷&	<ð &	<”(ô &	<ñN ‹uˆÜ	�A”s×	Ò	Üœ\Ü*Ü%Ü +Ü!-Ü#1Ü)ô+ð ,-ö.ó 0ð 	0ô Ð=Ó>Ð>r(   c                   óN   a € ] tR tRt o ]! ]4      tR tR tR t	V 3R lt
RtV tR# )ÚGenericBroydeni^  c               ó  € \         P                  WW#4       W n        Wn        \	        V R 4      '       dW   V P
                  fG   \        V4      pV'       d+   R\        \        V4      ^4      ,          V,          V n        R# RV n        R# R# R# )ÚalphaNç      à?ra   )r½   rm   Úlast_fÚlast_xrÊ   r3  r   r.   )r¯   r>   Úf0r]   Únormf0s   """" r)   rm   ÚGenericBroyden.setupb  si   € Ü�‰�t Ô*ØŒØŒä�4˜×!Ò! d§j¡jÒ&8ô ˜"“XˆFßØ ¤¤T¨"£X¨qÓ!1Õ1°FÕ:�–
à �–
ñ '9Ñ!r(   c                ó   € \         hr+   rÕ   ©r¯   r0   r´   rƒ   Údfr·   Údf_norms   &&&&&&&r)   Ú_updateÚGenericBroyden._updatep  rÙ   r(   c           
     ó²   € W P                   ,
          pWP                  ,
          pV P                  WWC\        V4      \        V4      4       W n         Wn        R # r+   )r5  r6  r>  r   )r¯   r0   r´   r<  rƒ   s   &&&  r)   rt   ÚGenericBroyden.updates  s<   € Ø—‘�_ˆØ—‘�_ˆØ�‰�Q˜2¤4¨£8¬T°"«XÔ6ØŒØŽr(   c                ó&   <€ V ^8„  d   Qh/ S[ ;R&   # rã   ræ   )rè   r»   s   "€r)   ré   ÚGenericBroyden.__annotate__^  s   ø‡ ‚ á"Ñ>ò r(   )r3  r5  r6  N)r"   r#   r$   r%   rç   r   rå   rm   r>  rt   rë   r'   r¹   rº   s   @r)   r1  r1  ^  s&   ø‡ € á%0°Ó%>Ðò!ò"ò÷+ ƒ r(   r1  c                   ó²   a € ] tR tRt o Rt]! ]4      tR t]	R 4       t
]	R 4       tR tR tRR ltRR	 ltR
 tRR ltR tR tR tRR ltV 3R ltRtV tR# )ÚLowRankMatrixi{  zÌ
A matrix represented as

.. math:: \alpha I + \sum_{n=0}^{n=M} c_n d_n^\dagger

However, if the rank of the matrix reaches the dimension of the vectors,
full matrix representation will be used thereon.

c                óT   € Wn         . V n        . V n        W n        W0n        R V n        R # r+   )r3  Úcsrž   rŠ   r4   Ú	collapsed)r¯   r3  rŠ   r4   s   &&&&r)   r°   ÚLowRankMatrix.__init__‰  s&   € ØŒ
ØˆŒØˆŒØŒØŒ
ØˆŽr(   c                ó¶   € \        . ROVR,          V .,           4      w  rEpW,          p\        W#4       F!  w  r‰V! W�4      p
V! W‡VP                  V
4      pK#  	  V# )ÚaxpyºNrœ   N)rK  ÚscalÚdotc)r   Úziprn   )rF   r3  rG  rž   rK  rM  rN  ÚwÚcÚdÚas   &&&&       r)   Ú_matvecÚLowRankMatrix._matvec‘  sZ   € ä)Ò*BØ*,¨R­&°A°3­,ó8Ñˆ�Dà�IˆÜ˜–K‰DˆAÙ�Q“
ˆAÙ�Q˜1Ÿ6™6 1Ó%ŠAñ  ð ˆr(   c           	     óŒ  € \        V4      ^ 8X  d	   W,          # \        RR.VR,          V .,           4      w  rEV^ ,          pV\        P                  ! \        V4      VP                  R7      ,          p\        V4       F5  w  r‰\        V4       F!  w  r«WxV
3;;,          V! W›4      ,          uu&   K#  	  K7  	  \        P                  ! \        V4      VP                  R7      p\        V4       F  w  r©V! W�4      WÊ&   K  	  WÁ,          p\        W|4      pW,          p\        W,4       F  w  r¾V! W½VP                  V) 4      pK  	  V# )úEvaluate w = M^-1 vrK  rN  rL  r3   )
Úlenr   r,   Úidentityr4   Ú	enumerateÚzerosr   rO  rn   )rF   r3  rG  rž   rK  rN  Úc0ÚAÚirR  ÚjrQ  ÚqrP  Úqcs   &&&&           r)   Ú_solveÚLowRankMatrix._solve›  s  € ô ˆr‹7�aŒ<Ø•7ˆNô $ V¨VÐ$4°b¸µfÀ¸sµlÓC‰
ˆà��UˆØ”B—K’K¤ B£¨r¯x©xÔ8Õ8ˆÜ˜b–M‰DˆAÜ! "ž‘�Ø�A�#—™$˜q›*Õ$•ó &ñ "ô �HŠH”S˜“W B§H¡HÔ-ˆÜ˜b–M‰DˆAÙ˜“:ˆA‹Dñ "à	�
ˆÜ�!‹Kˆà�GˆÜ˜–Z‰EˆAÙ�Q˜1Ÿ6™6 B 3Ó'ŠAñ  ð ˆr(   c                óÊ   € V P                   e"   \        P                  ! V P                   V4      # \        P	                  WP
                  V P                  V P                  4      # )zEvaluate w = M v)rH  r,   r   rE  rT  r3  rG  rž   ©r¯   rF   s   &&r)   rÃ   ÚLowRankMatrix.matvec·  sB   € à�>‰>Ò%Ü—6’6˜$Ÿ.™.¨!Ó,Ð,Ü×$Ñ$ Q¯
©
°D·G±G¸T¿W¹WÓEÐEr(   c                ó$  € V P                   e:   \        P                  ! V P                   P                  P	                  4       V4      # \
        P                  V\        P                  ! V P                  4      V P                  V P                  4      # )zEvaluate w = M^H v)
rH  r,   r   rÿ   rþ   rE  rT  r3  rž   rG  re  s   &&r)   rÄ   ÚLowRankMatrix.rmatvec½  s\   € à�>‰>Ò%Ü—6’6˜$Ÿ.™.×*Ñ*×/Ñ/Ó1°1Ó5Ð5Ü×$Ñ$ Q¬¯ª°·
±
Ó(;¸T¿W¹WÀdÇgÁgÓNÐNr(   c                ó´   € V P                   e   \        V P                   V4      # \        P                  WP                  V P
                  V P                  4      # )rW  )rH  r   rE  rb  r3  rG  rž   r×   s   &&&r)   r   ÚLowRankMatrix.solveÃ  s>   € à�>‰>Ò%Ü˜Ÿ™¨Ó+Ð+Ü×#Ñ# A§z¡z°4·7±7¸D¿G¹GÓDÐDr(   c                ó  € V P                   e/   \        V P                   P                  P                  4       V4      # \        P                  V\        P                  ! V P                  4      V P                  V P                  4      # )zEvaluate w = M^-H v)
rH  r   rÿ   rþ   rE  rb  r,   r3  rž   rG  r×   s   &&&r)   rÅ   ÚLowRankMatrix.rsolveÉ  sX   € à�>‰>Ò%Ü˜Ÿ™×)Ñ)×.Ñ.Ó0°!Ó4Ð4Ü×#Ñ# A¤r§w¢w¨t¯z©zÓ':¸D¿G¹GÀTÇWÁWÓMÐMr(   c                óv  € V P                   e?   V ;P                   VR,          VR,          P                  4       ,          ,          un         R # V P                  P                  V4       V P                  P                  V4       \        V P                  4      VP                  8”  d   V P                  4        R # R # )N©ºNNNN©Nro  )rH  rþ   rG  Úappendrž   rX  rn   Úcollapse)r¯   rQ  rR  s   &&&r)   rq  ÚLowRankMatrix.appendÏ  ss   € Ø�>‰>Ò%Ø�NŠN˜a �i¨!¨F­)¯.©.Ó*:Õ:Õ:�NÙà�‰�‰�qÔØ�‰�‰�qÔäˆt�w‰w‹<˜!Ÿ&™&Ô Ø�M‰MŽOñ !r(   Nc                óÜ  € Ve   \         P                  ! RV R2^R7       Ve   \         P                  ! RV R2^R7       V P                  e   V P                  # V P                  \        P
                  ! V P                  V P                  R7      ,          p\        V P                  V P                  4       F0  w  rEW4R,          VR,          P                  4       ,          ,          pK2  	  V# )NzJLowRankMatrix is scipy-internal code, `dtype` should only be None but was z (not handled))Ú
stacklevelzILowRankMatrix is scipy-internal code, `copy` should only be None but was r3   rn  rp  )ÚwarningsÚwarnrH  r3  r,   rY  rŠ   r4   rO  rG  rž   rþ   )r¯   r4   rP   ÚGmrQ  rR  s   &&&   r)   rÁ   ÚLowRankMatrix.__array__Ú  sÅ   € ØÒÜ�MŠMð 9Ø9>¸¸~ðOà%&õ(ð ÒÜ�MŠMð 9Ø9=¸¸nðNà%&õ(ð �>‰>Ò%Ø—>‘>Ð!à�Z‰ZœŸš D§F¡F°$·*±*Ô=Õ=ˆÜ˜Ÿ™ §¡Ö)‰DˆAØ�F•)˜A˜f�IŸN™NÓ,Õ,Õ,ŠBñ *àˆ	r(   c                ór   € \         P                  ! V \        R7      V n        RV n        RV n        RV n        R# )z0Collapse the low-rank matrix to a full-rank one.)rP   N)r,   rD   r   rH  rG  rž   r3  rÑ   s   &r)   rr  ÚLowRankMatrix.collapseë  s)   € äŸš $¬^Ô<ˆŒØˆŒØˆŒØˆŽ
r(   c                ó¤   € V P                   e   R# V^ 8”  g   Q h\        V P                  4      V8”  d   V P                  R V P                  R R# R# )z8
Reduce the rank of the matrix by dropping all vectors.
Nro  ©rH  rX  rG  rž   ©r¯   Úranks   &&r)   Úrestart_reduceÚLowRankMatrix.restart_reduceò  sG   € ð �>‰>Ò%ÙØ�aŒxˆˆxÜˆt�w‰w‹<˜$ÔØ—‘˜�
Ø—‘˜’
ñ r(   c                ó¤   € V P                   e   R# V^ 8”  g   Q h\        V P                  4      V8”  d   V P                  ^  V P                  ^  K6  R# )z;
Reduce the rank of the matrix by dropping oldest vectors.
Nr}  r~  s   &&r)   Úsimple_reduceÚLowRankMatrix.simple_reduceý  sG   € ð �>‰>Ò%ÙØ�aŒxˆˆxÜ�$—'‘'‹l˜TÔ!Ø—‘˜�
Ø—‘˜’
ñ "r(   c                óÀ  € V P                   e   R# TpVe   TpM	V^,
          pV P                  '       d'   \        V\        V P                  ^ ,          4      4      p\	        ^ \        WC^,
          4      4      p\        V P                  4      pWS8  d   R# \
        P                  ! V P                  4      P                  p\
        P                  ! V P                  4      P                  p\        VRR7      w  rx\        WhP                  P                  4       4      p\        VRR7      w  ršp\        V\        V4      4      p\        W{P                  P                  4       4      p\        V4       FO  pVRV3,          P                  4       V P                  V&   VRV3,          P                  4       V P                  V&   KQ  	  V P                  VR1 V P                  VR1 R# )al  
Reduce the rank of the matrix by retaining some SVD components.

This corresponds to the "Broyden Rank Reduction Inverse"
algorithm described in [1]_.

Note that the SVD decomposition can be done by solving only a
problem whose size is the effective rank of this matrix, which
is viable even for large problems.

Parameters
----------
max_rank : int
    Maximum rank of this matrix after reduction.
to_retain : int, optional
    Number of SVD components to retain when reduction is done
    (ie. rank > max_rank). Default is ``max_rank - 2``.

References
----------
.. [1] B.A. van der Rotten, PhD thesis,
   "A limited memory Broyden method to solve high-dimensional
   systems of nonlinear equations". Mathematisch Instituut,
   Universiteit Leiden, The Netherlands (2003).

   https://web.archive.org/web/20161022015821/http://www.math.leidenuniv.nl/scripties/Rotten.pdf

NÚeconomic)ÚmodeF)Úfull_matricesro  )rH  rG  rr   rX  r.   r,   rD   rÿ   rž   r	   r   rþ   r
   r   rp   rP   )r¯   Úmax_rankÚ	to_retainr•   r`  r  ÚCÚDÚRÚUÚSÚWHÚks   &&&          r)   Ú
svd_reduceÚLowRankMatrix.svd_reduce  sY  € ð: �>‰>Ò%ÙàˆØÒ Ø‰Aà�A•ˆAà�7�7ˆ7Ü�A”s˜4Ÿ7™7 1�:“Ó'ˆAÜ�”3�q˜A�#“;Óˆä�—‘‹LˆØŒ5áä�HŠH�T—W‘WÓ×ÑˆÜ�HŠH�T—W‘WÓ×Ñˆä�!˜*Ô%‰ˆÜ�—3‘3—8‘8“:Óˆä�q¨Ô.‰ˆˆbä�”3�r“7‹OˆÜ�—4‘4—9‘9“;Óˆä�q–ˆAØ˜1˜Q˜3�Ÿ™›ˆD�G‰G�A‰JØ˜1˜Q˜3�Ÿ™›ˆD�G‰G�A‹Jñ ð �G‰G�A‘BˆKØ�G‰G�A‘BŠKr(   c                ó&   <€ V ^8„  d   Qh/ S[ ;R&   # rã   ræ   )rè   r»   s   "€r)   ré   ÚLowRankMatrix.__annotate__{  s   ø‡ ‚ ñ #Ñ>ò r(   )r3  rH  rG  rž   r4   rŠ   r’   rÇ   r+   )r"   r#   r$   r%   r&   rç   r   rå   r°   ÚstaticmethodrT  rb  rÃ   rÄ   r   rÅ   rq  rÁ   rr  r€  rƒ  r’  rë   r'   r¹   rº   s   @r)   rE  rE  {  s‚   ø‡ € ññ &1°Ó%>Ðòð ñó ðð ñó ðò6FòOôEôNò	ôò"ò	ò	ô?÷[ ƒ r(   rE  aÔ  
    alpha : float, optional
        Initial guess for the Jacobian is ``(-1/alpha)``.
    reduction_method : str or tuple, optional
        Method used in ensuring that the rank of the Broyden matrix
        stays low. Can either be a string giving the name of the method,
        or a tuple of the form ``(method, param1, param2, ...)``
        that gives the name of the method and values for additional parameters.

        Methods available:

        - ``restart``: drop all matrix columns. Has no extra parameters.
        - ``simple``: drop oldest matrix column. Has no extra parameters.
        - ``svd``: keep only the most significant SVD components.
          Takes an extra parameter, ``to_retain``, which determines the
          number of SVD components to retain when rank reduction is done.
          Default is ``max_rank - 2``.

    max_rank : int, optional
        Maximum rank for the Broyden matrix.
        Default is infinity (i.e., no rank reduction).
    Úbroyden_paramsc                   ó`   a € ] tR tRt o RtRR ltR tR tRR ltR t	RR	 lt
R
 tR tRtV tR# )r   ib  aÜ  
Find a root of a function, using Broyden's first Jacobian approximation.

This method is also known as "Broyden's good method".

Parameters
----------
%(params_basic)s
%(broyden_params)s
%(params_extra)s

See Also
--------
root : Interface to root finding algorithms for multivariate
       functions. See ``method='broyden1'`` in particular.

Notes
-----
This algorithm implements the inverse Jacobian Quasi-Newton update

.. math:: H_+ = H + (dx - H df) dx^\dagger H / ( dx^\dagger H df)

which corresponds to Broyden's first Jacobian update

.. math:: J_+ = J + (df - J dx) dx^\dagger / dx^\dagger dx


References
----------
.. [1] B.A. van der Rotten, PhD thesis,
   "A limited memory Broyden method to solve high-dimensional
   systems of nonlinear equations". Mathematisch Instituut,
   Universiteit Leiden, The Netherlands (2003).
   https://math.leidenuniv.nl/scripties/Rotten.pdf

Examples
--------
The following functions define a system of nonlinear equations

>>> def fun(x):
...     return [x[0]  + 0.5 * (x[0] - x[1])**3 - 1.0,
...             0.5 * (x[1] - x[0])**3 + x[1]]

A solution can be obtained as follows.

>>> from scipy import optimize
>>> sol = optimize.broyden1(fun, [0, 0])
>>> sol
array([0.84116396, 0.15883641])

Nc                ó–  a a€ \         P                  S 4       VS n        R S n        Vf   \        P
                  pVS n        \        V\        4      '       d   R
oMVR,          oV^ ,          pV^,
          3S,           oVR8X  d   VV 3R lS n	        R # VR8X  d   VV 3R lS n	        R # VR8X  d   VV 3R lS n	        R # \        RV R	24      h)N:rœ   NNr
   c                  ó8   <€ SP                   P                  ! S !  # r+   )rx  r’  ©Úreduce_paramsr¯   s   €€r)   rû   Ú'BroydenFirst.__init__.<locals>.<lambda>¨  s   ø€  4§7¡7×#5Ò#5°}Ò#Er(   Úsimplec                  ó8   <€ SP                   P                  ! S !  # r+   )rx  rƒ  r›  s   €€r)   rû   r�  ª  s   ø€  4§7¡7×#8Ò#8¸-Ò#Hr(   Úrestartc                  ó8   <€ SP                   P                  ! S !  # r+   )rx  r€  r›  s   €€r)   rû   r�  ¬  s   ø€  4§7¡7×#9Ò#9¸=Ò#Ir(   zUnknown rank reduction method 'Ú'r!   )r1  r°   r3  rx  r,   rE   r‰  r  r(  Ú_reducero   )r¯   r3  Úreduction_methodr‰  rœ  s   f&&&@r)   r°   ÚBroydenFirst.__init__—  s²   ù€ Ü×Ñ Ô%ØˆŒ
ØˆŒàÒÜ—v‘vˆHØ ˆŒäÐ&¬×,Ò,Ø‰Mà,¨RÕ0ˆMØ/°Õ2ÐØ! A�˜¨-Õ7ˆà˜uÔ$ÝEˆDŽLØ Ô)ÝHˆDŽLØ Ô*ÝIˆDŽLäÐ>Ð?OÐ>PÐPQÐRÓSÐSr(   c                ó¢   € \         P                  WW#4       \        V P                  ) V P                  ^ ,          V P
                  4      V n        R# )r   N)r1  rm   rE  r3  r<   r4   rx  rà   s   &&&&r)   rm   ÚBroydenFirst.setup°  s4   € Ü×Ñ˜T aÔ.Ü §¡ ¨T¯Z©Z¸­]¸D¿J¹JÓGˆŽr(   c                ó,   € \        V P                  4      # r+   )r   rx  rÑ   s   &r)   r¿   ÚBroydenFirst.todense´  s   € Ü�4—7‘7‹|Ðr(   c                ó(  € V P                   P                  V4      p\        P                  ! V4      P	                  4       '       gM   V P                  V P                  V P                  V P                  4       V P                   P                  V4      # V# r+   )	rx  rÃ   r,   rB   rC   rm   r6  r5  r]   )r¯   r´   r`   Úrs   &&& r)   r   ÚBroydenFirst.solve·  s_   € Ø�G‰G�N‰N˜1ÓˆÜ�{Š{˜1‹~×!Ñ!×#Ò#à�J‰J�t—{‘{ D§K¡K°·±Ô;Ø—7‘7—>‘> !Ó$Ð$Øˆr(   c                ó8   € V P                   P                  V4      # r+   )rx  r   ©r¯   r´   s   &&r)   rÃ   ÚBroydenFirst.matvec¿  s   € Ø�w‰w�}‰}˜QÓÐr(   c                ó8   € V P                   P                  V4      # r+   )rx  rÄ   ©r¯   r´   r`   s   &&&r)   rÅ   ÚBroydenFirst.rsolveÂ  s   € Ø�w‰w�‰˜qÓ!Ð!r(   c                ó8   € V P                   P                  V4      # r+   )rx  rÅ   r®  s   &&r)   rÄ   ÚBroydenFirst.rmatvecÅ  s   € Ø�w‰w�~‰~˜aÓ Ð r(   c                óø   € V P                  4        V P                  P                  V4      pW0P                  P                  V4      ,
          pV\	        WG4      ,          p	V P                  P                  W‰4       R # r+   )r£  rx  rÄ   rÃ   r   rq  ©
r¯   r0   r´   rƒ   r<  r·   r=  rF   rQ  rR  s
   &&&&&&&   r)   r>  ÚBroydenFirst._updateÈ  sO   € Ø�‰Œà�G‰G�O‰O˜BÓˆØ—‘—‘ Ó#Õ#ˆØ”�R“�Oˆà�‰�‰�qÖr(   )rx  r£  r3  r‰  )Nr   Nr’   )r"   r#   r$   r%   r&   r°   rm   r¿   r   rÃ   rÅ   rÄ   r>  r'   r¹   rº   s   @r)   r   r   b  s:   ø‡ € ñ2ôhTò2Hòôò ô"ò!÷ð r(   c                   ó*   a € ] tR tRt o RtR tRtV tR# )r*  iÒ  a¿  
Find a root of a function, using Broyden's second Jacobian approximation.

This method is also known as "Broyden's bad method".

Parameters
----------
%(params_basic)s
%(broyden_params)s
%(params_extra)s

See Also
--------
root : Interface to root finding algorithms for multivariate
       functions. See ``method='broyden2'`` in particular.

Notes
-----
This algorithm implements the inverse Jacobian Quasi-Newton update

.. math:: H_+ = H + (dx - H df) df^\dagger / ( df^\dagger df)

corresponding to Broyden's second method.

References
----------
.. [1] B.A. van der Rotten, PhD thesis,
   "A limited memory Broyden method to solve high-dimensional
   systems of nonlinear equations". Mathematisch Instituut,
   Universiteit Leiden, The Netherlands (2003).

   https://web.archive.org/web/20161022015821/http://www.math.leidenuniv.nl/scripties/Rotten.pdf

Examples
--------
The following functions define a system of nonlinear equations

>>> def fun(x):
...     return [x[0]  + 0.5 * (x[0] - x[1])**3 - 1.0,
...             0.5 * (x[1] - x[0])**3 + x[1]]

A solution can be obtained as follows.

>>> from scipy import optimize
>>> sol = optimize.broyden2(fun, [0, 0])
>>> sol
array([0.84116365, 0.15883529])

c                óÀ   € V P                  4        TpW0P                  P                  V4      ,
          pWv^,          ,          p	V P                  P                  W‰4       R# ©rä   N)r£  rx  rÃ   rq  r¶  s
   &&&&&&&   r)   r>  ÚBroydenSecond._update  s@   € Ø�‰ŒàˆØ—‘—‘ Ó#Õ#ˆØ˜•
�NˆØ�‰�‰�qÖr(   r!   N)r"   r#   r$   r%   r&   r>  r'   r¹   rº   s   @r)   r*  r*  Ò  s   ø‡ € ñ0÷dð r(   r*  c                   óD   a € ] tR tRt o RtR	R ltR
R ltR tR tRt	V t
R# )r+  i  az  
Find a root of a function, using (extended) Anderson mixing.

The Jacobian is formed by for a 'best' solution in the space
spanned by last `M` vectors. As a result, only a MxM matrix
inversions and MxN multiplications are required. [Ey]_

Parameters
----------
%(params_basic)s
alpha : float, optional
    Initial guess for the Jacobian is (-1/alpha).
M : float, optional
    Number of previous vectors to retain. Defaults to 5.
w0 : float, optional
    Regularization parameter for numerical stability.
    Compared to unity, good values of the order of 0.01.
%(params_extra)s

See Also
--------
root : Interface to root finding algorithms for multivariate
       functions. See ``method='anderson'`` in particular.

References
----------
.. [Ey] V. Eyert, J. Comp. Phys., 124, 271 (1996).

Examples
--------
The following functions define a system of nonlinear equations

>>> def fun(x):
...     return [x[0]  + 0.5 * (x[0] - x[1])**3 - 1.0,
...             0.5 * (x[1] - x[0])**3 + x[1]]

A solution can be obtained as follows.

>>> from scipy import optimize
>>> sol = optimize.anderson(fun, [0, 0])
>>> sol
array([0.84116588, 0.15883789])

Nc                ó~   € \         P                  V 4       Wn        W0n        . V n        . V n        R V n        W n        R # r+   )r1  r°   r3  ÚMrƒ   r<  r†   Úw0)r¯   r3  r¿  r¾  s   &&&&r)   r°   ÚAnderson.__init__Y  s4   € Ü×Ñ Ô%ØŒ
ØŒØˆŒØˆŒØˆŒ
ØŽr(   c                óZ  € V P                   ) V,          p\        V P                  4      pV^ 8X  d   V# \        P                  ! WAP
                  R7      p\        V4       F"  p\        V P                  V,          V4      WV&   K$  	   \        V P                  V4      p\        T4       FS  pY7T,          T P                  T,          T P                   T P                  T,          ,          ,           ,          ,          pKU  	  T#   \         d     T P                  R T P                  R Tu # i ; i)r   r3   ro  )r3  rX  rƒ   r,   Úemptyr4   rp   r   r<  r   rS  r   )	r¯   r´   r`   rƒ   rŠ   Údf_fr‘  r†   r  s	   &&&      r)   r   ÚAnderson.solveb  så   € Ø�j‰jˆ[˜�]ˆä�—‘‹LˆØ�Œ6ØˆIä�xŠx˜§¡Ô)ˆÜ�q–ˆAÜ˜4Ÿ7™7 1�: qÓ)ˆD‹Gñ ð	Ü˜$Ÿ&™& $Ó'ˆEô �q–ˆAØ˜•(˜DŸG™G A�J¨¯©°D·G±G¸AµJÕ)>Õ>Õ?Õ?ŠBñ àˆ	øô ô 	à—‘˜�
Ø—‘˜�
ØŠIð		ús   ÂD  Ä 'D*Ä)D*c           
     óæ  € V) V P                   ,          p\        V P                  4      pV^ 8X  d   V# \        P                  ! W1P
                  R7      p\        V4       F"  p\        V P                  V,          V4      WE&   K$  	  \        P                  ! W33VP
                  R7      p\        V4       FÍ  p\        V4       F»  p\        V P                  V,          V P                  V,          4      WgV3&   Wx8X  g   K=  V P                  ^ 8w  g   KP  WgV3;;,          \        V P                  V,          V P                  V,          4      V P                  ^,          ,          V P                   ,          ,          uu&   K½  	  KÏ  	  \        Wd4      p	\        V4       FS  p
W)V
,          V P                  V
,          V P                  V
,          V P                   ,          ,           ,          ,          pKU  	  V# )r   r3   )r3  rX  rƒ   r,   rÂ  r4   rp   r   r<  r¿  r   )r¯   r´   rƒ   rŠ   rÃ  r‘  Úbr^  r_  r†   r  s   &&         r)   rÃ   ÚAnderson.matvecy  sO  € ØˆR�—
‘
�]ˆä�—‘‹LˆØ�Œ6ØˆIä�xŠx˜§¡Ô)ˆÜ�q–ˆAÜ˜4Ÿ7™7 1�: qÓ)ˆD‹Gñ ô �HŠH�a�V 1§7¡7Ô+ˆÜ�q–ˆAÜ˜1–X�Ü˜dŸg™g a�j¨$¯'©'°!­*Ó5��A�#‘Ø–6˜dŸg™g¨žlØ˜�c—Fœd 4§7¡7¨1¥:¨t¯w©w°q­zÓ:¸4¿7¹7ÀA½:ÕEÀdÇjÁjÕPÕP•Fó ñ ô
 �a“ˆä�q–ˆAØ˜•(˜DŸG™G A�J¨¯©°­°D·J±JÕ)>Õ>Õ?Õ?ŠBñ àˆ	r(   c                ó8  € V P                   ^ 8X  d   R# V P                  P                  V4       V P                  P                  V4       \	        V P                  4      V P                   8”  d9   V P                  P                  ^ 4       V P                  P                  ^ 4       K\  \	        V P                  4      p\        P                  ! Ww3VP                  R7      p\        V4       Fq  p	\        W—4       F_  p
Wš8X  d   V P                  ^,          pM^ p^V,           \        V P                  V	,          V P                  V
,          4      ,          W‰V
3&   Ka  	  Ks  	  V\        P                  ! V^4      P                  P                  4       ,          pW€n        R# )r   Nr3   )r¾  rƒ   rq  r<  rX  Úpopr,   r[  r4   rp   r¿  r   Útriurÿ   rþ   rS  )r¯   r0   r´   rƒ   r<  r·   r=  rŠ   rS  r^  r_  Úwds   &&&&&&&     r)   r>  ÚAnderson._update�  s  € Ø�6‰6�QŒ;Ùà�‰�‰�rÔØ�‰�‰�rÔä�$—'‘'‹l˜TŸV™VÔ#Ø�G‰G�K‰K˜ŒNØ�G‰G�K‰K˜ŽNä�—‘‹LˆÜ�HŠH�a�V 1§7¡7Ô+ˆä�q–ˆAÜ˜1–[�Ø”6ØŸ™ !�‘Bà�BØ˜B�$¤ T§W¡W¨Q¥Z°·±¸µÓ <Õ<��A�#“ó !ñ ð 	
ŒR�WŠW�Q˜‹]�_‰_×!Ñ!Ó#Õ#ˆØŽr(   )r¾  rS  r3  r<  rƒ   r†   r¿  )Nr£   é   r’   )r"   r#   r$   r%   r&   r°   r   rÃ   r>  r'   r¹   rº   s   @r)   r+  r+    s$   ø‡ € ñ+ôLôò.÷.ð r(   r+  c                   ó`   a € ] tR tRt o RtRR ltR tRR ltR tRR lt	R	 t
R
 tR tRtV tR# )r,  i®  a¼  
Find a root of a function, using diagonal Broyden Jacobian approximation.

The Jacobian approximation is derived from previous iterations, by
retaining only the diagonal of Broyden matrices.

.. warning::

   This algorithm may be useful for specific problems, but whether
   it will work may depend strongly on the problem.

Parameters
----------
%(params_basic)s
alpha : float, optional
    Initial guess for the Jacobian is (-1/alpha).
%(params_extra)s

See Also
--------
root : Interface to root finding algorithms for multivariate
       functions. See ``method='diagbroyden'`` in particular.

Examples
--------
The following functions define a system of nonlinear equations

>>> def fun(x):
...     return [x[0]  + 0.5 * (x[0] - x[1])**3 - 1.0,
...             0.5 * (x[1] - x[0])**3 + x[1]]

A solution can be obtained as follows.

>>> from scipy import optimize
>>> sol = optimize.diagbroyden(fun, [0, 0])
>>> sol
array([0.84116403, 0.15883384])

Nc                ó<   € \         P                  V 4       Wn        R # r+   ©r1  r°   r3  ©r¯   r3  s   &&r)   r°   ÚDiagBroyden.__init__×  ó   € Ü×Ñ Ô%ØŽ
r(   c                óÈ   € \         P                  WW#4       \        P                  ! V P                  ^ ,          3^V P
                  ,          V P                  R7      V n        R# ©r   r3   N)r1  rm   r,   Úfullr<   r3  r4   rR  rà   s   &&&&r)   rm   ÚDiagBroyden.setupÛ  s=   € Ü×Ñ˜T aÔ.Ü—’˜$Ÿ*™* Q�-Ð)¨1¨t¯z©z­>ÀÇÁÔLˆŽr(   c                ó*   € V) V P                   ,          # r+   ©rR  r±  s   &&&r)   r   ÚDiagBroyden.solveß  ó   € Øˆr�D—F‘F�{Ðr(   c                ó*   € V) V P                   ,          # r+   rÙ  r®  s   &&r)   rÃ   ÚDiagBroyden.matvecâ  rÛ  r(   c                óF   € V) V P                   P                  4       ,          # r+   ©rR  rþ   r±  s   &&&r)   rÅ   ÚDiagBroyden.rsolveå  ó   € Øˆr�D—F‘F—K‘K“MÕ!Ð!r(   c                óF   € V) V P                   P                  4       ,          # r+   rß  r®  s   &&r)   rÄ   ÚDiagBroyden.rmatvecè  rá  r(   c                óD   € \         P                  ! V P                  ) 4      # r+   )r,   ÚdiagrR  rÑ   s   &r)   r¿   ÚDiagBroyden.todenseë  s   € Ü�wŠw˜Ÿ™�wÓÐr(   c                ó�   € V ;P                   W@P                   V,          ,           V,          V^,          ,          ,          un         R# rº  rÙ  r;  s   &&&&&&&r)   r>  ÚDiagBroyden._updateî  s(   € Ø�Š�2Ÿ™˜r�	•> 2Õ% g¨q¥jÕ0Õ0�r(   )r3  rR  r+   r’   ©r"   r#   r$   r%   r&   r°   rm   r   rÃ   rÅ   rÄ   r¿   r>  r'   r¹   rº   s   @r)   r,  r,  ®  s9   ø‡ € ñ&ôPòMôòô"ò"ò ÷1ð 1r(   r,  c                   óZ   a € ] tR tRt o RtRR ltRR ltR tRR ltR t	R	 t
R
 tRtV tR# )r-  iò  aØ  
Find a root of a function, using a scalar Jacobian approximation.

.. warning::

   This algorithm may be useful for specific problems, but whether
   it will work may depend strongly on the problem.

Parameters
----------
%(params_basic)s
alpha : float, optional
    The Jacobian approximation is (-1/alpha).
%(params_extra)s

See Also
--------
root : Interface to root finding algorithms for multivariate
       functions. See ``method='linearmixing'`` in particular.

Nc                ó<   € \         P                  V 4       Wn        R # r+   rÐ  rÑ  s   &&r)   r°   ÚLinearMixing.__init__	  rÓ  r(   c                ó*   € V) V P                   ,          # r+   ©r3  r±  s   &&&r)   r   ÚLinearMixing.solve  ó   € Øˆr�$—*‘*�}Ðr(   c                ó*   € V) V P                   ,          # r+   rî  r®  s   &&r)   rÃ   ÚLinearMixing.matvec  rð  r(   c                óR   € V) \         P                  ! V P                  4      ,          # r+   ©r,   rþ   r3  r±  s   &&&r)   rÅ   ÚLinearMixing.rsolve  ó   € Øˆr”"—'’'˜$Ÿ*™*Ó%Õ%Ð%r(   c                óR   € V) \         P                  ! V P                  4      ,          # r+   rô  r®  s   &&r)   rÄ   ÚLinearMixing.rmatvec  rö  r(   c                óœ   € \         P                  ! \         P                  ! V P                  ^ ,          RV P                  ,          4      4      # )r   éÿÿÿÿ)r,   rå  rÖ  r<   r3  rÑ   s   &r)   r¿   ÚLinearMixing.todense  s,   € Ü�wŠw”r—w’w˜tŸz™z¨!�}¨b°·±­mÓ<Ó=Ð=r(   c                ó   € R # r+   r!   r;  s   &&&&&&&r)   r>  ÚLinearMixing._update  rÝ   r(   rî  r+   r’   )r"   r#   r$   r%   r&   r°   r   rÃ   rÅ   rÄ   r¿   r>  r'   r¹   rº   s   @r)   r-  r-  ò  s2   ø‡ € ñô,ôòô&ò&ò>÷ð r(   r-  c                   ó`   a € ] tR tRt o RtRR ltR tRR ltR tRR lt	R	 t
R
 tR tRtV tR# )r.  i   a›  
Find a root of a function, using a tuned diagonal Jacobian approximation.

The Jacobian matrix is diagonal and is tuned on each iteration.

.. warning::

   This algorithm may be useful for specific problems, but whether
   it will work may depend strongly on the problem.

Parameters
----------
%(params_basic)s
alpha : float, optional
    Initial Jacobian approximation is (-1/alpha).
alphamax : float, optional
    The entries of the diagonal Jacobian are kept in the range
    ``[alpha, alphamax]``.
%(params_extra)s

See Also
--------
root : Interface to root finding algorithms for multivariate
       functions. See ``method='excitingmixing'`` in particular.
Nc                óV   € \         P                  V 4       Wn        W n        R V n        R # r+   )r1  r°   r3  ÚalphamaxÚbeta)r¯   r3  r   s   &&&r)   r°   ÚExcitingMixing.__init__;  s!   € Ü×Ñ Ô%ØŒ
Ø ŒØˆŽ	r(   c                óº   € \         P                  WW#4       \        P                  ! V P                  ^ ,          3V P
                  V P                  R7      V n        R# rÕ  )r1  rm   r,   rÖ  r<   r3  r4   r  rà   s   &&&&r)   rm   ÚExcitingMixing.setupA  s9   € Ü×Ñ˜T aÔ.Ü—G’G˜TŸZ™Z¨�]Ð,¨d¯j©jÀÇ
Á
ÔKˆŽ	r(   c                ó*   € V) V P                   ,          # r+   ©r  r±  s   &&&r)   r   ÚExcitingMixing.solveE  ó   € Øˆr�$—)‘)�|Ðr(   c                ó*   € V) V P                   ,          # r+   r  r®  s   &&r)   rÃ   ÚExcitingMixing.matvecH  r  r(   c                óF   € V) V P                   P                  4       ,          # r+   ©r  rþ   r±  s   &&&r)   rÅ   ÚExcitingMixing.rsolveK  ó   € Øˆr�$—)‘)—.‘.Ó"Õ"Ð"r(   c                óF   € V) V P                   P                  4       ,          # r+   r  r®  s   &&r)   rÄ   ÚExcitingMixing.rmatvecN  r  r(   c                óP   € \         P                  ! RV P                  ,          4      # )rœ   rú  )r,   rå  r  rÑ   s   &r)   r¿   ÚExcitingMixing.todenseQ  s   € Ü�wŠw�r˜$Ÿ)™)•|Ó$Ð$r(   c                ó&  € W P                   ,          ^ 8„  pV P                  V;;,          V P                  ,          uu&   V P                  V P                  V( &   \        P                  ! V P                  ^ V P
                  V P                  R7       R# )r   )ÚoutN)r5  r  r3  r,   Úclipr   )r¯   r0   r´   rƒ   r<  r·   r=  Úincrs   &&&&&&& r)   r>  ÚExcitingMixing._updateT  sZ   € Ø—‘�}˜qÑ ˆØ�	‰	�$�˜4Ÿ:™:Õ%‹ØŸ:™:ˆ�	‰	�4�%ÑÜ
�Š�—	‘	˜1˜dŸm™m°·±×;r(   )r3  r   r  )Nra   r’   ré  rº   s   @r)   r.  r.     s8   ø‡ € ñô4òLôòô#ò#ò%÷<ð <r(   r.  c                   óP   a € ] tR tRt o RtRR ltR tR tRR ltR t	R	 t
R
tV tR# )r   i_  aR  
Find a root of a function, using Krylov approximation for inverse Jacobian.

This method is suitable for solving large-scale problems.

Parameters
----------
%(params_basic)s
rdiff : float, optional
    Relative step size to use in numerical differentiation.
method : str or callable, optional
    Krylov method to use to approximate the Jacobian.  Can be a string,
    or a function implementing the same interface as the iterative
    solvers in `scipy.sparse.linalg`. If a string, needs to be one of:
    ``'lgmres'``, ``'gmres'``, ``'bicgstab'``, ``'cgs'``, ``'minres'``,
    ``'tfqmr'``.

    The default is `scipy.sparse.linalg.lgmres`.
inner_maxiter : int, optional
    Parameter to pass to the "inner" Krylov solver: maximum number of
    iterations. Iteration will stop after maxiter steps even if the
    specified tolerance has not been achieved.
inner_M : LinearOperator or InverseJacobian
    Preconditioner for the inner Krylov iteration.
    Note that you can use also inverse Jacobians as (adaptive)
    preconditioners. For example,

    >>> from scipy.optimize import BroydenFirst, KrylovJacobian
    >>> from scipy.optimize import InverseJacobian
    >>> jac = BroydenFirst()
    >>> kjac = KrylovJacobian(inner_M=InverseJacobian(jac))

    If the preconditioner has a method named 'update', it will be called
    as ``update(x, f)`` after each nonlinear step, with ``x`` giving
    the current point, and ``f`` the current function value.
outer_k : int, optional
    Size of the subspace kept across LGMRES nonlinear iterations.
    See `scipy.sparse.linalg.lgmres` for details.
kw : kwargs
    Keyword parameters for the "inner" Krylov solver
    (defined with `method`). Parameter names must start with
    the `inner_` prefix which will be stripped before passing on
    the inner method. See, e.g., `scipy.sparse.linalg.gmres` for details.
%(params_extra)s

See Also
--------
root : Interface to root finding algorithms for multivariate
       functions. See ``method='krylov'`` in particular.
scipy.sparse.linalg.gmres
scipy.sparse.linalg.lgmres

Notes
-----
This function implements a Newton-Krylov solver. The basic idea is
to compute the inverse of the Jacobian with an iterative Krylov
method. These methods require only evaluating the Jacobian-vector
products, which are conveniently approximated by a finite difference:

.. math:: J v \approx (f(x + \omega*v/|v|) - f(x)) / \omega

Due to the use of iterative matrix inverses, these methods can
deal with large nonlinear problems.

SciPy's `scipy.sparse.linalg` module offers a selection of Krylov
solvers to choose from. The default here is `lgmres`, which is a
variant of restarted GMRES iteration that reuses some of the
information obtained in the previous Newton steps to invert
Jacobians in subsequent steps.

For a review on Newton-Krylov methods, see for example [1]_,
and for the LGMRES sparse inverse method, see [2]_.

References
----------
.. [1] C. T. Kelley, Solving Nonlinear Equations with Newton's Method,
       SIAM, pp.57-83, 2003.
       :doi:`10.1137/1.9780898718898.ch3`
.. [2] D.A. Knoll and D.E. Keyes, J. Comp. Phys. 193, 357 (2004).
       :doi:`10.1016/j.jcp.2003.08.010`
.. [3] A.H. Baker and E.R. Jessup and T. Manteuffel,
       SIAM J. Matrix Anal. Appl. 26, 962 (2005).
       :doi:`10.1137/S0895479803422014`

Examples
--------
The following functions define a system of nonlinear equations

>>> def fun(x):
...     return [x[0] + 0.5 * x[1] - 1.0,
...             0.5 * (x[1] - x[0]) ** 2]

A solution can be obtained as follows.

>>> from scipy import optimize
>>> sol = optimize.newton_krylov(fun, [0, 0])
>>> sol
array([0.66731771, 0.66536458])

Nc           	     óî  € W@n         Wn        \        \        P                  P
                  P                  \        P                  P
                  P                  \        P                  P
                  P                  \        P                  P
                  P                  \        P                  P
                  P                  \        P                  P
                  P                  R 7      P                  W"4      V n        \        W0P                   R7      V n        V P                  \        P                  P
                  P                  J d<   W0P                  R&   ^V P                  R&   V P                  P                  R^ 4       EMVV P                  \        P                  P
                  P                   \        P                  P
                  P                  \        P                  P
                  P                  39   d   V P                  P                  R^ 4       M¿V P                  \        P                  P
                  P                  J dŽ   WPP                  R&   ^V P                  R&   V P                  P                  R. 4       V P                  P                  RR4       V P                  P                  R	R
4       V P                  P                  R^ 4       \#        V P                  4      P$                   Uu. uF  pVR9  g   K  VNK  	  ppVP'                  4        FÉ  w  ršV	P)                  R4      '       g   \+        RV	 24      hV	R,          V9  d}   \-        V	R,          V^R7      pV'       d   RV^ ,           R2pMRp\.        P0                  ! RV	 RV R2V,           \2        \4        P6                  P9                  \:        4      3R7       K´  W P                  V	R,          &   KË  	  R# u upi ))ÚbicgstabÚgmresÚlgmresÚcgsÚminresÚtfqmr)r|   r¾  r   r|   ÚatolÚouter_kÚouter_vÚprepend_outer_vTÚstore_outer_AvFÚinner_zUnknown parameter :é   NN)rŠ   z Did you mean 'z'?rO   zOption 'z#' is invalid for the inner method: zO. It will be ignored.Please check inner method documentation for valid options.)ÚcategoryÚskip_file_prefixesN)r¯   ÚargsÚkwargs)ÚpreconditionerrŸ   r)  r  r  r!  r  r  r  r  r  r  ÚgetÚmethodÚ	method_kwÚ
setdefaultÚgcrotmkr   Ú
parametersrÈ   Ú
startswithro   r   rv  rw  ÚUserWarningÚosÚpathÚdirnameÚ__file__)r¯   rŸ   r-  Úinner_maxiterÚinner_Mr!  rË   r‘  Úvalid_inner_paramsÚkeyrÎ   Úinner_param_suggestionsÚsuggestion_msgs   &&&&&&,      r)   r°   ÚKrylovJacobian.__init__Å  s  € à%ÔØŒ
ô Ü—\‘\×(Ñ(×1Ñ1Ü—,‘,×%Ñ%×+Ñ+Ü—<‘<×&Ñ&×-Ñ-Ü—‘×#Ñ#×'Ñ'Ü—<‘<×&Ñ&×-Ñ-Ü—,‘,×%Ñ%×+Ñ+ô÷ ‰c�&Ó!ð 	Œô  m×7JÑ7JÔKˆŒà�;‰;œ%Ÿ,™,×-Ñ-×3Ñ3Ó3à(5�N‰N˜9Ñ%Ø()ˆD�N‰N˜9Ñ%Ø�N‰N×%Ñ% f¨aÖ0Ø�[‰[œUŸ\™\×0Ñ0×8Ñ8Ü"Ÿ\™\×0Ñ0×9Ñ9Ü"Ÿ\™\×0Ñ0×4Ñ4ð6ô 6ð �N‰N×%Ñ% f¨aÕ0Ø�[‰[œEŸL™L×/Ñ/×6Ñ6Ó6Ø(/�N‰N˜9Ñ%à()ˆD�N‰N˜9Ñ%à�N‰N×%Ñ% i°Ô4Ø�N‰N×%Ñ%Ð&7¸Ô>ð �N‰N×%Ñ%Ð&6¸Ô>Ø�N‰N×%Ñ% f¨aÔ0ô ! §¡Ó-×8Ò8ó
Ù8�!ØÐ2Ñ2÷ ˆAÑ8ð 	ð 
ð
 Ÿ(™(ž*‰JˆCØ—>‘> (×+Ò+Ü Ð#5°c°UÐ!;Ó<Ð<Ø�2�wÐ0Ô0ä*;¸CÀ½GØ<NØ>?ô+AÐ'÷ +Ø(7Ø)@ÀÕ)CÐ(DÀBð'H‘Nð &(�Nô —’Ø˜s˜eÐ#FÀvÀhð OQð Qð %õ%ô )Ü(*¯©¯©¼Ó(AÐ'Cõñ Ø&+�N‰N˜3˜r�7Ó#ó3 %ùò
s   Ë=	O2ÌO2c                óø   € \        V P                  4      P                  4       p\        V P                  4      P                  4       pV P                  \        ^V4      ,          \        ^V4      ,          V n        R# )rœ   N)r�   r>   r.   r7  rŸ   Úomega)r¯   ÚmxÚmfs   &  r)   Ú_update_diff_stepÚ KrylovJacobian._update_diff_step  sO   € Ü�—‘‹\×ÑÓˆÜ�—‘‹\×ÑÓˆØ—Z‘Z¤# a¨£*Õ,¬s°1°b«zÕ9ˆŽ
r(   c                ó¸  € \        V4      pV^ 8X  d
   ^ V,          # V P                  V,          pV P                  V P                  W1,          ,           4      V P                  ,
          V,          p\
        P                  ! \
        P                  ! V4      4      '       g<   \
        P                  ! \
        P                  ! V4      4      '       d   \        R4      hV# )r   z$Function returned non-finite results)	r   r@  r]   r>   r7  r,   rC   rB   ro   )r¯   rF   ÚnvÚscr«  s   &&   r)   rÃ   ÚKrylovJacobian.matvec  sŒ   € Ü�!‹WˆØ�Œ7Ø�Q•3ˆJØ�Z‰Z˜"�_ˆØ�Y‰Y�t—w‘w ¥•~Ó&¨¯©Õ0°BÕ6ˆÜ�vŠv”b—k’k !“n×%Ò%¬"¯&ª&´·²¸Q³×*@Ò*@ÜÐCÓDÐDØˆr(   c                óØ   € R V P                   9   d-   V P                  ! V P                  V3/ V P                   B w  r4V# V P                  ! V P                  V3R V/V P                   B w  r4V# )Úrtol)r.  r-  Úop)r¯   Úrhsr`   ÚsolrŽ   s   &&&  r)   r   ÚKrylovJacobian.solve  s_   € Ø�T—^‘^Ô#ØŸš D§G¡G¨SÑC°D·N±NÑC‰IˆCð ˆ
ð Ÿš D§G¡G¨SÑM°sÐM¸d¿n¹nÑM‰IˆCØˆ
r(   c                óÐ   € Wn         W n        V P                  4        V P                  e<   \	        V P                  R4      '       d   V P                  P                  W4       R # R # R # )Nrt   )r>   r7  rC  r+  rÊ   rt   )r¯   r0   r´   s   &&&r)   rt   ÚKrylovJacobian.update&  sW   € ØŒØŒØ×ÑÔ ð ×ÑÒ*Ü�t×*Ñ*¨H×5Ò5Ø×#Ñ#×*Ñ*¨1Ö0ñ 6ñ +r(   c                óâ  € \         P                  WW#4       Wn        W n        \        P
                  P                  P                  V 4      V n        V P                  f7   \        P                  ! VP                  4      P                  R,          V n	        V P                  4        V P                  e=   \!        V P                  R4      '       d   V P                  P                  WV4       R # R # R # )Nrm   r4  )r½   rm   r>   r7  r  r  r!  ÚaslinearoperatorrK  rŸ   r,   r¬   r4   r­   rC  r+  rÊ   )r¯   r0   r´   r]   s   &&&&r)   rm   ÚKrylovJacobian.setup0  s¬   € Ü�‰�t Ô(ØŒØŒÜ—,‘,×%Ñ%×6Ñ6°tÓ<ˆŒà�:‰:ÒÜŸš !§'¡'Ó*×.Ñ.°4Õ8ˆDŒJà×ÑÔ ð ×ÑÒ*Ü�t×*Ñ*¨G×4Ò4Ø×#Ñ#×)Ñ)¨!°Ö5ñ 5ñ +r(   )r7  r-  r.  r@  rK  r+  rŸ   r>   )Nr  é   Né
   r’   )r"   r#   r$   r%   r&   r°   rC  rÃ   r   rt   rm   r'   r¹   rº   s   @r)   r   r   _  s1   ø‡ € ñcôJI,òV:ò
ôò1÷6ð 6r(   c           	     óŽ  € \        VP                  4      pVw  r4rVrxp	\        \        V\	        V4      ) R V4      4      p
RP                  V
 UUu. uF  w  r¼V RV: 2NK  	  upp4      pV'       d
   RV,           pRP                  V
 UUu. uF  w  r¼V RV 2NK  	  upp4      pV'       d
   VR,           pV'       d   \        RV 24      hRpV\        WVP                  VR7      ,          p/ pVP                  \        4       4       \        VV4       VV ,          pVP                  Vn        \        V4       V# u uppi u uppi )zï
Construct a solver wrapper with given name and Jacobian approx.

It inspects the keyword arguments of ``jac.__init__``, and allows to
use the same arguments in the wrapper function, in addition to the
keyword arguments of `nonlin_solve`

Nz, Ú=zUnexpected signature a™  
def %(name)s(F, xin, iter=None %(kw)s, verbose=False, maxiter=None,
             f_tol=None, f_rtol=None, x_tol=None, x_rtol=None,
             tol_norm=None, line_search='armijo', callback=None, **kw):
    jac = %(jac)s(%(kwkw)s **kw)
    return nonlin_solve(F, xin, jac, iter, verbose, maxiter,
                        f_tol, f_rtol, x_tol, x_rtol, tol_norm, line_search,
                        callback)
)rÍ   rË   ÚjacÚkwkw)Ú_getfullargspecr°   ÚlistrO  rX  Újoinro   r)  r"   rt   ÚglobalsÚexecr&   rM   )rÍ   rX  r   r)  ÚvarargsÚvarkwÚdefaultsÚ
kwonlyargsÚ
kwdefaultsÚ_r*  r‘  rF   Úkw_strÚkwkw_strÚwrapperÚnsr]   s   &&                r)   Ú_nonlin_wrapperri  E  s*  € ô   §¡Ó-€IØ@IÑ=€D�5 J¸AÜ”#�dœC ›M˜>˜?Ð+¨XÓ6Ó7€FØ�Y‰Y±Ô8±©¨˜1˜#˜Q˜q™e›±Ò8Ó9€FßØ˜•ˆØ�y‰y±Ô8±©¨˜Q˜C˜q  ›*±Ò8Ó9€HßØ˜d•?ˆßÜÐ0°°Ð<Ó=Ð=ð€Gð œ $°s·|±|Ø"*ô,õ ,€Gà	€BØ‡I�IŒg‹iÔÜˆ�"ÔØˆd�8€DØ—;‘;€D„LÜˆT„NØ€Kùó; 9ùó 9s   ÁD;
ÂE
)r   r   r   r   r   r   r   r   r   r   r   )r   NFNNNNNNr_   NFT)r_   g:Œ0âŽyE>r£   )Dr"  r4  ru   rv  Únumpyr,   r   r   r   Úscipy.linalgr   r   r   r	   r
   r   Úscipy.sparse.linalgr  Úscipy.sparser   Úscipy._lib._utilr   r   r   rZ  Ú_linesearchr   r   r   Údifflibr   Útypesr   Ú__all__Ú	Exceptionr   r1   r8   r@   rG   r)  ÚstriprK   rM   rR   r�   rs   rj   r½   r   rl   r1  rE  r   r*  r+  r,  r-  r.  r   ri  r   r   r   r   r   r   r   r!   r(   r)   Ú<module>ru     s÷  ðó Û 	Û 
Û ã ß $Ñ $ç ?× ?Û Û Ý 'ß >Ý Fß CÝ Ý %Ý òJ€ô	�Iô 	ò òòòñ Ù"ð $ó 	÷ 
‰‹Ù"ð ($ó (	÷P 
‰‹ôa1€
òh/ò
.ôO"ñd 	ˆÔ ô*÷Z9<ñ 9<÷@Hñ H÷V(#ñ (#òVY?ô@�Xô ÷:Lñ Lñ^  1ð 2ó  	÷* 
‰‹ð+ ÐÑ ô0m�>ô mô`9�Lô 9ô@Uˆ~ô UôxA1�.ô A1ôH+�>ô +ô\8<�^ô 8<ô~_6�Xô _6òL)ñX ˜: |Ó4€Ù˜: }Ó5€Ù˜: xÓ0€Ù˜~¨|Ó<€Ù˜m¨[Ó9€Ù Ð!1°>ÓB€Ù °Ó@€Ù ˆ|Ô Ù ˆ~Ö r(   