+
    LV-jÆ  ã                   ó¼   € ^ RI t ^ RIt^ RIHt ^RIHt ^RIHtH	t	H
t
 ]P                  ! ]4      P                  t ! R R4      tR t ! R R	4      t ! R
 R4      tR# )é    N)Úeigh)ÚOptions)ÚMaxEvalErrorÚTargetSuccessÚFeasibleSuccessc                   ó¸   a € ] tR t^t o RtR t]R 4       t]R 4       t]R 4       t	]	P                  R 4       t	]R 4       t]P                  R 4       tR	 tR
tV tR# )ÚInterpolationzÃ
Interpolation set.

This class stores a base point around which the models are expanded and the
interpolation points. The coordinates of the interpolation points are
relative to the base point.
c                ó¤  € V\         P                  ,          V n        R\        P                  ! VP
                  P                  VP
                  P                  ,
          4      ,          pV\         P                  ,          V8”  de   W2\         P                  P                  &   \        P                  ! V\         P                  ,          V.4      V\         P                  P                  &   \        P                  ! VP                  4      V n        V P                  VP
                  P                  RV\         P                  ,          ,          ,           8*  pVP
                  P                  V,          V P                  V&   VP
                  P                  RV\         P                  ,          ,          ,           V P                  8  V P                  VP
                  P                  V\         P                  ,          ,           8*  ,          p\        P                  ! VP
                  P                  V,          V\         P                  ,          ,           VP
                  P                  V,          4      V P                  V&   V P                  VP
                  P                  RV\         P                  ,          ,          ,
          8¬  pVP
                  P                  V,          V P                  V&   V P                  VP
                  P                  RV\         P                  ,          ,          ,
          8  VP
                  P                  V\         P                  ,          ,
          V P                  8*  ,          p\        P                   ! VP
                  P                  V,          V\         P                  ,          ,
          VP
                  P                  V,          4      V P                  V&   \        P"                  ! VP$                  V\         P&                  ,          34      V n        \+        ^V\         P&                  ,          4       EFy  pW�P$                  8:  du   Wh^,
          ,          '       d1   V\         P                  ,          ) V P,                  V^,
          V3&   KY  V\         P                  ,          V P,                  V^,
          V3&   Kˆ  V^VP$                  ,          8:  Ed   WHVP$                  ,
          ^,
          ,          '       dH   RV\         P                  ,          ,          V P,                  W�P$                  ,
          ^,
          V3&   EK  WhVP$                  ,
          ^,
          ,          '       dH   RV\         P                  ,          ,          V P,                  W�P$                  ,
          ^,
          V3&   EK{  V\         P                  ,          ) V P,                  W�P$                  ,
          ^,
          V3&   EK¼  W�P$                  ,
          ^,
          VP$                  ,          p	V^V	,           VP$                  ,          ,
          ^,
          p
W©,           VP$                  ,          pV P,                  Wª^,           3,          V P,                  W¨3&   V P,                  W»^,           3,          V P,                  W¸3&   EK|  	  RV n        R# )zœ
Initialize the interpolation set.

Parameters
----------
pb : `cobyqa.problem.Problem`
    Problem to be solved.
options : dict
    Options of the solver.
ç      à?ç       @Ng       À)r   ÚDEBUGÚ_debugÚnpÚminÚboundsÚxuÚxlÚRHOBEGÚvalueÚRHOENDÚcopyÚx0Ú_x_baseÚx_baseÚminimumÚmaximumÚzerosÚnÚNPTÚ_xptÚrangeÚxptÚ
_lhs_cache)ÚselfÚpbÚoptionsÚ
max_radiusÚvery_close_xl_idxÚclose_xl_idxÚvery_close_xu_idxÚclose_xu_idxÚkÚspreadÚk1Úk2s   &&&         Úi/Volumes/fast/ai/experiments/ui-tars-smoke/.venv/lib/python3.14/site-packages/scipy/_lib/cobyqa/models.pyÚ__init__ÚInterpolation.__init__   s@  € ð œgŸm™mÕ,ˆŒØœ2Ÿ6š6 "§)¡)§,¡,°·±·±Õ"=Ó>Õ>ˆ
Ø”7—>‘>Õ" ZÔ/Ø,6”G—N‘N×(Ñ(Ñ)Ü,.¯FªFàœGŸN™NÕ+Øðó-ˆG”G—N‘N×(Ñ(Ñ)ô —w’w˜rŸu™u“~ˆŒà�K‰K˜2Ÿ9™9Ÿ<™<¨#°¼¿¹Õ0GÕ*GÕGÑGð 	ð *,¯©¯©Ð6GÕ)Hˆ�‰Ð%Ñ&à�I‰I�L‰L˜3 ¬¯©Õ!8Õ8Õ8¸4¿;¹;ÑFØ�[‰[˜BŸI™IŸL™L¨7´7·>±>Õ+BÕBÑBõDˆô %'§J¢JØ�I‰I�L‰L˜Õ&¨´·±Õ)@Õ@Ø�I‰I�L‰L˜Õ&ó%
ˆ�‰�LÑ!ð
 �K‰K˜2Ÿ9™9Ÿ<™<¨#°¼¿¹Õ0GÕ*GÕGÑGð 	ð *,¯©¯©Ð6GÕ)Hˆ�‰Ð%Ñ&à�K‰K˜"Ÿ)™)Ÿ,™,¨¨w´w·~±~Õ/FÕ)FÕFÑFØ�Y‰Y�\‰\˜G¤G§N¡NÕ3Õ3°t·{±{ÑBõDˆô %'§J¢JØ�I‰I�L‰L˜Õ&¨´·±Õ)@Õ@Ø�I‰I�L‰L˜Õ&ó%
ˆ�‰�LÑ!ô —H’H˜bŸd™d G¬G¯K©KÕ$8Ð9Ó:ˆŒ	Ü�q˜'¤'§+¡+Õ.×/ˆAØ—D‘DŒyØ$¨¥U×+Ô+Ø*1´'·.±.Õ*AÐ)A�D—H‘H˜Q �U A˜XÓ&à)0´·±Õ)@�D—H‘H˜Q �U A˜XÓ&Ø�a˜"Ÿ$™$•h•Ø$¨¯©¥X°¥\×2Ô2Ø03°g¼g¿n¹nÕ6MÕ0M�D—H‘H˜Q§¡�X¨�\¨1˜_Ô-Ø&¨2¯4©4¥x°!¥|×4Ô4Ø04°w¼w¿~¹~Õ7NÕ0N�D—H‘H˜Q§¡�X¨�\¨1˜_Ô-à18¼¿¹Õ1HÐ0H�D—H‘H˜Q§¡�X¨�\¨1˜_Ô-àŸd™d�( Q�,¨2¯4©4Õ/�Ø˜!˜f�*¨¯©Õ,Õ,¨qÕ0�Ø•k R§T¡TÕ)�Ø"&§(¡(¨2°A­v¨:Õ"6�—‘˜˜‘Ø"&§(¡(¨2°A­v¨:Õ"6�—‘˜˜”ñ% 0ð& ˆŽó    c                ó<   € V P                   P                  ^ ,          # ©zD
Number of variables.

Returns
-------
int
    Number of variables.
©r"   Úshape©r$   s   &r0   r   ÚInterpolation.n]   ó   € ð �x‰x�~‰~˜aÕ Ð r3   c                ó<   € V P                   P                  ^,          # ©zZ
Number of interpolation points.

Returns
-------
int
    Number of interpolation points.
r6   r8   s   &r0   ÚnptÚInterpolation.npti   r:   r3   c                ó   € V P                   # )zb
Interpolation points.

Returns
-------
`numpy.ndarray`, shape (n, npt)
    Interpolation points.
)r    r8   s   &r0   r"   ÚInterpolation.xptu   s   € ð �y‰yÐr3   c                ó’   € V P                   '       d/   VP                  V P                  V P                  38X  g   Q R4       hWn        R# )zz
Set the interpolation points.

Parameters
----------
xpt : `numpy.ndarray`, shape (n, npt)
    New interpolation points.
z The shape of `xpt` is not valid.N)r   r7   r   r=   r    )r$   r"   s   &&r0   r"   r@   �   sG   € ð �;�;ˆ;Ø—9‘9Ø—‘Ø—‘ð!ô ð 2ð 2ó2ð ð Ž	r3   c                ó   € V P                   # )z”
Base point around which the models are expanded.

Returns
-------
`numpy.ndarray`, shape (n,)
    Base point around which the models are expanded.
)r   r8   s   &r0   r   ÚInterpolation.x_base’   s   € ð �|‰|Ðr3   c                ó|   € V P                   '       d$   VP                  V P                  38X  g   Q R4       hWn        R# )z¯
Set the base point around which the models are expanded.

Parameters
----------
x_base : `numpy.ndarray`, shape (n,)
    New base point around which the models are expanded.
z#The shape of `x_base` is not valid.N)r   r7   r   r   )r$   r   s   &&r0   r   rC   ž   s>   € ð �;�;ˆ;Ø—<‘<Ø—‘ð$ô ð 5à4ó5ð ð Žr3   c                óÂ   € V P                   '       d)   ^ Tu;8:  d   V P                  8  g   Q R4       h Q R4       hV P                  V P                  RV3,          ,           # )zä
Get the `k`-th interpolation point.

The return point is relative to the origin.

Parameters
----------
k : int
    Index of the interpolation point.

Returns
-------
`numpy.ndarray`, shape (n,)
    `k`-th interpolation point.
zThe index `k` is not valid.ºNNN)r   r=   r   r"   )r$   r,   s   &&r0   ÚpointÚInterpolation.point®   sQ   € ð  �;�;ˆ;Ø˜Ö$˜DŸH™HÔ$ÐCÐ&CÓCÑ$ÐCÐ&CÓCÐ$Ø�{‰{˜TŸX™X a¨ d�^Õ+Ð+r3   )r   r#   r   r    N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r1   Úpropertyr   r=   r"   Úsetterr   rG   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r0   r	   r	      s›   ø‡ € ñòEðN ñ	!ó ð	!ð ñ	!ó ð	!ð ñ	ó ð	ð 	‡Z�Zñó ðð  ñ	ó ð	ð ‡]�]ñó ð÷,ð ,r3   r	   c           	     ó   € V P                   pVeI   \        P                  ! V P                  VR,          4      '       d   VR,          VR,          VR,          3# \        P                  ! \        P
                  P                  V P                  ^ R7      \        R7      pV P                  V,          pVP                  w  rE\        P                  ! WT,           ^,           WT,           ^,           34      pRVP                  V,          R	,          ,          VRV1RV13&   R
VRV1V3&   VP                  VRV1V^,           R13&   R
WeRV13&   W6V^,           R1RV13&   \        P                  ! WT,           ^,           4      pR
VR	,          ,          VRV% VR	,          Wu&   W'V^,           R% \        VRR7      w  r‰R\        P                  ! V P                  4      R\        P                  ! V4      R\        P                  ! V4      RW‰3/p
W n         WgW‰33# )aa  
Build the left-hand side matrix of the interpolation system. The
matrix below stores W * diag(right_scaling),
where W is the theoretical matrix of the interpolation system. The
right scaling matrices is chosen to keep the elements in
the matrix well-balanced.

Parameters
----------
interpolation : `cobyqa.models.Interpolation`
    Interpolation set.
Nr"   ÚaÚright_scalingr   )Úaxis©Úinitialr   r   ç      ð?F)Úcheck_finite)r#   r   Úarray_equalr"   ÚmaxÚlinalgÚnormÚEPSr7   r   ÚTÚemptyr   r   )ÚinterpolationÚ_cacheÚscaleÚ	xpt_scaler   r=   rU   rV   Ú
eig_valuesÚeig_vectorsÚ	new_caches   &          r0   Úbuild_systemrj   Ã   s×  € ð ×%Ñ%€Fð ÒœbŸnšnØ×Ñ˜6 %�=÷ò ð �c�{˜F ?Õ3°V¸Fµ^ÐCÐCä�FŠF”2—9‘9—>‘> -×"3Ñ"3¸!�>Ó<ÄcÔJ€EØ×!Ñ! EÕ)€Ià�_‰_�F€AÜ
�Š�#•'˜A•+˜s�w¨�{Ð+Ó,€AØ˜9Ÿ;™;¨Õ2°sÕ:Õ:€A€d€s€dˆDˆSˆD€j�MØ€A€d€s€dˆC€i�LØ!Ÿ™€A€d€s€dˆC�!�G‰H€nÑØ€Aˆ4ˆCˆ4€i�LØ!€cˆA…g�h���€nÑô —H’H˜S�W q�[Ó)€MØ  s¥
Õ*€M�$�3ÐØ �€MÑØ#�#˜•'�(Ðä" 1°5Ô9Ñ€Jð 	Œr�wŠw�}×(Ñ(Ó)ØŒR�WŠW�Q‹ZØœŸš Ó/Ø�Ð)ð	€Ið  )Ôà˜jÐ6Ð6Ð6r3   c                   ó”   a € ] tR t^øt o RtR tR t]R 4       t]R 4       t	R t
R tR tR	 tR
 tR t]R 4       t]R 4       tRtV tR# )Ú	Quadratica  
Quadratic model.

This class stores the Hessian matrix of the quadratic model using the
implicit/explicit representation designed by Powell for NEWUOA [1]_.

References
----------
.. [1] M. J. D. Powell. The NEWUOA software for unconstrained optimization
   without derivatives. In G. Di Pillo and M. Roma, editors, *Large-Scale
   Nonlinear Optimization*, volume 83 of Nonconvex Optim. Appl., pages
   255--297. Springer, Boston, MA, USA, 2006. `doi:10.1007/0-387-30065-1_16
   <https://doi.org/10.1007/0-387-30065-1_16>`_.
c                ó®  € W0n         V P                   '       d$   VP                  VP                  38X  g   Q R4       hVP                  VP                  ^,           8  d!   \	        RVP                  ^,            R24      hV P                  VV4      w  V n        V n        V n        p\        P                  ! V P                  V P                  34      V n        R# )aŠ  
Initialize the quadratic model.

Parameters
----------
interpolation : `cobyqa.models.Interpolation`
    Interpolation set.
values : `numpy.ndarray`, shape (npt,)
    Values of the interpolated function at the interpolation points.
debug : bool
    Whether to make debugging tests during the execution.

Raises
------
`numpy.linalg.LinAlgError`
    If the interpolation system is ill-defined.
ú#The shape of `values` is not valid.z4The number of interpolation points must be at least Ú.N)r   r7   r=   r   Ú
ValueErrorÚ
_get_modelÚ_constÚ_gradÚ_i_hessr   r   Ú_e_hess)r$   rc   ÚvaluesÚdebugÚ_s   &&&& r0   r1   ÚQuadratic.__init__  sÁ   € ð$ ŒØ�;�;ˆ;Ø—<‘<Ø×!Ñ!ð$ô ð 5à4ó5ð ð ×Ñ˜}Ÿ™°Õ2Ô2ÜØFØ —?‘? QÕ&Ð' qð*óð ð 48·?±?ØØó4
Ñ0ˆŒ�T”Z ¤¨qô —x’x §¡¨¯©Ð 0Ó1ˆŽr3   c                ó–  € V P                   '       d$   VP                  V P                  38X  g   Q R4       hWP                  ,
          pV P                  V P
                  V,          ,           RV P                  VP                  P                  V,          R,          ,          W0P                  ,          V,          ,           ,          ,           # )a!  
Evaluate the quadratic model at a given point.

Parameters
----------
x : `numpy.ndarray`, shape (n,)
    Point at which the quadratic model is evaluated.
interpolation : `cobyqa.models.Interpolation`
    Interpolation set.

Returns
-------
float
    Value of the quadratic model at `x`.
úThe shape of `x` is not valid.r   r   )
r   r7   r   r   rr   rs   rt   r"   ra   ru   ©r$   Úxrc   Úx_diffs   &&& r0   Ú__call__ÚQuadratic.__call__*  s™   € ð  �;�;ˆ;Ø—7‘7˜tŸv™v˜iÔ'ÐIÐ)IÓIÐ'Ø×)Ñ)Õ)ˆà�K‰KØ�j‰j˜6Õ!õ"àà—‘ × 1Ñ 1× 3Ñ 3°fÕ <ÀÕDÕDØŸ<™<Õ'¨&Õ0õ1õõð	
r3   c                ó.   € V P                   P                  # r5   )rs   Úsizer8   s   &r0   r   ÚQuadratic.nG  s   € ð �z‰z�‰Ðr3   c                ó.   € V P                   P                  # )z 
Number of interpolation points used to define the quadratic model.

Returns
-------
int
    Number of interpolation points used to define the quadratic model.
)rt   r‚   r8   s   &r0   r=   ÚQuadratic.nptS  s   € ð �|‰|× Ñ Ð r3   c                óÔ   € V P                   '       d$   VP                  V P                  38X  g   Q R4       hWP                  ,
          pV P                  V P                  W24      ,           # )aZ  
Evaluate the gradient of the quadratic model at a given point.

Parameters
----------
x : `numpy.ndarray`, shape (n,)
    Point at which the gradient of the quadratic model is evaluated.
interpolation : `cobyqa.models.Interpolation`
    Interpolation set.

Returns
-------
`numpy.ndarray`, shape (n,)
    Gradient of the quadratic model at `x`.
r{   )r   r7   r   r   rs   Ú	hess_prodr|   s   &&& r0   ÚgradÚQuadratic.grad_  sQ   € ð  �;�;ˆ;Ø—7‘7˜tŸv™v˜iÔ'ÐIÐ)IÓIÐ'Ø×)Ñ)Õ)ˆØ�z‰z˜DŸN™N¨6ÓAÕAÐAr3   c                óÂ   € V P                   VP                  V P                  R\        P                  3,          VP                  P
                  ,          ,          ,           # )zë
Evaluate the Hessian matrix of the quadratic model.

Parameters
----------
interpolation : `cobyqa.models.Interpolation`
    Interpolation set.

Returns
-------
`numpy.ndarray`, shape (n, n)
    Hessian matrix of the quadratic model.
rF   )ru   r"   rt   r   Únewaxisra   )r$   rc   s   &&r0   ÚhessÚQuadratic.hesst  sG   € ð �|‰|˜m×/Ñ/Ø�L‰L˜œBŸJ™J˜Õ'¨-×*;Ñ*;×*=Ñ*=Õ=õ
õ 
ð 	
r3   c                ó  € V P                   '       d$   VP                  V P                  38X  g   Q R4       hV P                  V,          VP                  V P
                  VP                  P                  V,          ,          ,          ,           # )a¶  
Evaluate the right product of the Hessian matrix of the quadratic model
with a given vector.

Parameters
----------
v : `numpy.ndarray`, shape (n,)
    Vector with which the Hessian matrix of the quadratic model is
    multiplied from the right.
interpolation : `cobyqa.models.Interpolation`
    Interpolation set.

Returns
-------
`numpy.ndarray`, shape (n,)
    Right product of the Hessian matrix of the quadratic model with
    `v`.
úThe shape of `v` is not valid.)r   r7   r   ru   r"   rt   ra   ©r$   Úvrc   s   &&&r0   r‡   ÚQuadratic.hess_prod†  sk   € ð& �;�;ˆ;Ø—7‘7˜tŸv™v˜iÔ'ÐIÐ)IÓIÐ'Ø�|‰|˜aÕ -×"3Ñ"3Ø�L‰L˜M×-Ñ-×/Ñ/°!Õ3Õ4õ#
õ 
ð 	
r3   c                ó  € V P                   '       d$   VP                  V P                  38X  g   Q R4       hWP                  ,          V,          V P                  VP
                  P                  V,          R,          ,          ,           # )a\  
Evaluate the curvature of the quadratic model along a given direction.

Parameters
----------
v : `numpy.ndarray`, shape (n,)
    Direction along which the curvature of the quadratic model is
    evaluated.
interpolation : `cobyqa.models.Interpolation`
    Interpolation set.

Returns
-------
float
    Curvature of the quadratic model along `v`.
r�   r   )r   r7   r   ru   rt   r"   ra   r�   s   &&&r0   ÚcurvÚQuadratic.curvŸ  sf   € ð" �;�;ˆ;Ø—7‘7˜tŸv™v˜iÔ'ÐIÐ)IÓIÐ'à—‘Õ˜qÕ Ø�l‰l˜m×/Ñ/×1Ñ1°AÕ5¸#Õ=Õ=õ>ð	
r3   c                ón  € V P                   '       do   ^ Tu;8:  d   V P                  8  g   Q R4       h Q R4       hVP                  V P                  38X  g   Q R4       hVP                  V P                  38X  g   Q R4       hV ;P                  V P
                  V,          \        P                  ! W34      ,          ,          un        RV P
                  V&   V P                  VV4      w  rVrxV ;P                  V,          un	        V ;P                  V,          un
        V ;P
                  V,          un        V# )aç  
Update the quadratic model.

This method applies the derivative-free symmetric Broyden update to the
quadratic model. The `knew`-th interpolation point must be updated
before calling this method.

Parameters
----------
interpolation : `cobyqa.models.Interpolation`
    Updated interpolation set.
k_new : int
    Index of the updated interpolation point.
dir_old : `numpy.ndarray`, shape (n,)
    Value of ``interpolation.xpt[:, k_new]`` before the update.
values_diff : `numpy.ndarray`, shape (npt,)
    Differences between the values of the interpolated nonlinear
    function and the previous quadratic model at the updated
    interpolation points.

Raises
------
`numpy.linalg.LinAlgError`
    If the interpolation system is ill-defined.
úThe index `k_new` is not valid.z$The shape of `dir_old` is not valid.z(The shape of `values_diff` is not valid.ç        )r   r=   r7   r   ru   rt   r   Úouterrq   rr   rs   )	r$   rc   Úk_newÚdir_oldÚvalues_diffÚconstrˆ   Úi_hessÚill_conditioneds	   &&&&&    r0   ÚupdateÚQuadratic.update·  s  € ð4 �;�;ˆ;Ø˜Ö( §¡Ô(ÐKÐ*KÓKÑ(ÐKÐ*KÓKÐ(Ø—=‘=Ø—‘ð%ô ð 6à5ó6ð ð ×$Ñ$Ø—‘ð)ô ð :à9ó:ð ð 	�Š˜Ÿ™ UÕ+¬b¯hªh°wÓ.HÕHÕH�Ø!ˆ�‰�UÑð 04¯©ØØó0
Ñ,ˆ�Vð 	�Š�uÕ�Ø�
Š
�dÕ�
Ø�Š˜Õ�ØÐr3   c                óÚ  € V P                   '       d$   VP                  V P                  38X  g   Q R4       hV ! W!4      V n        V P	                  W!4      V n        W!P                  ,
          p\        P                  ! VVP                  RVR\        P                  3,          ,          ,
          V P                  ,          4      pV ;P                  WDP                  ,           ,          un        R# )a  
Shift the point around which the quadratic model is defined.

Parameters
----------
interpolation : `cobyqa.models.Interpolation`
    Previous interpolation set.
new_x_base : `numpy.ndarray`, shape (n,)
    Point that will replace ``interpolation.x_base``.
ú'The shape of `new_x_base` is not valid.r   rF   N)r   r7   r   rr   rˆ   rs   r   r   r™   r"   r‹   rt   ru   ra   )r$   rc   Ú
new_x_baseÚshiftr    s   &&&  r0   Úshift_x_baseÚQuadratic.shift_x_baseë  s¶   € ð �;�;ˆ;Ø×#Ñ#Ø—‘ð(ô ð 9à8ó9ð ñ ˜:Ó5ˆŒØ—Y‘Y˜zÓ9ˆŒ
Ø×1Ñ1Õ1ˆÜ—’ØØ×Ñ  u¨Q´·
±
¨]Õ';Õ!;Õ;¸t¿|¹|ÕKó
ˆð 	�Š˜§¡Õ)Õ)�r3   c                ó\  € V P                   P                  w  r#VP                  ^8X  d&   VP                  ^ ,          W2,           ^,           8X  g   Q R4       h\        V 4      w  rEpWR\        P
                  3,          ,          p\        P                  ! \        P                  ! V4      4      '       d1   \        P                  ! \        P                  ! V4      4      '       g    \        P                  P                  R4      hVw  r‰\        P                  ! V4      \        8„  p
V	RV
3,          p	RWŠ,          ,          p\        P                  ! V
^ 4      ( pV	V	P                  V,          VR\        P
                  3,          ,          ,          pWÕR\        P
                  3,          ,          V3# )a  
Solve the interpolation systems.

Parameters
----------
interpolation : `cobyqa.models.Interpolation`
    Interpolation set.
rhs : `numpy.ndarray`, shape (npt + n + 1, m)
    Right-hand side vectors of the ``m`` interpolation systems.

Returns
-------
`numpy.ndarray`, shape (npt + n + 1, m)
    Solutions of the interpolation systems.
`numpy.ndarray`, shape (m, )
    Whether the interpolation systems are ill-conditioned.

Raises
------
`numpy.linalg.LinAlgError`
    If the interpolation systems are ill-defined.
z The shape of `rhs` is not valid.rF   z(The interpolation system is ill-defined.rZ   )r"   r7   Úndimrj   r   r‹   ÚallÚisfiniter^   ÚLinAlgErrorÚabsr`   ra   )rc   Úrhsr   r=   rU   rV   ÚeigÚ
rhs_scaledrg   rh   Úlarge_eig_valuesÚinv_eig_valuesrŸ   Úleft_scaled_solutionss   &&            r0   Úsolve_systemsÚQuadratic.solve_systems  sQ  € ð0 ×"Ñ"×(Ñ(‰ˆà�H‰H˜ŒM˜cŸi™i¨�l¨c­g¸­kÔ9ð	.à-ó	.Ø9ô !-¨]Ó ;Ñˆ˜#ð ¨¬B¯J©J¨Õ7Õ7ˆ
Ü—’”r—{’{ 1“~×&Ò&¬2¯6ª6´"·+²+¸jÓ2I×+JÒ+JÜ—)‘)×'Ñ'Ø:óð ð
 #&Ñˆ
äŸ6š6 *Ó-´Ñ3ÐØ! !Ð%5Ð"5Õ6ˆØ˜zÕ;Õ;ˆÜŸ6š6Ð"2°AÓ6Ð6ˆØ +Ø�]‰]˜ZÕ'¨>¸!¼R¿Z¹Z¸-Õ+HÕHõ!
Ðð "°!´R·Z±Z°-Õ$@Õ@Øð
ð 	
r3   c           
     ót  € VP                   V P                  38X  g   Q R4       hV P                  P                   w  r#\        P	                  V \
        P                  ! V\
        P                  ! V^,           4      ..4      P                  4      w  rEWC^ 3,          WC^,           R1^ 3,          VRV1^ 3,          V3# )a3  
Solve the interpolation system.

Parameters
----------
interpolation : `cobyqa.models.Interpolation`
    Interpolation set.
values : `numpy.ndarray`, shape (npt,)
    Values of the interpolated function at the interpolation points.

Returns
-------
float
    Constant term of the quadratic model.
`numpy.ndarray`, shape (n,)
    Gradient of the quadratic model at ``interpolation.x_base``.
`numpy.ndarray`, shape (npt,)
    Implicit Hessian matrix of the quadratic model.

Raises
------
`numpy.linalg.LinAlgError`
    If the interpolation system is ill-defined.
rn   N)	r7   r=   r"   rl   r´   r   Úblockr   ra   )rc   rv   r   r=   r}   rŸ   s   &&    r0   rq   ÚQuadratic._get_modelD  s»   € ð4 �|‰|Ø×Ñð 
ô 
ð 	1à0ó	1ð 
ð ×"Ñ"×(Ñ(‰ˆÜ&×4Ñ4ØÜ�HŠHð ÜŸš  Q¥›ððó÷ ‰aó

Ñˆð �a��y˜! !�G™H a˜K�.¨!¨D¨S¨D°!¨G­*°oÐEÐEr3   )rr   r   ru   rs   rt   N)rI   rJ   rK   rL   rM   r1   r   rN   r   r=   rˆ   rŒ   r‡   r”   r    r¦   Ústaticmethodr´   rq   rP   rQ   rR   s   @r0   rl   rl   ø   sˆ   ø‡ € ñò 2òD
ð: ñ	ó ð	ð ñ	!ó ð	!òBò*
ò$
ò2
ò02òh*ð0 ñ>
ó ð>
ð@ ñ(Fó ö(Fr3   rl   c                   óh  a € ] tR tRt o RtR t]R 4       t]R 4       t]R 4       t	]R 4       t
]R 4       t]R	 4       t]R
 4       t]R 4       tR tR tR tR tR tR tR%R ltR%R ltR%R ltR%R ltR%R ltR%R ltR%R ltR%R ltR%R ltR%R ltR tR t R%R lt!R  t"R%R! lt#R%R" lt$R# t%R$t&V t'R# )&ÚModelsip  z.
Models for a nonlinear optimization problem.
c                óP	  € V\         P                  ,          V n        \        W4      V n        V P
                  P                  ^ 4      pV! WC4      w  rVp\        P                  ! V\         P                  ,          \        P                  4      V n        \        P                  ! V\         P                  ,          VP                  3\        P                  4      V n        \        P                  ! V\         P                  ,          VP                  3\        P                  4      V n        \        V\         P                  ,          4       EFÔ  pW‚\         P                   ,          8¼  d   \"        hV^ 8X  d0   WPP$                  V&   W`P&                  VR3&   WpP(                  VR3&   MSV P
                  P                  V4      pV! VV4      w  V P$                  V&   V P&                  VR3&   V P(                  VR3&   VP*                  '       ds   VP-                  V P
                  P                  V4      V P&                  VR3,          V P(                  VR3,          4      V\         P.                  ,          8:  d   \0        hV P                  V,          V\         P2                  ,          8:  g   EKb  VP-                  V P
                  P                  V4      V P&                  VR3,          V P(                  VR3,          4      V\         P.                  ,          8:  g   EKÑ  \4        h	  \7        V P
                  V P                  V\         P                  ,          4      V n        \        P:                  ! V P<                  \6        R7      V n        \        P:                  ! V P@                  \6        R7      V n!        \        V P<                  4       FO  p	\7        V P
                  V P&                  RV	3,          V\         P                  ,          4      V P>                  V	&   KQ  	  \        V P@                  4       FO  p	\7        V P
                  V P(                  RV	3,          V\         P                  ,          4      V PB                  V	&   KQ  	  V P                  '       d   V PE                  4        R# R# )a•  
Initialize the models.

Parameters
----------
pb : `cobyqa.problem.Problem`
    Problem to be solved.
options : dict
    Options of the solver.
penalty : float
    Penalty parameter used to select the point in the filter to forward
    to the callback function.

Raises
------
`cobyqa.utils.MaxEvalError`
    If the maximum number of evaluations is reached.
`cobyqa.utils.TargetSuccess`
    If a nearly feasible point has been found with an objective
    function value below the target.
`cobyqa.utils.FeasibleSuccess`
    If a feasible point has been found for a feasibility problem.
`numpy.linalg.LinAlgError`
    If the interpolation system is ill-defined.
rF   )ÚdtypeN)#r   r   r   r	   Ú_interpolationrc   rG   r   Úfullr   ÚnanÚ_fun_valr‚   Ú_cub_valÚ_ceq_valr!   ÚMAX_EVALr   Úfun_valÚcub_valÚceq_valÚis_feasibilityÚmaxcvÚFEASIBILITY_TOLr   ÚTARGETr   rl   Ú_funrb   Úm_nonlinear_ubÚ_cubÚm_nonlinear_eqÚ_ceqÚ_check_interpolation_conditions)
r$   r%   r&   ÚpenaltyÚx_evalÚfun_initÚcub_initÚceq_initr,   Úis
   &&&&      r0   r1   ÚModels.__init__u  s`  € ð6 œgŸm™mÕ,ˆŒÜ+¨BÓ8ˆÔð ×#Ñ#×)Ñ)¨!Ó,ˆÙ')¨&Ó':Ñ$ˆ˜HÜŸš ¬¯©Õ 4´b·f±fÓ=ˆŒÜŸš ¬¯©Õ!5°x·}±}Ð EÄrÇvÁvÓNˆŒÜŸš ¬¯©Õ!5°x·}±}Ð EÄrÇvÁvÓNˆŒÜ�wœwŸ{™{Õ+×,ˆAØœG×,Ñ,Õ-Ô-Ü"Ð"Ø�AŒvØ"*—‘˜Q‘Ø%-—‘˜Q ˜TÑ"Ø%-—‘˜Q ˜TÒ"à×+Ñ+×1Ñ1°!Ó4�ÙJLØØóKÑG�—‘˜Q‘ §¡¨a°¨dÑ!3°T·\±\À!ÀQÀ$Ñ5Gð ×!×!Ð!Ø—H‘HØ×&Ñ&×,Ñ,¨QÓ/Ø—L‘L  A Õ&Ø—L‘L  A Õ&óð
 œ7×2Ñ2Õ3ô4ô &Ð%ð
 —‘˜aÕ  G¬G¯N©NÕ$;×;Ø—H‘HØ×&Ñ&×,Ñ,¨QÓ/Ø—L‘L  A Õ&Ø—L‘L  A Õ&óð
 œ7×2Ñ2Õ3÷4ô $Ð#ñM -ôR Ø×ÑØ�M‰MØ”G—M‘MÕ"ó
ˆŒ	ô
 —H’H˜T×0Ñ0¼	ÔBˆŒ	Ü—H’H˜T×0Ñ0¼	ÔBˆŒ	Ü�t×*Ñ*Ö+ˆAÜ$Ø×"Ñ"Ø—‘˜Q ˜TÕ"ØœŸ™Õ&óˆD�I‰I�a‹Lñ ,ô �t×*Ñ*Ö+ˆAÜ$Ø×"Ñ"Ø—‘˜Q ˜TÕ"ØœŸ™Õ&óˆD�I‰I�a‹Lñ ,ð �;�;ˆ;Ø×0Ñ0Ö2ñ r3   c                ó.   € V P                   P                  # )zN
Dimension of the problem.

Returns
-------
int
    Dimension of the problem.
)rc   r   r8   s   &r0   r   ÚModels.nØ  s   € ð ×!Ñ!×#Ñ#Ð#r3   c                ó.   € V P                   P                  # r<   )rc   r=   r8   s   &r0   r=   Ú
Models.nptä  s   € ð ×!Ñ!×%Ñ%Ð%r3   c                ó<   € V P                   P                  ^,          # )zr
Number of nonlinear inequality constraints.

Returns
-------
int
    Number of nonlinear inequality constraints.
)rÆ   r7   r8   s   &r0   rÍ   ÚModels.m_nonlinear_ubð  ó   € ð �|‰|×!Ñ! !Õ$Ð$r3   c                ó<   € V P                   P                  ^,          # )zn
Number of nonlinear equality constraints.

Returns
-------
int
    Number of nonlinear equality constraints.
)rÇ   r7   r8   s   &r0   rÏ   ÚModels.m_nonlinear_eqü  rß   r3   c                ó   € V P                   # )zZ
Interpolation set.

Returns
-------
`cobyqa.models.Interpolation`
    Interpolation set.
)r¾   r8   s   &r0   rc   ÚModels.interpolation  s   € ð ×"Ñ"Ð"r3   c                ó   € V P                   # )z°
Values of the objective function at the interpolation points.

Returns
-------
`numpy.ndarray`, shape (npt,)
    Values of the objective function at the interpolation points.
)rÁ   r8   s   &r0   rÅ   ÚModels.fun_val  s   € ð �}‰}Ðr3   c                ó   € V P                   # )zñ
Values of the nonlinear inequality constraint functions at the
interpolation points.

Returns
-------
`numpy.ndarray`, shape (npt, m_nonlinear_ub)
    Values of the nonlinear inequality constraint functions at the
    interpolation points.
)rÂ   r8   s   &r0   rÆ   ÚModels.cub_val   ó   € ð �}‰}Ðr3   c                ó   € V P                   # )zí
Values of the nonlinear equality constraint functions at the
interpolation points.

Returns
-------
`numpy.ndarray`, shape (npt, m_nonlinear_eq)
    Values of the nonlinear equality constraint functions at the
    interpolation points.
)rÃ   r8   s   &r0   rÇ   ÚModels.ceq_val.  rè   r3   c                ó¢   € V P                   '       d$   VP                  V P                  38X  g   Q R4       hV P                  WP                  4      # )a-  
Evaluate the quadratic model of the objective function at a given
point.

Parameters
----------
x : `numpy.ndarray`, shape (n,)
    Point at which to evaluate the quadratic model of the objective
    function.

Returns
-------
float
    Value of the quadratic model of the objective function at `x`.
r{   )r   r7   r   rÌ   rc   ©r$   r}   s   &&r0   ÚfunÚ
Models.fun<  s@   € ð  �;�;ˆ;Ø—7‘7˜tŸv™v˜iÔ'ÐIÐ)IÓIÐ'Ø�y‰y˜×.Ñ.Ó/Ð/r3   c                ó¶   € V P                   '       d$   VP                  V P                  38X  g   Q R4       hV P                  P	                  WP
                  4      # )af  
Evaluate the gradient of the quadratic model of the objective function
at a given point.

Parameters
----------
x : `numpy.ndarray`, shape (n,)
    Point at which to evaluate the gradient of the quadratic model of
    the objective function.

Returns
-------
`numpy.ndarray`, shape (n,)
    Gradient of the quadratic model of the objective function at `x`.
r{   )r   r7   r   rÌ   rˆ   rc   rì   s   &&r0   Úfun_gradÚModels.fun_gradP  sD   € ð  �;�;ˆ;Ø—7‘7˜tŸv™v˜iÔ'ÐIÐ)IÓIÐ'Ø�y‰y�~‰~˜a×!3Ñ!3Ó4Ð4r3   c                óL   € V P                   P                  V P                  4      # )zÃ
Evaluate the Hessian matrix of the quadratic model of the objective
function.

Returns
-------
`numpy.ndarray`, shape (n, n)
    Hessian matrix of the quadratic model of the objective function.
)rÌ   rŒ   rc   r8   s   &r0   Úfun_hessÚModels.fun_hessd  s   € ð �y‰y�~‰~˜d×0Ñ0Ó1Ð1r3   c                ó¶   € V P                   '       d$   VP                  V P                  38X  g   Q R4       hV P                  P	                  WP
                  4      # )a¿  
Evaluate the right product of the Hessian matrix of the quadratic model
of the objective function with a given vector.

Parameters
----------
v : `numpy.ndarray`, shape (n,)
    Vector with which the Hessian matrix of the quadratic model of the
    objective function is multiplied from the right.

Returns
-------
`numpy.ndarray`, shape (n,)
    Right product of the Hessian matrix of the quadratic model of the
    objective function with `v`.
r�   )r   r7   r   rÌ   r‡   rc   ©r$   r‘   s   &&r0   Úfun_hess_prodÚModels.fun_hess_prodp  sF   € ð" �;�;ˆ;Ø—7‘7˜tŸv™v˜iÔ'ÐIÐ)IÓIÐ'Ø�y‰y×"Ñ" 1×&8Ñ&8Ó9Ð9r3   c                ó¶   € V P                   '       d$   VP                  V P                  38X  g   Q R4       hV P                  P	                  WP
                  4      # )ai  
Evaluate the curvature of the quadratic model of the objective function
along a given direction.

Parameters
----------
v : `numpy.ndarray`, shape (n,)
    Direction along which the curvature of the quadratic model of the
    objective function is evaluated.

Returns
-------
float
    Curvature of the quadratic model of the objective function along
    `v`.
r�   )r   r7   r   rÌ   r”   rc   rö   s   &&r0   Úfun_curvÚModels.fun_curv…  sD   € ð" �;�;ˆ;Ø—7‘7˜tŸv™v˜iÔ'ÐIÐ)IÓIÐ'Ø�y‰y�~‰~˜a×!3Ñ!3Ó4Ð4r3   c                óø   € V P                   '       d$   VP                  V P                  38X  g   Q R4       h\        V P                  V P
                  V P                   4      pVP                  WP                  4      # )aè  
Evaluate the gradient of the alternative quadratic model of the
objective function at a given point.

Parameters
----------
x : `numpy.ndarray`, shape (n,)
    Point at which to evaluate the gradient of the alternative
    quadratic model of the objective function.

Returns
-------
`numpy.ndarray`, shape (n,)
    Gradient of the alternative quadratic model of the objective
    function at `x`.

Raises
------
`numpy.linalg.LinAlgError`
    If the interpolation system is ill-defined.
r{   )r   r7   r   rl   rc   rÅ   rˆ   )r$   r}   Úmodels   && r0   Úfun_alt_gradÚModels.fun_alt_gradš  s\   € ð, �;�;ˆ;Ø—7‘7˜tŸv™v˜iÔ'ÐIÐ)IÓIÐ'Ü˜$×,Ñ,¨d¯l©l¸D¿K¹KÓHˆØ�z‰z˜!×/Ñ/Ó0Ð0r3   Nc           	     óL  € V P                   '       dK   VP                  V P                  38X  g   Q R4       hVe$   VP                  V P                  38X  g   Q R4       h\        P
                  ! V P                  V4       Uu. uF  q3! WP                  4      NK  	  up4      # u upi )aÃ  
Evaluate the quadratic models of the nonlinear inequality functions at
a given point.

Parameters
----------
x : `numpy.ndarray`, shape (n,)
    Point at which to evaluate the quadratic models of the nonlinear
    inequality functions.
mask : `numpy.ndarray`, shape (m_nonlinear_ub,), optional
    Mask of the quadratic models to consider.

Returns
-------
`numpy.ndarray`
    Values of the quadratic model of the nonlinear inequality
    functions.
r{   ú!The shape of `mask` is not valid.)r   r7   r   rÍ   r   ÚarrayÚ_get_cubrc   ©r$   r}   Úmaskrý   s   &&& r0   ÚcubÚ
Models.cubµ  s™   € ð& �;�;ˆ;Ø—7‘7˜tŸv™v˜iÔ'ÐIÐ)IÓIÐ'Ø’< 4§:¡:Ø×#Ñ#ð2ô $ð 3à2ó3ð ô �xŠxØ7;·}±}ÀTÔ7JÓKÑ7J¨eˆU�1×(Ñ(Ö)Ñ7JÑKó
ð 	
ùÚKó   Â B!c           	     óz  € V P                   '       dK   VP                  V P                  38X  g   Q R4       hVe$   VP                  V P                  38X  g   Q R4       h\        P
                  ! V P                  V4       Uu. uF  pVP                  WP                  4      NK   	  upRV P                  34      # u upi )aè  
Evaluate the gradients of the quadratic models of the nonlinear
inequality functions at a given point.

Parameters
----------
x : `numpy.ndarray`, shape (n,)
    Point at which to evaluate the gradients of the quadratic models of
    the nonlinear inequality functions.
mask : `numpy.ndarray`, shape (m_nonlinear_eq,), optional
    Mask of the quadratic models to consider.

Returns
-------
`numpy.ndarray`
    Gradients of the quadratic model of the nonlinear inequality
    functions.
r{   r  éÿÿÿÿ)	r   r7   r   rÍ   r   Úreshaper  rˆ   rc   r  s   &&& r0   Úcub_gradÚModels.cub_gradÑ  ó±   € ð& �;�;ˆ;Ø—7‘7˜tŸv™v˜iÔ'ÐIÐ)IÓIÐ'Ø’< 4§:¡:Ø×#Ñ#ð2ô $ð 3à2ó3ð ô �zŠzàŸ-™-¨Ô-ó/Ù-�ð �Z‰Z˜×-Ñ-Ö.Ù-ñ/à�—‘ˆLó
ð 	
ùò/ó   Â $B8c                óH  € V P                   '       d(   Ve$   VP                  V P                  38X  g   Q R4       h\        P                  ! V P                  V4       Uu. uF  q"P                  V P                  4      NK  	  upRV P                  V P                  34      # u upi )aV  
Evaluate the Hessian matrices of the quadratic models of the nonlinear
inequality functions.

Parameters
----------
mask : `numpy.ndarray`, shape (m_nonlinear_ub,), optional
    Mask of the quadratic models to consider.

Returns
-------
`numpy.ndarray`
    Hessian matrices of the quadratic models of the nonlinear
    inequality functions.
r  r
  )	r   r7   rÍ   r   r  r  rŒ   rc   r   ©r$   r  rý   s   && r0   Úcub_hessÚModels.cub_hessï  ó�   € ð  �;�;ˆ;Ø’< 4§:¡:Ø×#Ñ#ð2ô $ð 3à2ó3ð ô �zŠzØ9=¿¹ÀtÔ9LÓMÑ9L°�Z‰Z˜×*Ñ*Ö+Ñ9LÑMØ�—‘˜Ÿ™Ð ó
ð 	
ùÚMó   Á#Bc           	     óz  € V P                   '       dK   VP                  V P                  38X  g   Q R4       hVe$   VP                  V P                  38X  g   Q R4       h\        P
                  ! V P                  V4       Uu. uF  pVP                  WP                  4      NK   	  upRV P                  34      # u upi )aJ  
Evaluate the right product of the Hessian matrices of the quadratic
models of the nonlinear inequality functions with a given vector.

Parameters
----------
v : `numpy.ndarray`, shape (n,)
    Vector with which the Hessian matrices of the quadratic models of
    the nonlinear inequality functions are multiplied from the right.
mask : `numpy.ndarray`, shape (m_nonlinear_ub,), optional
    Mask of the quadratic models to consider.

Returns
-------
`numpy.ndarray`
    Right products of the Hessian matrices of the quadratic models of
    the nonlinear inequality functions with `v`.
r�   r  r
  )	r   r7   r   rÍ   r   r  r  r‡   rc   ©r$   r‘   r  rý   s   &&& r0   Úcub_hess_prodÚModels.cub_hess_prod  óµ   € ð& �;�;ˆ;Ø—7‘7˜tŸv™v˜iÔ'ÐIÐ)IÓIÐ'Ø’< 4§:¡:Ø×#Ñ#ð2ô $ð 3à2ó3ð ô �zŠzð "Ÿ]™]¨4Ô0óá0�Eð —‘ ×#5Ñ#5Ö6Ù0ñð �—‘ˆLó
ð 	
ùòr  c           	     ó`  € V P                   '       dK   VP                  V P                  38X  g   Q R4       hVe$   VP                  V P                  38X  g   Q R4       h\        P
                  ! V P                  V4       Uu. uF  pVP                  WP                  4      NK   	  up4      # u upi )a  
Evaluate the curvature of the quadratic models of the nonlinear
inequality functions along a given direction.

Parameters
----------
v : `numpy.ndarray`, shape (n,)
    Direction along which the curvature of the quadratic models of the
    nonlinear inequality functions is evaluated.
mask : `numpy.ndarray`, shape (m_nonlinear_ub,), optional
    Mask of the quadratic models to consider.

Returns
-------
`numpy.ndarray`
    Curvature of the quadratic models of the nonlinear inequality
    functions along `v`.
r�   r  )	r   r7   r   rÍ   r   r  r  r”   rc   r  s   &&& r0   Úcub_curvÚModels.cub_curv(  ó¦   € ð& �;�;ˆ;Ø—7‘7˜tŸv™v˜iÔ'ÐIÐ)IÓIÐ'Ø’< 4§:¡:Ø×#Ñ#ð2ô $ð 3à2ó3ð ô �xŠxàŸ-™-¨Ô-ó/Ù-�ð �Z‰Z˜×-Ñ-Ö.Ù-ñ/ó
ð 	
ùò/ó   Â $B+c           	     óL  € V P                   '       dK   VP                  V P                  38X  g   Q R4       hVe$   VP                  V P                  38X  g   Q R4       h\        P
                  ! V P                  V4       Uu. uF  q3! WP                  4      NK  	  up4      # u upi )a¹  
Evaluate the quadratic models of the nonlinear equality functions at a
given point.

Parameters
----------
x : `numpy.ndarray`, shape (n,)
    Point at which to evaluate the quadratic models of the nonlinear
    equality functions.
mask : `numpy.ndarray`, shape (m_nonlinear_eq,), optional
    Mask of the quadratic models to consider.

Returns
-------
`numpy.ndarray`
    Values of the quadratic model of the nonlinear equality functions.
r{   r  )r   r7   r   rÏ   r   r  Ú_get_ceqrc   r  s   &&& r0   ÚceqÚ
Models.ceqE  s™   € ð$ �;�;ˆ;Ø—7‘7˜tŸv™v˜iÔ'ÐIÐ)IÓIÐ'Ø’< 4§:¡:Ø×#Ñ#ð2ô $ð 3à2ó3ð ô �xŠxØ7;·}±}ÀTÔ7JÓKÑ7J¨eˆU�1×(Ñ(Ö)Ñ7JÑKó
ð 	
ùÚKr  c           	     óz  € V P                   '       dK   VP                  V P                  38X  g   Q R4       hVe$   VP                  V P                  38X  g   Q R4       h\        P
                  ! V P                  V4       Uu. uF  pVP                  WP                  4      NK   	  upRV P                  34      # u upi )aâ  
Evaluate the gradients of the quadratic models of the nonlinear
equality functions at a given point.

Parameters
----------
x : `numpy.ndarray`, shape (n,)
    Point at which to evaluate the gradients of the quadratic models of
    the nonlinear equality functions.
mask : `numpy.ndarray`, shape (m_nonlinear_eq,), optional
    Mask of the quadratic models to consider.

Returns
-------
`numpy.ndarray`
    Gradients of the quadratic model of the nonlinear equality
    functions.
r{   r  r
  )	r   r7   r   rÏ   r   r  r!  rˆ   rc   r  s   &&& r0   Úceq_gradÚModels.ceq_grad`  r  r  c                óH  € V P                   '       d(   Ve$   VP                  V P                  38X  g   Q R4       h\        P                  ! V P                  V4       Uu. uF  q"P                  V P                  4      NK  	  upRV P                  V P                  34      # u upi )aR  
Evaluate the Hessian matrices of the quadratic models of the nonlinear
equality functions.

Parameters
----------
mask : `numpy.ndarray`, shape (m_nonlinear_eq,), optional
    Mask of the quadratic models to consider.

Returns
-------
`numpy.ndarray`
    Hessian matrices of the quadratic models of the nonlinear equality
    functions.
r  r
  )	r   r7   rÏ   r   r  r!  rŒ   rc   r   r  s   && r0   Úceq_hessÚModels.ceq_hess~  r  r  c           	     óz  € V P                   '       dK   VP                  V P                  38X  g   Q R4       hVe$   VP                  V P                  38X  g   Q R4       h\        P
                  ! V P                  V4       Uu. uF  pVP                  WP                  4      NK   	  upRV P                  34      # u upi )aD  
Evaluate the right product of the Hessian matrices of the quadratic
models of the nonlinear equality functions with a given vector.

Parameters
----------
v : `numpy.ndarray`, shape (n,)
    Vector with which the Hessian matrices of the quadratic models of
    the nonlinear equality functions are multiplied from the right.
mask : `numpy.ndarray`, shape (m_nonlinear_eq,), optional
    Mask of the quadratic models to consider.

Returns
-------
`numpy.ndarray`
    Right products of the Hessian matrices of the quadratic models of
    the nonlinear equality functions with `v`.
r�   r  r
  )	r   r7   r   rÏ   r   r  r!  r‡   rc   r  s   &&& r0   Úceq_hess_prodÚModels.ceq_hess_prod—  r  r  c           	     ó`  € V P                   '       dK   VP                  V P                  38X  g   Q R4       hVe$   VP                  V P                  38X  g   Q R4       h\        P
                  ! V P                  V4       Uu. uF  pVP                  WP                  4      NK   	  up4      # u upi )aü  
Evaluate the curvature of the quadratic models of the nonlinear
equality functions along a given direction.

Parameters
----------
v : `numpy.ndarray`, shape (n,)
    Direction along which the curvature of the quadratic models of the
    nonlinear equality functions is evaluated.
mask : `numpy.ndarray`, shape (m_nonlinear_eq,), optional
    Mask of the quadratic models to consider.

Returns
-------
`numpy.ndarray`
    Curvature of the quadratic models of the nonlinear equality
    functions along `v`.
r�   r  )	r   r7   r   rÏ   r   r  r!  r”   rc   r  s   &&& r0   Úceq_curvÚModels.ceq_curv·  r  r  c                ó"  € \        V P                  V P                  V P                  4      V n        \        V P                  4       FD  p\        V P                  V P                  RV3,          V P                  4      V P                  V&   KF  	  \        V P                  4       FD  p\        V P                  V P                  RV3,          V P                  4      V P                  V&   KF  	  V P                  '       d   V P                  4        R# R# )zù
Set the quadratic models of the objective function, nonlinear
inequality constraints, and nonlinear equality constraints to the
alternative quadratic models.

Raises
------
`numpy.linalg.LinAlgError`
    If the interpolation system is ill-defined.
rF   N)rl   rc   rÅ   r   rÌ   r!   rÍ   rÆ   rÎ   rÏ   rÇ   rÐ   rÑ   )r$   r×   s   & r0   Úreset_modelsÚModels.reset_modelsÔ  sÎ   € ô ˜d×0Ñ0°$·,±,ÀÇÁÓLˆŒ	Ü�t×*Ñ*Ö+ˆAÜ$Ø×"Ñ"Ø—‘˜Q ˜TÕ"Ø—‘óˆD�I‰I�a‹Lñ ,ô �t×*Ñ*Ö+ˆAÜ$Ø×"Ñ"Ø—‘˜Q ˜TÕ"Ø—‘óˆD�I‰I�a‹Lñ ,ð �;�;ˆ;Ø×0Ñ0Ö2ñ r3   c           	     óD  € V P                   '       d¯   ^ Tu;8:  d   V P                  8  g   Q R4       h Q R4       hVP                  V P                  38X  g   Q R4       h\	        V\
        4      '       g   Q R4       hVP                  V P                  38X  g   Q R4       hVP                  V P                  38X  g   Q R4       h\        P                  ! V P                  4      p\        P                  ! V P                  P                  4      p\        P                  ! V P                  P                  4      pW0P                  V4      ,
          Wa&   W@P                  V4      ,
          WqR3&   WPP                  V4      ,
          W�R3&   W0P                  V&   W@P                  VR3&   WPP                  VR3&   \        P                   ! V P"                  P$                  RV3,          4      p	W P"                  P&                  ,
          V P"                  P$                  RV3&   V P(                  P+                  V P"                  VV	V4      p
\-        V P                  4       FE  pT
;'       g9    V P.                  V,          P+                  V P"                  VV	VRV3,          4      p
KG  	  \-        V P                  4       FE  pT
;'       g9    V P0                  V,          P+                  V P"                  VV	VRV3,          4      p
KG  	  V P                   '       d   V P3                  4        V
# )aG  
Update the interpolation set.

This method updates the interpolation set by replacing the `knew`-th
interpolation point with `xnew`. It also updates the function values
and the quadratic models.

Parameters
----------
k_new : int
    Index of the updated interpolation point.
x_new : `numpy.ndarray`, shape (n,)
    New interpolation point. Its value is interpreted as relative to
    the origin, not the base point.
fun_val : float
    Value of the objective function at `x_new`.
    Objective function value at `x_new`.
cub_val : `numpy.ndarray`, shape (m_nonlinear_ub,)
    Values of the nonlinear inequality constraints at `x_new`.
ceq_val : `numpy.ndarray`, shape (m_nonlinear_eq,)
    Values of the nonlinear equality constraints at `x_new`.

Raises
------
`numpy.linalg.LinAlgError`
    If the interpolation system is ill-defined.
r—   ú"The shape of `x_new` is not valid.z The function value is not valid.z$The shape of `cub_val` is not valid.z$The shape of `ceq_val` is not valid.rF   )r   r=   r7   r   Ú
isinstanceÚfloatrÍ   rÏ   r   r   rÆ   rÇ   rí   r  r"  rÅ   r   rc   r"   r   rÌ   r    r!   rÎ   rÐ   rÑ   )r$   rš   Úx_newrÅ   rÆ   rÇ   Úfun_diffÚcub_diffÚceq_diffr›   rŸ   r×   s   &&&&&&      r0   Úupdate_interpolationÚModels.update_interpolationï  s¾  € ð8 �;�;ˆ;Ø˜Ö( §¡Ô(ÐKÐ*KÓKÑ(ÐKÐ*KÓKÐ(Ø—;‘; 4§6¡6 )Ô+ð 5Ø4ó5Ð+ä˜g¤u×-Ò-ð 3Ø2ó3Ð-à—=‘=Ø×#Ñ#ð%ô ð 6à5ó6ð ð —=‘=Ø×#Ñ#ð%ô ð 6à5ó6ð ô
 —8’8˜DŸH™HÓ%ˆÜ—8’8˜DŸL™L×.Ñ.Ó/ˆÜ—8’8˜DŸL™L×.Ñ.Ó/ˆØ!§H¡H¨U£OÕ3ˆ‰Ø$§x¡x°£Õ6ˆ˜�ÑØ$§x¡x°£Õ6ˆ˜�Ñð &�‰�UÑØ!(�‰�U˜A�XÑØ!(�‰�U˜A�XÑô —'’'˜$×,Ñ,×0Ñ0°°E°Õ:Ó;ˆØ+0×3EÑ3E×3LÑ3LÕ+Lˆ×Ñ×Ñ˜q %˜xÑ(ð Ÿ)™)×*Ñ*Ø×ÑØØØó	
ˆô �t×*Ñ*Ö+ˆAØ-÷ ð °·±¸1µ×1DÑ1DØ×"Ñ"ØØØ˜˜A˜•ó	2ŠOñ ,ô �t×*Ñ*Ö+ˆAØ-÷ ð °·±¸1µ×1DÑ1DØ×"Ñ"ØØØ˜˜A˜•ó	2ŠOñ ,ð �;�;ˆ;Ø×0Ñ0Ô2ØÐr3   c                óL  € V P                   '       dQ   VP                  V P                  38X  g   Q R4       hVe*   ^ Tu;8:  d   V P                  8  g    Q R4       h Q R4       hWP                  P
                  ,
          p\        P                  ! V P                  V P                  ,           ^,           ^34      pRV P                  P                  P                  V,          R,          ,          VRV P                  1^ 3&   RW@P                  ^ 3&   W4V P                  ^,           R1^ 3&   \        P                  V P                  V4      ^ ,          pRW3,          R,          ,          VR,          VR,          ,          ,
          pVf—   \        P                  ! V P                  V P                  ,           ^,           V P                  4      p\        P                  ! \        P                  V P                  V4      ^ ,          4      pVRV P                  1^ 3,          p	Mu\        P                  ! V P                  V P                  ,           ^,           ^V) 4      p\        P                  V P                  V4      ^ ,          V^ 3,          pWR^ 3,          p	W†,          V	R,          ,           # )aæ  
Compute the normalized determinants of the new interpolation systems.

Parameters
----------
x_new : `numpy.ndarray`, shape (n,)
    New interpolation point. Its value is interpreted as relative to
    the origin, not the base point.
k_new : int, optional
    Index of the updated interpolation point. If `k_new` is not
    specified, all the possible determinants are computed.

Returns
-------
{float, `numpy.ndarray`, shape (npt,)}
    Determinant(s) of the new interpolation system.

Raises
------
`numpy.linalg.LinAlgError`
    If the interpolation system is ill-defined.

Notes
-----
The determinants are normalized by the determinant of the current
interpolation system. For stability reasons, the calculations are done
using the formula (2.12) in [1]_.

References
----------
.. [1] M. J. D. Powell. On updating the inverse of a KKT matrix.
   Technical Report DAMTP 2004/NA01, Department of Applied Mathematics
   and Theoretical Physics, University of Cambridge, Cambridge, UK,
   2004.
r4  Nr—   r   r   rZ   )rF   r   )r   r7   r   r=   rc   r   r   rb   r"   ra   rl   r´   ÚeyeÚdiag)
r$   r7  rš   r¥   Únew_colÚinv_new_colÚbetaÚ	coord_vecÚalphaÚtaus
   &&&       r0   ÚdeterminantsÚModels.determinantsB  s7  € ðH �;�;ˆ;Ø—;‘; 4§6¡6 )Ô+ð 5Ø4ó5Ð+ð ’  eÖ!6¨d¯h©hÕ!6ð1à0ó1Ø6Ð!6ð1à0ó1Ø6ð ×*Ñ*×1Ñ1Õ1ˆÜ—(’(˜DŸH™H t§v¡vÕ-°Õ1°1Ð5Ó6ˆà�t×)Ñ)×-Ñ-×/Ñ/°%Õ7¸CÕ?Õ?ð 	�
�$—(‘(�
˜A�Ñà"ˆ—‘˜!�ÑØ$)�—‘˜1•‘˜qÐ Ñ!Ü×-Ñ-¨d×.@Ñ.@À'ÓJÈ1ÕMˆØ�e•m¨Õ+Õ+¨g°d­m¸kÈ$Õ>OÕ.OÕOˆð Š=ÜŸš˜tŸx™x¨$¯&©&Õ0°1Õ4°d·h±hÓ?ˆIÜ—G’GÜ×'Ñ'Ø×&Ñ&Øóð õóˆEð ˜j §¡˜j¨!˜mÕ,‰CäŸš˜tŸx™x¨$¯&©&Õ0°1Õ4°a¸%¸Ó@ˆIÜ×+Ñ+Ø×"Ñ"Øóð õ	ð
 �QˆhõˆEð  Q˜hÕ'ˆCØ�|˜c 3�hÕ&Ð&r3   c                óÈ  € V P                   '       d$   VP                  V P                  38X  g   Q R4       hV P                  P	                  V P
                  V4       V P                   F  pVP	                  V P
                  V4       K!  	  V P                   F  pVP	                  V P
                  V4       K!  	  WP
                  P                  ,
          pV P
                  ;P                  V,          un        V P
                  ;P                  VR\        P                  3,          ,          un	        V\        P                  ,          '       d   V P                  4        R# R# )z¼
Shift the base point without changing the interpolation set.

Parameters
----------
new_x_base : `numpy.ndarray`, shape (n,)
    New base point.
options : dict
    Options of the solver.
r£   rF   N)r   r7   r   rÌ   r¦   rc   rÎ   rÐ   r   r"   r   r‹   r   r   rÑ   )r$   r¤   r&   rý   r¥   s   &&&  r0   r¦   ÚModels.shift_x_baseŒ  s  € ð �;�;ˆ;Ø×#Ñ#Ø—‘ð(ô ð 9à8ó9ð ð
 	�	‰	×Ñ˜t×1Ñ1°:Ô>Ø—Y”YˆEØ×Ñ˜t×1Ñ1°:Ö>ñ à—Y”YˆEØ×Ñ˜t×1Ñ1°:Ö>ñ ð ×/Ñ/×6Ñ6Õ6ˆØ×Ñ×!Ò! UÕ*Õ!Ø×Ñ×Ò %¨¬2¯:©:¨Õ"6Õ6ÕØ”7—=‘=×!Ô!Ø×0Ñ0Ö2ñ "r3   c                óH   € Vf   V P                   # V P                   V,          # )a  
Get the quadratic models of the nonlinear inequality constraints.

Parameters
----------
mask : `numpy.ndarray`, shape (m_nonlinear_ub,), optional
    Mask of the quadratic models to return.

Returns
-------
`numpy.ndarray`
    Quadratic models of the nonlinear inequality constraints.
)rÎ   ©r$   r  s   &&r0   r  ÚModels._get_cubª  ó   € ð !šLˆt�y‰yÐ=¨d¯i©i¸­oÐ=r3   c                óH   € Vf   V P                   # V P                   V,          # )a  
Get the quadratic models of the nonlinear equality constraints.

Parameters
----------
mask : `numpy.ndarray`, shape (m_nonlinear_eq,), optional
    Mask of the quadratic models to return.

Returns
-------
`numpy.ndarray`
    Quadratic models of the nonlinear equality constraints.
)rÐ   rK  s   &&r0   r!  ÚModels._get_ceqº  rM  r3   c                óœ  € RpRpRp\        V P                  4       EFL  p\        P                  ! V\        P                  ! V P                  V P                  P                  V4      4      V P                  V,          ,
          4      .4      p\        P                  ! \        P                  ! V P                  V P                  P                  V4      4      V P                  VR3,          ,
          4      VR7      p\        P                  ! \        P                  ! V P                  V P                  P                  V4      4      V P                  VR3,          ,
          4      VR7      pEKO  	  R\        P                  ! \        4      ,          \        V P                  V P                  4      ,          pW\        P                  ! \        P                  ! V P                  4      RR7      ,          8”  d   \         P"                  ! R\$        ^4       W%\        P                  ! \        P                  ! V P                  4      RR7      ,          8”  d   \         P"                  ! R\$        ^4       W5\        P                  ! \        P                  ! V P                  4      RR7      ,          8”  d   \         P"                  ! R\$        ^4       R	# R	# )
z=
Check the interpolation conditions of all quadratic models.
r˜   rF   rX   g      $@rZ   zJThe interpolation conditions for the objective function are not satisfied.zVThe interpolation conditions for the inequality constraint function are not satisfied.zTThe interpolation conditions for the equality constraint function are not satisfied.N)r!   r=   r   r]   r­   rí   rc   rG   rÅ   r  rÆ   r"  rÇ   Úsqrtr`   r   ÚwarningsÚwarnÚRuntimeWarning)r$   Ú	error_funÚ	error_cubÚ	error_ceqr,   Útols   &     r0   rÑ   Ú&Models._check_interpolation_conditionsÊ  sñ  € ð ˆ	Øˆ	Øˆ	Ü�t—x‘x—ˆAÜŸšàÜ—F’FØŸ™ ×!3Ñ!3×!9Ñ!9¸!Ó!<Ó=ÀÇÁÈQÅÕOóðóˆIô ŸšÜ—’Ø—H‘H˜T×/Ñ/×5Ñ5°aÓ8Ó9¸D¿L¹LÈÈAÈÕ<NÕNóð "ô	ˆIô ŸšÜ—’Ø—H‘H˜T×/Ñ/×5Ñ5°aÓ8Ó9¸D¿L¹LÈÈAÈÕ<NÕNóð "ô	‹Iñ !ð* ”R—W’WœS“\Õ!¤C¨¯©°·±Ó$9Õ9ˆØœRŸVšV¤B§F¢F¨4¯<©<Ó$8À#ÔFÕFÔFÜ�MŠMð!äØô	ð œRŸVšV¤B§F¢F¨4¯<©<Ó$8À#ÔFÕFÔFÜ�MŠMð.äØô	ð œRŸVšV¤B§F¢F¨4¯<©<Ó$8À#ÔFÕFÔFÜ�MŠMð.äØö	ñ Gr3   )rÐ   rÃ   rÎ   rÂ   r   rÌ   rÁ   r¾   )N)(rI   rJ   rK   rL   rM   r1   rN   r   r=   rÍ   rÏ   rc   rÅ   rÆ   rÇ   rí   rð   ró   r÷   rú   rþ   r  r  r  r  r  r"  r%  r(  r+  r.  r1  r;  rF  r¦   r  r!  rÑ   rP   rQ   rR   s   @r0   r»   r»   p  s/  ø‡ € ñòa3ðF ñ	$ó ð	$ð ñ	&ó ð	&ð ñ	%ó ð	%ð ñ	%ó ð	%ð ñ	#ó ð	#ð ñ	ó ð	ð ñó ðð ñó ðò0ò(5ò(
2ò:ò*5ò*1ô6
ô8
ô<
ô2
ô@
ô:
ô6
ô<
ô2
ô@
ò:3ò6QôfH'òT3ô<>ô >÷ 1ð 1r3   r»   )rR  Únumpyr   Úscipy.linalgr   Úsettingsr   Úutilsr   r   r   Úfinfor6  Úepsr`   r	   rj   rl   r»   © r3   r0   Ú<module>ra     sZ   ðÛ ã Ý å ß ?Ñ ?ð 	‡h‚hˆuƒo×Ñ€÷s,ñ s,òl27÷juFñ uF÷pKó Kr3   