+
    Y°³j~<  ã                   óŽ   € ^ RI t ^ RIt^RIHtHt ^RIHtHtH	t	 ^ RI
Hu Ht R	tR
tRtRtRt^ t^tRR ltRR ltR tR tR tR# )é    N)Ú_RichResultÚ_call_callback_maybe_halt)Úarray_namespaceÚxp_sizeÚxp_result_typec           
     óø  a€ \        V4      pVf
   \        V!  MTpVe8   . VOVP                  4       O5p\        VP	                  4       4      pRVRV /R lp \        VRRRV/ p	VP                  ! . VOVO5!  p
V
RV W§R r!V Uu. uF  q¶P                  W¹R7      NK  	  ppV Uu. uF  q¶P                  V ! V.VO5!  4      NK  	  ppV^ ,          P                  pV^ ,          P                  oV'       db   R	VRV /V3R
 llp \        P                  ! SV4      pV Uu. uF  q¶P                  W½4      NK  	  ppV Uu. uF  qæP                  Wí4      NK  	  ppRpVe   RVP                  4        2pV Uu. uF  pVP                  V8H  NK  	  pp\        V4      '       g   \        V4      hVP                  ! V Uu. uF  pVP                   NK  	  upV	.,           !  pV'       g$   VP#                  VR4      '       g   \        R4      hV Uu. uF  q¶P                  VVRR7      NK  	  ppV Uu. uF  pVP                  VVRR7      NK  	  ppV Uu. uF  q¶P%                  VR4      NK  	  ppV Uu. uF  pVP%                  VR4      NK  	  ppV Uu. uF%  qæP%                  VP                  VRR7      R4      NK'  	  ppWWÂVVV3# u upi u upi u upi u upi u upi u upi u upi u upi u upi u upi u upi )aÈ  Initialize abscissa, function, and args arrays for elementwise function

Parameters
----------
func : callable
    An elementwise function with signature

        func(x: ndarray, *args) -> ndarray

    where each element of ``x`` is a finite real and ``args`` is a tuple,
    which may contain an arbitrary number of arrays that are broadcastable
    with ``x``.
xs : tuple of arrays
    Finite real abscissa arrays. Must be broadcastable.
args : tuple, optional
    Additional positional arguments to be passed to `func`.
kwargs : tuple, optional
    Additional keyword arguments to be passed to `func`.
preserve_shape : bool, default:False
    When ``preserve_shape=False`` (default), `func` may be passed
    arguments of any shape; `_scalar_optimization_loop` is permitted
    to reshape and compress arguments at will. When
    ``preserve_shape=False``, arguments passed to `func` must have shape
    `shape` or ``shape + (n,)``, where ``n`` is any integer.
xp : namespace
    Namespace of array arguments in `xs`.

Returns
-------
xs, fs, args : tuple of arrays
    Broadcasted, writeable, 1D abscissa and function value arrays (or
    NumPy floats, if appropriate). The dtypes of the `xs` and `fs` are
    `xfat`; the dtype of the `args` are unchanged.
shape : tuple of ints
    Original shape of broadcasted arrays.
xfat : NumPy dtype
    Result dtype of abscissae, function values, and args determined using
    `np.result_type`, except integer types are promoted to `np.float64`.

Raises
------
ValueError
    If the result dtype is not that of a real scalar

Notes
-----
Useful for initializing the input of SciPy functions that accept
an elementwise callable, abscissae, and arguments; e.g.
`scipy.optimize._chandrupatla`.
NÚkwnamesÚfuncc                óˆ   € \        V4      \        V4      ,
          p\        \        WVR  4      4      pV! V .VR V O5/ VBVB # )N)ÚlenÚdictÚzip)Úxr	   r
   ÚargsÚkwargsÚnargsÚkwarrayss   &$$*,  Úi/home/luca/screen-checking/.venv/lib/python3.14/site-packages/scipy/_lib/_elementwise_iterative_method.pyr
   Ú_initialize.<locals>.funcW   sI   € Ü˜“I¤ G£Õ,ˆEÜœC ¨e¨f¨Ó6Ó7ˆHÙ˜Ð?˜D  %˜LÒ?¨HÐ?¸Ñ?Ð?ó    Úforce_floatingTÚxp©ÚdtypeÚshapec                ól   <€ R\        S4      \        V4      ,
          ,          pV! W,          .VO5/ VB # )r   )r   )r   )r   r   r
   r   r   ÚiÚfshapes   &$$*, €r   r
   r   k   s1   ø€ Ø”c˜&“k¤C¨£JÕ.Õ/ˆAÙ˜�Ð.˜tÒ. vÑ.Ð.r   zpThe shape of the array returned by `func` must be the same as the broadcasted shape of `x` and all other `args`.zWhen `preserve_shape=False`, zreal floatingz3Abscissae and function output must be real numbers.)r   Úcopy)r   ©éÿÿÿÿ)r   r   ÚvaluesÚtupleÚkeysr   Úbroadcast_arraysÚasarrayr   ÚnpÚbroadcast_shapesÚbroadcast_toÚlowerÚallÚ
ValueErrorÚresult_typer   ÚisdtypeÚreshape)r
   Úxsr   r   Ú
complex_okÚpreserve_shaper   Únxr	   ÚxatÚxasr   Úfsr   ÚargÚmessageÚfÚshapes_equalÚxfatr   s   &&&&&&&            @r   Ú_initializer<      sá  ø€ ôh 
ˆR‹€BØ!#¢Œ˜"Ò	°€BàÒØ(�Ð(˜Ÿ™›Ñ(ˆÜ˜Ÿ™›Ó&ˆð	@ 7ð 	@°ô 	@ô ˜"Ð
9¨TÐ
9°bÑ
9€CØ
×
Ò
Ð
)˜rÐ
) DÓ
)€CØ�3�Bˆx˜˜S˜ˆÙ,.Ó	/©B q�*‰*�Qˆ*Ö
"©B€BÐ	/Ù.0Ó	1©b¨�*‰*‘T˜!�^˜d“^Ö
$©b€BÐ	1Øˆq�E�K‰K€EØ��U�[‰[€Fçð	/ ð 	/¨T÷ 	/ô ×#Ò# F¨EÓ2ˆÙ13Ó4±¨A�o‰o˜aÖ'±ˆÐ4Ù7;Ó<±t°—‘ Ö+±tˆÐ<ðD€GàÒ!Ø1°'·-±-³/Ð1BÐCˆÙ.0Ó1©b¨�A—G‘G˜uÔ$©b€LÐ1Üˆ|×ÒÜ˜Ó!Ð!ð
 �>Š>©bÓ1©b¨˜QŸWœW©bÑ1°S°EÕ9Ñ;€Dß˜bŸj™j¨¨×?Ò?ÜÐNÓOÐOÙ8:Ó	;¹°1�*‰*�Q˜d¨ˆ*Ö
.¹€BÐ	;Ù8:Ó	;¹°1ˆ"�*‰*�Q˜d¨ˆ*Ö
.¹€BÐ	;ñ )+Ó	+© 1�*‰*�Q˜Ö
©€BÐ	+Ù(*Ó	+© 1ˆ"�*‰*�Q˜Ö
©€BÐ	+ÙEIÓJÁT¸c�J‰J�r—z‘z #¨D�zÓ1°5Ö9ÁT€DÐJØ�R˜u d¨BÐ.Ð.ùòI 
0ùÚ	1ùò 5ùÚ<ùò 2ùò 2ùò 
<ùÚ	;ùò 
,ùÚ	+ùÚJsB   ÂKÂ%!K
ÄKÄ<KÅ4KÆ:KÈK#È-K(ÉK-É0K2Ê+K7c           
     ó�  € Vf   \        R4      hRp\        P                  ! V4      pVP                  V4      pV UUu/ uF  w  ppVVP	                  VVR7      bK  	  pppVP	                  VVP
                  R7      VR&   VP                  VVP                  \        4      VP                  R7      VR&   VP	                  VVP                  R7      VR&   VP	                  VVP                  R7      VR&   \        V4      pWPn        \        V VVVWžV4      pVe&   \        V VVVVW¾V4      p\        VV4      '       d   RpV P                  V8  Ed   \!        V4      '       Ed   V'       Egù   V'       Edð   V! V 4      pV P                  '       d    V P                  ^ ,          P"                  VP"                  8w  dt   . pV P                   F[  pVP"                  VP"                  ,
          pVP$                  R
V,          ,           pVP'                  VP)                  VV4      4       K]  	  WPn        VP$                  pV'       d   VP)                  VVR,           4      pV! V.V P                  O5!  pVP                  VVR7      pV'       d%   VP)                  VV4      pVP)                  VV4      pT ;P*                  VP"                  ^8X  d   ^MVP$                  R,          ,          un        V! VVV 4       V ;P                  ^,          un        \        V VVVWžV4      pVe'   \        V VVVVW¾V4      p\        VV4      '       d   RpM\!        V4      ^ 8X  d   MV
! V 4       EK%  \,        P.                  ! V P0                  4      R	,          P3                  V'       d   \4        M\6        4      V n        \        V VVVVW¾V4      # u uppi )a’  Main loop of a vectorized scalar optimization algorithm

Parameters
----------
work : _RichResult
    All variables that need to be retained between iterations. Must
    contain attributes `nit`, `nfev`, and `success`. All arrays are
    subject to being "compressed" if `preserve_shape is False`; nest
    arrays that should not be compressed inside another object (e.g.
    `dict` or `_RichResult`).
callback : callable
    User-specified callback function
shape : tuple of ints
    The shape of all output arrays
maxiter :
    Maximum number of iterations of the algorithm
func : callable
    The user-specified callable that is being optimized or solved
args : tuple
    Additional positional arguments to be passed to `func`.
dtype : NumPy dtype
    The common dtype of all abscissae and function values
pre_func_eval : callable
    A function that accepts `work` and returns `x`, the active elements
    of `x` at which `func` will be evaluated. May modify attributes
    of `work` with any algorithmic steps that need to happen
     at the beginning of an iteration, before `func` is evaluated,
post_func_eval : callable
    A function that accepts `x`, `func(x)`, and `work`. May modify
    attributes of `work` with any algorithmic steps that need to happen
     in the middle of an iteration, after `func` is evaluated but before
     the termination check.
check_termination : callable
    A function that accepts `work` and returns `stop`, a boolean array
    indicating which of the active elements have met a termination
    condition.
post_termination_check : callable
    A function that accepts `work`. May modify `work` with any algorithmic
    steps that need to happen after the termination check and before the
    end of the iteration.
customize_result : callable
    A function that accepts `res` and `shape` and returns `shape`. May
    modify `res` (in-place) according to preferences (e.g. rearrange
    elements between attributes) and modify `shape` if needed.
res_work_pairs : list of (str, str)
    Identifies correspondence between attributes of `res` and attributes
    of `work`; i.e., attributes of active elements of `work` will be
    copied to the appropriate indices of `res` when appropriate. The order
    determines the order in which _RichResult attributes will be
    pretty-printed.
preserve_shape : bool, default: False
    Whether to compress the attributes of `work` (to avoid unnecessary
    computation on elements that have already converged).

Returns
-------
res : _RichResult
    The final result object

Notes
-----
Besides providing structure, this framework provides several important
services for a vectorized optimization algorithm.

- It handles common tasks involving iteration count, function evaluation
  count, a user-specified callback, and associated termination conditions.
- It compresses the attributes of `work` to eliminate unnecessary
  computation on elements that have already converged.

zMust provide xp.Fr   ÚsuccessÚstatusÚnitÚnfevT:NNN)é   r!   r    )ÚNotImplementedErrorÚmathÚprodÚarangeÚzerosÚboolÚfullr&   Ú_EINPROGRESSÚint32r   r   Ú_check_terminationÚ_prepare_resultr   r@   r   Úndimr   Úappendr/   rA   ÚxpxÚatr?   ÚsetÚ
_ECALLBACKÚ	_ECONVERR)ÚworkÚcallbackr   Úmaxiterr
   r   r   Úpre_func_evalÚpost_func_evalÚcheck_terminationÚpost_termination_checkÚcustomize_resultÚres_work_pairsr   r2   Úcb_terminateÚ
n_elementsÚactiver   ÚjÚres_dictÚresÚtempr   r7   Ú
n_new_dimsÚ	new_shapeÚx_shaper9   s   &&&&&&&&&&&&&&&              r   Ú_looprh   ‹   s)  € ðR 
‚zÜ!Ð"4Ó5Ð5à€Lô —’˜5Ó!€JØ�Y‰Y�zÓ"€FÙAOÔPÁ¹¸¸A��2—8‘8˜J¨e�8Ó4Ò4Á€HÑPØŸ(™( :°R·W±W˜(Ó=€HˆYÑØŸ™ ¨R¯Z©Z¼Ó-EÈRÏXÉX˜ÓV€HˆXÑØ—h‘h˜z°·±�hÓ:€HˆU�OØ—x‘x 
°"·(±(�xÓ;€HˆVÑÜ
�hÓ
€CØ„Iä  c¨>¸6Ø 1À2óG€Fð ÒÜ˜t S¨.¸&À%Ø/ÀóEˆä$ X¨t×4Ò4ØˆLà
�(‰(�WÕ
¤¨§£¿¸Ï*È*Ù˜$Óˆà�9�9ˆ9˜Ÿ™ 1�×*Ñ*¨a¯f©fÔ4ð ˆDØ—y”y�ØŸV™V c§h¡hÕ.�
ØŸI™I¨¨Z­Õ7�	Ø—‘˜BŸJ™J s¨IÓ6Ö7ñ !ð ŒIà—'‘'ˆßØ—
‘
˜1˜u u�}Ó.ˆAÙ�Ð�T—Y‘YÓˆØ�J‰J�q ˆJÓ&ˆßØ—
‘
˜1˜gÓ&ˆAØ—
‘
˜1˜gÓ&ˆAØ�	Š	˜!Ÿ&™& Aœ+‘Q¨1¯7©7°2­;Õ6�	á�q˜!˜TÔ"à�Š�A��Ü# D¨#¨~¸vØ$5ÀróKˆð ÒÜ" 4¨¨n¸fÀeØ#3ÀRóIˆDä(¨°4×8Ò8Ø#�ØÜ�6‹?˜aÔØá˜t×$ä—&’&˜Ÿ™Ó% aÕ(×,Ñ,¿<­ZÌYÓW€D„KÜ˜4  n°f¸eØ+¸RóAð Aùów Qs   ¾ Oc           	      ó~  € V! V 4      pVP                  V4      '       d™   \        WW#WuV4       V'       d	   Ws,          pV( pW8,          pV'       gh   V P                  4        F,  w  ršV	R9   d   K  \        V
R^ 4      ^ 8”  d	   W¨,          MT
W	&   K.  	  V P                   Uu. uF  q»V,          NK  	  upV n        V# u upi )r   rN   >   Únr   )ÚanyÚ_update_activeÚitemsÚgetattrr   )rU   rc   r]   r`   rZ   r2   r   ÚstopÚproceedÚkeyÚvalr7   s   &&&&&&&     r   rL   rL     s©   € ñ
 ˜TÓ"€Dà	‡v�vˆd‡|‚|ô 	�t .¸$ÐPRÔSçØ•<ˆDà�%ˆØ•ˆçà ŸJ™JžL‘�à˜-Ô'ÙÜ,3°C¸ÀÓ,CÀaÔ,G˜CžLÈS�“	ñ	 )ð
 26·²Ó;±¨#˜WŸ˜±Ñ;ˆDŒIà€Mùò <s   ÂB:c                 ó¬  € V UUu/ uF  w  rxWpV,          bK  	  p	ppV P                   ^ 8H  V	R&   VEe,   V'       d±   VP                  V4      p
\        P                  ! V
4      V,          P	                  R4      p
W¤,          p
V	P                  4        FU  w  r¼\        VR^ 4      ^ 8”  d	   WÊ,          MTp\        P                  ! W,          4      V
,          P	                  V4      W&   KW  	  R# W4,          p
V	P                  4        FU  w  r¼\        VR^ 4      ^ 8”  d	   WÄ,          MTp\        P                  ! W,          4      V
,          P	                  V4      W&   KW  	  R# V	P                  4        F[  w  r¼V'       d   \        VR^ 4      ^ 8”  d	   WÃ,          p\        P                  ! W,          4      V,          P	                  V4      W&   K]  	  R# u uppi )r   r>   NTrN   )r?   Ú
zeros_likerP   rQ   rR   rm   rn   )rU   rc   r]   r`   Úmaskr2   r   Úkey1Úkey2Úupdate_dictÚactive_maskrq   rr   s   &&&&&&&      r   rl   rl   9  su  € ñ
 7EÔE±n©
¨�4˜d�Ò#±n€KÑEØ!Ÿ[™[¨AÑ-€K�	ÑàÓßØŸ-™-¨Ó-ˆKÜŸ&š& Ó-¨fÕ5×9Ñ9¸$Ó?ˆKØ%Õ,ˆKØ'×-Ñ-Ö/‘�Ü*1°#°v¸qÓ*AÀAÔ*E�cÖ&È3�ÜŸ6š6 #¥(Ó+¨KÕ8×<Ñ<¸SÓA�“ó 0ð !�,ˆKØ'×-Ñ-Ö/‘�Ü#*¨3°¸Ó#:¸QÔ#>�c–iÀC�ÜŸ6š6 #¥(Ó+¨KÕ8×<Ñ<¸SÓA�“ó 0ð $×)Ñ)Ö+‰HˆCß¤'¨#¨v°qÓ"9¸AÔ"=Ø•k�Ü—v’v˜c�hÓ'¨Õ/×3Ñ3°CÓ8ˆC‹Hó ,ùó# Fs   †Gc           	      óB  € VP                  4       p\        WW#R Wg4       V! W4      pVP                  4        F4  w  r‰VP                  W”4      p
V
P                  ^ 8X  d
   V
R,          MT
W&   K6  	  R.V UUu. uF  w  r¼VNK	  	  upp,           VR&   \        R/ VB # u uppi )Nr>   Ú_order_keys© )r   rl   rm   r/   rN   r   )rU   rc   r]   r`   r   r\   r2   r   rq   rr   rd   r   ra   s   &&&&&&&&     r   rM   rM   U  s–   € ð
 �(‰(‹*€CÜ�4˜n°d¸NÔOá˜SÓ(€Eà—I‘I–K‰ˆà�z‰z˜#Ó%ˆØ#Ÿy™y¨Aœ~�4˜–8°4ˆ‹ñ  ð
 $˜±nÔ'E±n©d¨a«±nÒ'EÕE€CˆÑÜÑ˜ÑÐùó (Fs   Á6Br!   éþÿÿÿéýÿÿÿéüÿÿÿéûÿÿÿ)NFNN)F)rD   Únumpyr'   Ú_utilr   r   Ú
_array_apir   r   r   Úscipy._external.array_api_extraÚ	_externalÚarray_api_extrarP   Ú	_ESIGNERRrT   Ú
_EVALUEERRrS   Ú
_EINPUTERRÚ_ECONVERGEDrJ   r<   rh   rL   rl   rM   r|   r   r   Ú<module>r‹      s]   ðó Û ß 9ß @Ñ @ß -Ð -à€	Ø€	Ø€
Ø€
Ø€
Ø€Ø€ôk/ô\MAò`ò<9ô8r   