+
    Y°³j]7  ã                   ól   € ^ RI t ^ RIt^RIHt ]P
                  ! ]4      P                  tR t	R t
R tR# )é    N)Úget_arrays_tolc           	     ó  a€ V'       Ed”   \        V \        4      '       g   Q h\        V\        P                  4      '       d   VP                  ^8X  g   Q h\
        P                  ! S4      P                  V4      '       g   Q h\        V\        P                  4      '       d   VP                  VP                  8X  g   Q h\        V\        P                  4      '       d   VP                  VP                  8X  g   Q h\        V\        4      '       g   Q h\        V\        4      '       g   Q h\        W44      p\        P                  ! W78*  4      '       g   Q h\        P                  ! WG) 8¬  4      '       g   Q h\        P                  ! V4      '       d   VR8”  g   Q h\        P                  ! VR4      p\        P                  ! VR4      p\        WSW4WV4      w  r‰\        V ) V) V3R lVVVV4      w  r«\!        V	4      \!        V4      8¼  d   TMT
pV'       dn   \        P                  ! W<8*  4      '       g   Q h\        P                  ! WÄ8*  4      '       g   Q h\        P"                  P%                  V4      RV,          8  g   Q hV# )ao  
Maximize approximately the absolute value of a quadratic function subject
to bound constraints in a trust region.

This function solves approximately

.. math::

    \max_{s \in \mathbb{R}^n} \quad \bigg\lvert c + g^{\mathsf{T}} s +
    \frac{1}{2} s^{\mathsf{T}} H s \bigg\rvert \quad \text{s.t.} \quad
    \left\{ \begin{array}{l}
        l \le s \le u,\\
        \lVert s \rVert \le \Delta,
    \end{array} \right.

by maximizing the objective function along the constrained Cauchy
direction.

Parameters
----------
const : float
    Constant :math:`c` as shown above.
grad : `numpy.ndarray`, shape (n,)
    Gradient :math:`g` as shown above.
curv : callable
    Curvature of :math:`H` along any vector.

        ``curv(s) -> float``

    returns :math:`s^{\mathsf{T}} H s`.
xl : `numpy.ndarray`, shape (n,)
    Lower bounds :math:`l` as shown above.
xu : `numpy.ndarray`, shape (n,)
    Upper bounds :math:`u` as shown above.
delta : float
    Trust-region radius :math:`\Delta` as shown above.
debug : bool
    Whether to make debugging tests during the execution.

Returns
-------
`numpy.ndarray`, shape (n,)
    Approximate solution :math:`s`.

Notes
-----
This function is described as the first alternative in Section 6.5 of [1]_.
It is assumed that the origin is feasible with respect to the bound
constraints and that `delta` is finite and positive.

References
----------
.. [1] T. M. Ragonneau. *Model-Based Derivative-Free Optimization Methods
   and Software*. PhD thesis, Department of Applied Mathematics, The Hong
   Kong Polytechnic University, Hong Kong, China, 2022. URL:
   https://theses.lib.polyu.edu.hk/handle/200/12294.
ç        c                 ó   <€ S! V 4      ) # )N© )ÚxÚcurvs   &€Úk/home/luca/screen-checking/.venv/lib/python3.14/site-packages/scipy/_external/cobyqa/subsolvers/geometry.pyÚ<lambda>Ú!cauchy_geometry.<locals>.<lambda>[   s   ø€ ‘4˜“7‘(ó    çš™™™™™ñ?)Ú
isinstanceÚfloatÚnpÚndarrayÚndimÚinspectÚ	signatureÚbindÚshapeÚboolr   ÚallÚisfiniteÚminimumÚmaximumÚ_cauchy_geomÚabsÚlinalgÚnorm)ÚconstÚgradr	   ÚxlÚxuÚdeltaÚdebugÚtolÚstep1Úq_val1Ústep2Úq_val2Ústeps   &&f&&&&      r
   Úcauchy_geometryr-      sî  ø€ ÷t €uÜ˜%¤×'Ò'Ð'Ð'Ü˜$¤§
¡
×+Ò+°·	±	¸Q´Ð>Ð>Ü× Ò  Ó&×+Ñ+¨D×1Ò1Ð1Ð1Ü˜"œbŸj™j×)Ò)¨b¯h©h¸$¿*¹*Ô.DÐDÐDÜ˜"œbŸj™j×)Ò)¨b¯h©h¸$¿*¹*Ô.DÐDÐDÜ˜%¤×'Ò'Ð'Ð'Ü˜%¤×&Ò&Ð&Ð&Ü˜RÓ$ˆÜ�vŠv�b‘i× Ò Ð Ð Ü�vŠv�b˜D‘j×!Ò!Ð!Ð!Ü�{Š{˜5×!Ò! e¨c¤kÐ1Ð1Ü	�Š�B˜Ó	€BÜ	�Š�B˜Ó	€Bô
 ! ¨d°B¸EÓI�M€EÜ Ø	ˆØ	ˆÜØ
Ø
ØØó�M€Eô ˜“K¤3 v£;Ô.‰5°E€DçÜ�vŠv�b‘j×!Ò!Ð!Ð!Ü�vŠv�d‘j×!Ò!Ð!Ð!Ü�y‰y�~‰~˜dÓ# c¨E¥kÔ1Ð1Ð1Ø€Kr   c                óv  € V'       Edé   \        V \        4      '       g   Q h\        V\        P                  4      '       d   VP                  ^8X  g   Q h\
        P                  ! V4      P                  V4      '       g   Q h\        V\        P                  4      '       d4   VP                  ^8X  d#   VP                  ^ ,          VP                  8X  g   Q h\        V\        P                  4      '       d   VP                  VP                  8X  g   Q h\        V\        P                  4      '       d   VP                  VP                  8X  g   Q h\        V\        4      '       g   Q h\        V\        4      '       g   Q h\        WE4      p\        P                  ! WH8*  4      '       g   Q h\        P                  ! WX) 8¬  4      '       g   Q h\        P                  ! V4      '       d   VR8”  g   Q h\        P                  ! VR4      p\        P                  ! VR4      p\        P                   ! V4      p	T p
\        P"                  P%                  V^ R7      pV\        P&                  ) 8„  VP(                  \*        ) V,          8„  ,          pV\        P&                  ) 8„  VP(                  \*        V,          8  ,          pV\        P&                  8  VP(                  \*        V,          8„  ,          pV\        P&                  8  VP(                  \*        ) V,          8  ,          p\        P,                  ! \        P.                  ! WLP                  4      V,          VP(                  V,          ,          4      p\        P0                  ! V^\        P&                  ) R7      p\        P.                  ! \        P2                  ! V4      VP                  ^,          4      p\        P,                  ! \        P.                  ! WMP                  4      V,          VP(                  V,          ,          4      p\        P0                  ! V^\        P&                  R7      p\        P.                  ! \        P2                  ! V4      VP                  ^,          4      p\        P,                  ! \        P.                  ! W_P                  4      V,          VP(                  V,          ,          4      p\        P0                  ! V^\        P&                  ) R7      p\        P.                  ! \        P2                  ! V4      VP                  ^,          4      p\        P,                  ! \        P.                  ! W^P                  4      V,          VP(                  V,          ,          4      p\        P0                  ! V^\        P&                  R7      p\        P.                  ! \        P2                  ! V4      VP                  ^,          4      p\5        VP                  ^,          4       EF$  pVV,          \*        V,          8”  d   \1        WkV,          ,          R4      pMK9  \1        \7        VV,          VV,          4      R4      p\7        \1        VV,          VV,          4      R4      pWRV3,          ,          pV! VRV3,          4      pVR8¼  d   V\*        ) V,          8  g   VR8:  d)   V\*        ) V,          8”  d   \1        V) V,          R4      pM\        P&                  pVR8¼  d   V\*        V,          8”  g   VR8:  d(   V\*        V,          8  d   \7        V) V,          R4      pM\        P&                  ) p\7        VV4      p\1        V) V4      pV VV,          ,           RVR,          ,          V,          ,           pV VV,          ,           RVR,          ,          V,          ,           pVV8  dJ   V VV,          ,           RVR,          ,          V,          ,           p \9        V 4      \9        V4      8”  d   TpT pVV8”  dJ   V VV,          ,           RVR,          ,          V,          ,           p!\9        V!4      \9        V4      8”  d   TpT!p\9        V4      \9        V4      8¼  dF   \9        V4      \9        V
4      8”  d-   \        P:                  ! VVRV3,          ,          WE4      p	Tp
EKÃ  \9        V4      \9        V4      8”  g   EKß  \9        V4      \9        V
4      8”  g   EKû  \        P:                  ! VVRV3,          ,          WE4      p	Tp
EK'  	  V'       dn   \        P                  ! WI8*  4      '       g   Q h\        P                  ! W•8*  4      '       g   Q h\        P"                  P%                  V	4      RV,          8  g   Q hV	# )a  
Maximize approximately the absolute value of a quadratic function subject
to bound constraints in a trust region.

This function solves approximately

.. math::

    \max_{s \in \mathbb{R}^n} \quad \bigg\lvert c + g^{\mathsf{T}} s +
    \frac{1}{2} s^{\mathsf{T}} H s \bigg\rvert \quad \text{s.t.} \quad
    \left\{ \begin{array}{l}
        l \le s \le u,\\
        \lVert s \rVert \le \Delta,
    \end{array} \right.

by maximizing the objective function along given straight lines.

Parameters
----------
const : float
    Constant :math:`c` as shown above.
grad : `numpy.ndarray`, shape (n,)
    Gradient :math:`g` as shown above.
curv : callable
    Curvature of :math:`H` along any vector.

        ``curv(s) -> float``

    returns :math:`s^{\mathsf{T}} H s`.
xpt : `numpy.ndarray`, shape (n, npt)
    Points defining the straight lines. The straight lines considered are
    the ones passing through the origin and the points in `xpt`.
xl : `numpy.ndarray`, shape (n,)
    Lower bounds :math:`l` as shown above.
xu : `numpy.ndarray`, shape (n,)
    Upper bounds :math:`u` as shown above.
delta : float
    Trust-region radius :math:`\Delta` as shown above.
debug : bool
    Whether to make debugging tests during the execution.

Returns
-------
`numpy.ndarray`, shape (n,)
    Approximate solution :math:`s`.

Notes
-----
This function is described as the second alternative in Section 6.5 of
[1]_. It is assumed that the origin is feasible with respect to the bound
constraints and that `delta` is finite and positive.

References
----------
.. [1] T. M. Ragonneau. *Model-Based Derivative-Free Optimization Methods
   and Software*. PhD thesis, Department of Applied Mathematics, The Hong
   Kong Polytechnic University, Hong Kong, China, 2022. URL:
   https://theses.lib.polyu.edu.hk/handle/200/12294.
r   )Úaxis)r/   Úinitial:NNNç      à?ç       @r   )r   r   r   r   r   r   r   r   r   Úsizer   r   r   r   r   r   Ú
zeros_liker   r    ÚinfÚTÚTINYÚ
atleast_2dÚbroadcast_toÚmaxÚ
atleast_1dÚrangeÚminr   Úclip)"r!   r"   r	   Úxptr#   r$   r%   r&   r'   r,   Úq_valÚs_normÚi_xl_posÚi_xl_negÚi_xu_posÚi_xu_negÚalpha_xl_posÚalpha_xl_negÚalpha_xu_negÚalpha_xu_posÚkÚalpha_trÚalpha_bd_posÚalpha_bd_negÚ	grad_stepÚ	curv_stepÚalpha_quad_posÚalpha_quad_negÚ	alpha_posÚ	alpha_negÚ	q_val_posÚ	q_val_negÚq_val_quad_posÚq_val_quad_negs"   &&&&&&&&                          r
   Úspider_geometryrX   j   sï  € ÷x €uÜ˜%¤×'Ò'Ð'Ð'Ü˜$¤§
¡
×+Ò+°·	±	¸Q´Ð>Ð>Ü× Ò  Ó&×+Ñ+¨D×1Ò1Ð1Ð1ä�sœBŸJ™J×'Ò'Ø—‘˜A”Ø—	‘	˜!• §	¡	Ô)ð	
ð*ô ˜"œbŸj™j×)Ò)¨b¯h©h¸$¿*¹*Ô.DÐDÐDÜ˜"œbŸj™j×)Ò)¨b¯h©h¸$¿*¹*Ô.DÐDÐDÜ˜%¤×'Ò'Ð'Ð'Ü˜%¤×&Ò&Ð&Ð&Ü˜RÓ$ˆÜ�vŠv�b‘i× Ò Ð Ð Ü�vŠv�b˜D‘j×!Ò!Ð!Ð!Ü�{Š{˜5×!Ò! e¨c¤kÐ1Ð1Ü	�Š�B˜Ó	€BÜ	�Š�B˜Ó	€Bô �=Š=˜Ó€DØ€EÜ�Y‰Y�^‰^˜C aˆ^Ó(€Fð ”b—f‘f�W‘ §¡¬$¨°­Ñ!3Õ4€HØ”b—f‘f�W‘ §¡¬°­Ñ!2Õ3€HØ”R—V‘V‘ §¡¬¨r­	Ñ 1Õ2€HØ”R—V‘V‘ §¡¬¨°­
Ñ 2Õ3€Hô —=’=Ü
�Š˜ŸN™NÓ+¨HÕ5¸¿¹¸h½ÕGó€Lô —6’6˜,¨Q¼¿¹¸Ô@€Lä—?’?¤2§=¢=°Ó#>ÀÇ	Á	È!ÅÓM€Lä—=’=Ü
�Š˜ŸN™NÓ+¨HÕ5¸¿¹¸h½ÕGó€Lô —6’6˜,¨Q¼¿¹Ô?€LÜ—?’?¤2§=¢=°Ó#>ÀÇ	Á	È!ÅÓM€Lä—=’=Ü
�Š˜ŸN™NÓ+¨HÕ5¸¿¹¸h½ÕGó€Lô —6’6˜,¨Q¼¿¹¸Ô@€LÜ—?’?¤2§=¢=°Ó#>ÀÇ	Á	È!ÅÓM€Lä—=’=Ü
�Š˜ŸN™NÓ+¨HÕ5¸¿¹¸h½ÕGó€Lô —6’6˜,¨Q¼¿¹Ô?€LÜ—?’?¤2§=¢=°Ó#>ÀÇ	Á	È!ÅÓM€Lä�3—9‘9˜Q•<× ˆà�!�9”t˜e•|Ô#Ü˜5¨!¥9Õ,¨cÓ2‰Hñ äœ3˜|¨A�°¸QµÓ@À#ÓFˆÜœ3˜|¨A�°¸QµÓ@À#ÓFˆð ˜q !˜t�9Õ$ˆ	Ù˜˜Q ˜T�“Oˆ	à˜ÔØœT˜E IÕ-Ô-Ø˜CÔØœT˜E IÕ-Ô-ä  ) ¨iÕ!7¸Ó=‰NäŸV™VˆNà˜ÔØœD 9Õ,Ô,Ø˜CÔØœD 9Õ,Ô,ä  ) ¨iÕ!7¸Ó=‰Nä Ÿf™f˜WˆNô ˜ ,Ó/ˆ	Ü˜˜	 <Ó0ˆ	à�I 	Õ)Õ)¨C°)¸Sµ.Õ,@À9Õ,LÕLð 	ð �I 	Õ)Õ)¨C°)¸Sµ.Õ,@À9Õ,LÕLð 	ð ˜IÔ%àØ  9Õ,õ-à˜¨Õ+Õ+¨iÕ7õ8ð ô
 �>Ó"¤S¨£^Ô3Ø*�	Ø*�	Ø˜IÔ%àØ  9Õ,õ-à˜¨Õ+Õ+¨iÕ7õ8ð ô
 �>Ó"¤S¨£^Ô3Ø*�	Ø*�	Üˆy‹>œS ›^Ô+´°I³ÄÀUÃÔ0KÜ—7’7˜9 s¨1¨a¨4¥yÕ0°"Ó9ˆDØ‹EÜ�‹^œc )›n×,´°Y³Ä#ÀeÃ*×1LÜ—7’7˜9 s¨1¨a¨4¥yÕ0°"Ó9ˆDØ‹EñU !÷X Ü�vŠv�b‘j×!Ò!Ð!Ð!Ü�vŠv�d‘j×!Ò!Ð!Ð!Ü�y‰y�~‰~˜dÓ# c¨E¥kÔ1Ð1Ð1Ø€Kr   c                ó¾  € VR8  VR8„  ,          pVR8„  VR8  ,          p\         P                  ! V4      p	W7,          W—&   WH,          W˜&   \         P                  P                  V	4      V8”  Ed   Wx,          p
 \         P                  P                  W,          4      p\         P                  ! VR,          Wš( ,          Wš( ,          ,          ,
          4      pV\
        \        V4      ,          8”  d   \        WË,          R4      pMM‡WÑV
,          ,          Wš&   W©V8  ,          pW©V8„  ,          p\         P                  ! V4      '       g   \         P                  ! V4      '       g   M'W7,          W—&   WH,          W˜&   W§V,          ( ,          p
EK  W,          pVR8¼  Ed²   \         P                  P                  V	4      pV\
        V,          8”  d   \        W_,          R4      pMRpV! V	4      pV\
        ) V,          8  d   \        V) V,          R4      pM\         P                  pV\         P                  ) 8„  V	\
        V,          8  ,          pV\         P                  8  V	\
        V,          8„  ,          p\         P                  ! VV,          V	V,          ,          \         P                  R7      p\         P                  ! VV,          V	V,          ,          \         P                  R7      p\        VV4      p\        VVV4      p\         P                  ! VV	,          W44      pV VV,          ,           RVR,          ,          V,          ,           pM\         P                  ! V4      pT pV'       dp   \         P                  ! VV8*  4      '       g   Q h\         P                  ! VV8*  4      '       g   Q h\         P                  P                  V4      RV,          8  g   Q hVV3# )zE
Same as `bound_constrained_cauchy_step` without the absolute value.
r   r2   )r0   r1   r   )r   r4   r   r    Úsqrtr7   r   r:   Úanyr5   r=   r>   r   )r!   r"   r	   r#   r$   r%   r&   Úfixed_xlÚfixed_xuÚcauchy_stepÚworkingÚg_normÚdelta_reducedÚmurN   rA   rK   rO   Ú
alpha_quadÚi_xlÚi_xuÚalpha_xlÚalpha_xuÚalpha_bdÚalphar,   r@   s   &&&&&&&                    r
   r   r   8  sþ  € ð
 �S‘˜T C™ZÕ(€HØ�S‘˜T C™ZÕ(€Hô —-’- Ó%€KØ�L€KÑØ�L€KÑÜ	‡y�y‡~�~�kÓ" UÕ*ØÕ%ˆØä—Y‘Y—^‘^ D¥MÓ2ˆFÜŸGšGØ�s•
˜[¨Õ2°[ÀÕ5JÕJÕJóˆMð œœs =Ó1Õ1Ô1Ü˜Õ/°Ó5‘àØ#%¨W­Õ#5ˆKÑ ð °Ñ"2Õ3ˆHØ°Ñ"2Õ3ˆHÜ—6’6˜(×#Ò#¬B¯FªF°8×,<Ò,<àØ$&¥LˆKÑ!Ø$&¥LˆKÑ!Ø¨XÕ"5Ð 6Õ6‹Gð Õ"€IØ�CÕä—‘—‘ Ó,ˆØ”D˜5•LÔ Ü˜5�>¨3Ó/‰Hð ˆHñ ˜Ó%ˆ	Øœ�u˜yÕ(Ô(Ü˜i˜Z¨)Õ3°SÓ9‰JäŸ™ˆJð ”b—f‘f�W‘ ¬t°b­yÑ!8Õ9ˆØ”R—V‘V‘ ¬d°R­iÑ 7Õ8ˆÜ—6’6˜"˜T�( [°Õ%6Õ6ÄÇÁÔGˆÜ—6’6˜"˜T�( [°Õ%6Õ6ÄÇÁÔGˆÜ�x Ó*ˆô �H˜j¨(Ó3ˆÜ�wŠw�u˜{Õ*¨BÓ3ˆØ˜ 	Õ)Õ)¨C°%¸µ*Õ,<¸yÕ,HÕH‰ô �}Š}˜TÓ"ˆØˆçÜ�vŠv�b˜D‘j×!Ò!Ð!Ð!Ü�vŠv�d˜b‘j×!Ò!Ð!Ð!Ü�y‰y�~‰~˜dÓ# c¨E¥kÔ1Ð1Ð1Ø�ˆ;Ðr   )r   Únumpyr   Úutilsr   Úfinfor   Útinyr7   r-   rX   r   r   r   r
   Ú<module>rn      s7   ðÛ ã å "ð 
‡x‚x�ƒ×Ñ€ò\ò~Kô\Kr   