+
    /i                         R t ^ RIt^ RIt^ RIHt ^ RIHt ^RIH	t	H
t
  ! R R]4      tRR ltRR ltRR	 ltR
 tR tR# )z,
Spectral Algorithm for Nonlinear Equations
N)OptimizeResult)_check_unknown_options)_nonmonotone_line_search_cruz_nonmonotone_line_search_chengc                       ] tR t^tRtR# )_NoConvergence N)__name__
__module____qualname____firstlineno____static_attributes__r       V/var/www/html/photoedit/myenv/lib/python3.14/site-packages/scipy/optimize/_spectral.pyr   r      s    r   r   c           
     \  a*a+a, \        V4       VR9  d   \        RV: R24      h^o,V
f   V*3R lp
Vf   V+V,3R lpV,3R lp^ .p\        WVVWR4      w  pppo+pp^ pS+o*TpV! V4      p\        P                  ! S+.V	4      pRpS*pR	pR
p V! V4      pV'       d   \        RV RVR RVR 24       Ve
   V! VV4       VVV,          V,           8  d   RpRpEM\        V4      ^V,          8  d&   ^V,          \        P                  ! V4      ,          pM\        V4      V8  d   TpV) V,          pV
! VVV4      p  VR8X  d   \        VVVVV R7      w  p!p"p#p$M VR8X  d   \        VVVS+VVV R7      w  p!p"p#p$ppX"V,
          p%X$V,
          p&\        P                  ! V%V%4      \        P                  ! V%V&4      ,          pT"pT$pX#o+VR8X  d   VP                  V#4       V^,          pEK^  \        VVVR7      p'\        VV4      p(\        V'VVV(V^ ,          VRR7      p)V)#   \         d     KC  i ; i)a  
Solve nonlinear equation with the DF-SANE method

Options
-------
ftol : float, optional
    Relative norm tolerance.
fatol : float, optional
    Absolute norm tolerance.
    Algorithm terminates when ``||func(x)|| < fatol + ftol ||func(x_0)||``.
fnorm : callable, optional
    Norm to use in the convergence check. If None, 2-norm is used.
maxfev : int, optional
    Maximum number of function evaluations.
disp : bool, optional
    Whether to print convergence process to stdout.
eta_strategy : callable, optional
    Choice of the ``eta_k`` parameter, which gives slack for growth
    of ``||F||**2``.  Called as ``eta_k = eta_strategy(k, x, F)`` with
    `k` the iteration number, `x` the current iterate and `F` the current
    residual. Should satisfy ``eta_k > 0`` and ``sum(eta, k=0..inf) < inf``.
    Default: ``||F||**2 / (1 + k)**2``.
sigma_eps : float, optional
    The spectral coefficient is constrained to ``sigma_eps < sigma < 1/sigma_eps``.
    Default: 1e-10
sigma_0 : float, optional
    Initial spectral coefficient.
    Default: 1.0
M : int, optional
    Number of iterates to include in the nonmonotonic line search.
    Default: 10
line_search : {'cruz', 'cheng'}
    Type of line search to employ. 'cruz' is the original one defined in
    [Martinez & Raydan. Math. Comp. 75, 1429 (2006)], 'cheng' is
    a modified search defined in [Cheng & Li. IMA J. Numer. Anal. 29, 814 (2009)].
    Default: 'cruz'

References
----------
.. [1] "Spectral residual method without gradient information for solving
       large-scale nonlinear systems of equations." W. La Cruz,
       J.M. Martinez, M. Raydan. Math. Comp. **75**, 1429 (2006).
.. [2] W. La Cruz, Opt. Meth. Software, 29, 24 (2014).
.. [3] W. Cheng, D.-H. Li. IMA J. Numer. Anal. **29**, 814 (2009).

chengcruzzInvalid value z for 'line_search'c                 2   < S^V ,           ^,          ,          # )   r   )kxFf_0s   &&&r   eta_strategy#_root_df_sane.<locals>.eta_strategyJ   s    !a%!##r   c                 $   < SR S,          ,          # )      ?r   )r   f_knexps   &r   fnorm_root_df_sane.<locals>.fnormO   s    T?"r   c                 P   < \         P                  P                  V 4      S,          # N)nplinalgnorm)r   r   s   &r   fmerit_root_df_sane.<locals>.fmeritS   s    yy~~a $&&r   r   Fz&too many function evaluations requiredTziter z
: ||F|| = gz
, sigma = zsuccessful convergence)eta)shapezdf-sane)r   successmessagefunnfevnitmethod)r   r   )r   
ValueError
_wrap_funccollectionsdequeprintabsr#   signr   r   r   vdotappend_wrap_resultr   )-funcx0argsftolfatolmaxfevr   callbackdispMr   	sigma_epssigma_0line_searchunknown_optionsr&   r.   fx_kx_shapeF_k
is_complexr   sigma_kF_0_normprev_fsQC	convergedr,   F_k_normdr)   alphaxpfpFps_ky_kr   r   resultr   r   r   s-   &&&&&&&&&&&&&&,                           @@@r   _root_df_saner\      s   b ?+++>+8JKLLD	$ }	#' 3D,6t7;V-K)AsGS#z 	
A
CGSzH q)G 	AAI6G
:E!Jxl*WQKHIS#dXo--.GI w<!I+%	kBGGG$44G\I%G HsN 1c3'	f$$A!S!WFI%K!r2r'*HCQRTWIJASV+X'r2r1a 3h3h''#s#bggc3&77  & NN2	QS*G4AS*%Aa$+ !QQyJF M5  		s   ;H  H H+*H+c                  a aaaaa	 \         P                  ! V4      pVP                  o	\         P                  ! S ! V.SO5!  4      P                  4       p\         P                  ! V4      ;'       g    \         P                  ! V4      pVP                  4       p^S^ &   V'       d#   VVV VVV	3R lp\        V4      p\        V4      pMVVV VVV	3R lpWS	S! V4      Wg3# )a   
Wrap a function and an initial value so that (i) complex values
are wrapped to reals, and (ii) value for a merit function
fmerit(x, f) is computed at the same time, (iii) iteration count
is maintained and an exception is raised if it is exceeded.

Parameters
----------
func : callable
    Function to wrap
x0 : ndarray
    Initial value
fmerit : callable
    Merit function fmerit(f) for computing merit value from residual.
nfev_list : list
    List to store number of evaluations in. Should be [0] in the beginning.
maxfev : int
    Maximum number of evaluations before _NoConvergence is raised.
args : tuple
    Extra arguments to func

Returns
-------
wrap_func : callable
    Wrapped function, to be called as
    ``F, fp = wrap_func(x0)``
x0_wrap : ndarray of float
    Wrapped initial value; raveled to 1-D and complex
    values mapped to reals.
x0_shape : tuple
    Shape of the initial value array
f : float
    Merit function at F
F : ndarray of float
    Residual at x0_wrap
is_complex : bool
    Whether complex values were mapped to reals

c                   < S	^ ,          S8  d   \        4       hS	^ ;;,          ^,          uu&   \        V 4      P                  S
4      p\        P                  ! S! V.SO5!  4      P                  4       p\        V4      pS! V4      pWC3#     )r   _real2complexreshaper#   asarrayravel_complex2real)r   zvr   rH   r=   r&   r;   r@   	nfev_listx0_shapes   &    r   	wrap_func_wrap_func.<locals>.wrap_func   st    |v%$&&aLALa ((2A

4>D>*002Aa Aq	A4Kr   c                    < S^ ,          S8  d   \        4       hS^ ;;,          ^,          uu&   V P                  S4      p \        P                  ! S! V .SO5!  4      P	                  4       pS! V4      pW!3# r_   )r   rb   r#   rc   rd   )	r   r   rH   r=   r&   r;   r@   rh   ri   s	   &  r   rj   rk      sc    |v%$&&aLAL		(#A

4>D>*002Aq	A4Kr   )r#   rc   r*   rd   iscomplexobjre   )
r;   r<   r&   rh   r@   r=   r   rL   rj   ri   s
   f&ffff   @r   r2   r2      s    P 
BBxxH


4?T?#))+A$::(:J	BIaL	 	 2!	 	 (F1Iq<<r   c                \    V'       d   \        V 4      pMT pVe   VP                  V4      pV# )z9
Convert from real to complex and reshape result arrays.
)ra   rb   )r[   rL   r*   rf   s   &&& r   r:   r:      s/     &!IIeHr   c                 t    \         P                  ! V \        R 7      P                  \         P                  4      # )dtype)r#   ascontiguousarrayfloatview
complex128)r   s   &r   ra   ra      s$    /44R]]CCr   c                 t    \         P                  ! V \        R 7      P                  \         P                  4      # rp   )r#   rr   complexrt   float64)rf   s   &r   re   re     s$    166rzzBBr   )r   g:0yE>gYni  NNF
   Ng|=r   r   )r   r"   )__doc__r3   numpyr#   scipy.optimizer   scipy.optimize._optimizer   _linesearchr   r   	Exceptionr   r\   r2   r:   ra   re   r   r   r   <module>r      sF      ) ; V	Y 	VrG=T
DCr   