+
    LV-jà   ã                   óÖ   € R t ^ RIt^ RIHu Ht ^ RIHtHtH	t	H
t
Ht  ^ RIHt R tR tRR ltRR ltR tR	 tR
 tR tRR/R ltRR/R ltRR/R ltR#   ] d
    ^ RIHt  LBi ; i)a0  Partial replacements for numpy polynomial routines, with Array API compatibility.

This module contains both "old-style", np.poly1d, routines from the main numpy
namespace, and "new-style", np.polynomial.polynomial, routines.

To distinguish the two sets, the "new-style" routine names start with `npp_`
N)Ú
xp_promoteÚxp_default_dtypeÚxp_sizeÚ	xp_deviceÚis_numpy)ÚRankWarningc                 ó  € VP                  V 4      p VP                  V P                  R 4      '       d@   \        V 4      VP	                  V 4      ,           VP                  V 4      ^,          ,           pMT pVP                  V4      pW,          # )úcomplex floating)ÚasarrayÚisdtypeÚdtypeÚabsÚrealÚimagÚargsort)ÚarrÚxpÚsorterÚidxss   &&  Úh/Volumes/fast/ai/experiments/ui-tars-smoke/.venv/lib/python3.14/site-packages/scipy/signal/_polyutils.pyÚ_sort_cmplxr      si   € ð �*‰*�S‹/€CØ	‡z�z�#—)‘)Ð/×0Ò0Ü�S“˜BŸG™G C›LÕ(¨2¯7©7°3«<¸­?Õ:‰àˆà�:‰:�fÓ€DØ�9Ðó    c               ób  € V P                   ^ ,          ^8  d   VP                  . V P                  R7      # \        VRR4      pV'       d	   V! V 4      # V P                   ^ ,          pVP	                  V^,
          V^,
          RV P                  R7      pVP                  V R,          4      ) V ^ ,          ,          VR&   \        VP                  R4      '       d   VP                  P                  V4      # ^ RI	pVP                  VP                  P                  VP                  V4      4      4      # )	z(numpy.roots, best-effor replacement
    ©r   ÚrootsN)Úkr   :é   NNÚeigvalséÿÿÿÿ)ºNNNr   )
Úshaper
   r   ÚgetattrÚeyeÚflipÚhasattrÚlinalgr   Únumpy)Úcoefr   Ú	root_funcÚnÚaÚnps   &$    r   Ú	polyrootsr,   "   sì   € ð ‡z�z�!…}�qÔØ�z‰z˜" D§J¡JˆzÓ/Ð/ä˜˜G TÓ*€Ißñ ˜‹Ðð 	�
‰
�1�€AØ
�‰ˆq�1�u�a˜!•e˜r¨¯©ˆÓ4€AØ—‘˜˜R�Ó!Ð! D¨¥GÕ+€A€e�Hô ˆr�y‰y˜)×$Ò$Ø�y‰y× Ñ  Ó#Ð#ãØ�z‰z˜"Ÿ)™)×+Ñ+¨B¯J©J°q«MÓ:Ó;Ð;r   c                 óð   € ^ pVP                  4       pRV9   d   V  F  pVR8w  d    MV^,           pK  	  V P                  ^ ,          pRV9   d&   V RRR1,           F  pVR8w  d    MV^,
          pK  	  WV # )é    ÚFç        ÚBNr   )Úupperr    )ÚfiltÚtrimÚfirstÚiÚlasts   &&   r   Ú_trim_zerosr8   <   s€   € Ø€EØ�:‰:‹<€DØ
ˆd„{ÛˆAØ�BŒwÙà �	’ñ	 ð
 �:‰:�a�=€DØ
ˆd„{Ø‘d˜�d—�ˆAØ�BŒwÙà˜a•x’ñ	 ð
 �dÐÐr   c                 óà  € \        WR VR7      w  rVfY   VP                  V P                  4      P                  \	        V P
                  R,          V P
                  R,          4      ,          p\        V4      '       d   ^ RIHp V! WVR7      # \        VP                  RR4      ;p'       d   V! WVR7      # VP                  P                  V RR7      w  rgpWs8„  p	\        P                  ! W—3R	 R
R7      pVP                  VP
                  ^ ,          4      V,          p
VP                  V
,          VP                  ,          V,          pVP!                  V	4      pVP#                  . 4      pW½WÇ3# )T©Úforce_floatingr   N)Úlstsq)Úcondr<   )ÚrcondF)Úfull_matricesc                 ó   € R V ,          # )ç      ð?© )Úxs   &r   Ú<lambda>Ú_lstsq.<locals>.<lambda>d   s   € ¸2À¾6r   r0   )Ú
fill_valuer   éþÿÿÿ)r   Úfinfor   ÚepsÚmaxr    r   Úscipy.linalgr<   r!   r%   ÚsvdÚxpxÚapply_wherer"   ÚTÚcount_nonzeror
   )r*   Úbr   r>   Ús_lstsqÚ
lstsq_funcÚuÚsÚvtÚsing_val_maskÚsigmarC   ÚrankÚ	residualss   &&&&          r   Ú_lstsqr[   S   s!  € Ü�a¨4°BÔ7�D€Aà‚}Ø—‘˜Ÿ™Ó!×%Ñ%¬¨A¯G©G°B­K¸¿¹À½Ó(EÕEˆä�‡|‚|Ý1Ù�q %Ô(Ð(Ü˜rŸy™y¨'°4Ó8Ð	8ˆÖ	8á˜! eÔ,Ð,ð —9‘9—=‘= °%�=Ó8‰ˆˆbà™	ˆÜ�OŠO˜M¨4Ñ1AÈbÔQˆà—‘�q—w‘w˜q•zÓ" QÕ&ˆØ�D‰D�5�L˜1Ÿ3™3Õ Õ"ˆà×Ñ Ó.ˆð —J‘J˜r“Nˆ	Ø˜TÐ$Ð$r   c               óö   € \         P                  ! V ^VR7      p V P                  ^8”  d   \        R4      h\	        V RR7      p V P
                  ^ ,          ^ 8X  d   VP                  ^ .V P                  R7      p V # )zLConstructor of np.poly1d object from an array of coefficients (r=False)
    ©Úndimr   zPolynomial must be 1d only.Úf)r4   r   )rM   Ú
atleast_ndr^   Ú
ValueErrorr8   r    r
   r   )Úc_or_rr   s   &$r   Ú_poly1drc   t   sf   € ô �^Š^˜F¨¨rÔ2€FØ‡{�{�Q„ÜÐ6Ó7Ð7Ü˜ cÔ*€FØ‡|�|�A…˜!ÔØ—‘˜Q˜C v§|¡|�Ó4ˆØ€Mr   c               óà   € VP                  V 4      p VP                  V4      pVP                  V4      p\        V P                  ^ ,          4       F  pW1,          WR3,          ,           pK  	  V# )z'Old-style polynomial, `np.polyval`
    .)r
   Ú
zeros_likeÚranger    )ÚprC   r   ÚyÚjs   &&$  r   Úpolyvalrj   �   s\   € ð 	�
‰
�1‹€AØ
�
‰
�1‹€AØ
�‰�aÓ€Aô �1—7‘7˜1•:ÖˆØ�E�A˜�f•IÕŠñ à€Hr   c          
      óP  € VP                  V 4      p \        P                  ! V ^VR7      p V P                  ^ ,          ^ 8X  d-   VP                  RVP	                  V 4      P
                  R7      # \        VRR4      pVf   ^ RIHp V P
                  pVP                  RVR7      pVP                  V ^ ,          4      pV  F  pV! WAP                  WV) 34      RR7      pK   	  VP                  VP
                  R	4      '       d¤   VP                  WP                  R7      pVP                  VP                  VP!                  V4      4      VP                  VP!                  VP#                  V4      4      4      8H  4      '       d#   VP                  VP	                  V4      R
R7      pV# )r   r]   rA   r   ÚconvolveN©rl   Úfull)Úmoder	   T)Úcopy©r   )r
   rM   r`   r    r   r   r!   Úscipy.signalrl   ÚonesÚ	ones_likeÚstackr   Ú
complex128ÚallÚsortr   Úconj)Úseq_of_zerosr   Úconvolve_funcÚdtr*   ÚoneÚzeror   s   &$      r   Úpolyr   �   sL  € à—:‘:˜lÓ+€LÜ—>’> ,°Q¸2Ô>€Là×Ñ˜!Õ Ô!Ø�z‰z˜# R§W¡W¨\Ó%:×%@Ñ%@ˆzÓAÐAô ˜B 
¨DÓ1€MØÒÝ:à	×	Ñ	€BØ
�‰�˜BˆÓ€AØ
�,‰,�| A•Ó
'€CÛˆÙ˜!ŸX™X s¨E lÓ3¸&ÔAŠñ ð 
‡z�z�!—'‘'Ð-×.Ò.à—
‘
˜<¯}©}�
Ó=ˆØ�6‰6�"—'‘'˜"Ÿ'™' %›.Ó)¨R¯W©W°R·W±W¸R¿W¹WÀU»^Ó5LÓ-MÑM×NÒNØ—
‘
˜2Ÿ7™7 1›:¨D�
Ó1ˆAà€Hr   c                ór   € \        WR 7      \        WR 7      r\        VRR4      pVf   ^ RIHp V! W4      pV# ))r   rl   Nrm   )rc   r!   rr   rl   )Úa1Úa2r   r{   Úvals   &&$  r   Úpolymulr„   ­   s;   € Ü�RÔ¤¨Ô!3ˆô ˜B 
¨DÓ1€MØÒÝ:á
˜Ó
€CØ€Jr   r>   c          	      ó   € \        V4      ^,           pVP                  V 4      p VP                  V4      p\        WRVR7      w  rV^ 8  d   \        R4      hV P                  ^8w  d   \        R4      h\        V 4      ^ 8X  d   \        R4      hVP                  ^8  g   VP                  ^8”  d   \        R4      hV P                  ^ ,          VP                  ^ ,          8w  d   \        R4      hVf>   V P                  ^ ,          VP                  V P                  4      P                  ,          pVP                  VP                  WPP                  \        V 4      R7      4      pV R,          VR,          ,          pVP                  VP                  Ww,          ^ R	7      4      pWx,          p\!        WqWCR
7      w  ršrºV	P"                  V,          P"                  p	Wµ8w  d    Rp\$        P&                  ! V\(        ^R7       V	# )r   Tr:   zexpected deg >= 0zexpected 1D vector for xzexpected non-empty vector for xzexpected 1D or 2D array for yz$expected x and y to have same length)r   Údevice©Úaxis)r>   r   z!Polyfit may be poorly conditioned)Ú
stacklevel)r   N)Nr   )Úintr
   r   ra   r^   Ú	TypeErrorr   r    rH   r   rI   r#   Úaranger   ÚsqrtÚsumr[   rO   ÚwarningsÚwarnr   )rC   rh   Údegr   r>   ÚorderÚpowersÚlhsÚscaleÚcÚ_rY   Úmsgs   &&&$$        r   Úpolyfitr™   º   sŒ  € ä�‹H�q�L€EØ
�
‰
�1‹€AØ
�
‰
�1‹€AÜ�a¨4°BÔ7�D€Að ˆQ„wÜÐ,Ó-Ð-Ø‡v�v�„{ÜÐ2Ó3Ð3Üˆqƒz�Q„ÜÐ9Ó:Ð:Ø‡v�v�„z�Q—V‘V˜a”ZÜÐ7Ó8Ð8Ø‡w�wˆq…z�Q—W‘W˜Q•ZÔÜÐ>Ó?Ð?ð ‚}Ø—‘˜•
˜RŸX™X a§g¡gÓ.×2Ñ2Õ2ˆð �W‰W�R—Y‘Y˜u¯G©G¼IÀa»L�YÓIÓJ€FØ
ˆG�*˜˜w�Õ
'€Cð �G‰G�B—F‘F˜3�9¨1�FÓ-Ó.€EØ…L€Cä˜3¨Ô6�M€Aˆ$Ø	
�‰ˆu��‰€Að „}Ø1ˆÜ�Š�cœ;°1Õ5à€Hr   ÚtensorTc                óB  € VP                  VP                  R 4      '       d   VP                  V\        V4      4      p\        P
                  ! V^VR7      p\        V \        \        ,          4      '       d   VP                  V 4      p V'       d4   VP                  WP                  RV P                  ,          ,           4      p\        VR,          V RVR7      w  rE\        ^VP                  ^ ,          ^,           4       F  pW) R3,          W@,          ,           pK  	  V# )Úintegralr]   .T)Ú	broadcastr   rq   )r   .)r   r   Úastyper   rM   r`   Ú
isinstanceÚtupleÚlistr
   Úreshaper    r^   r   rf   )rC   r–   r   rš   Úc0r—   r6   s   &&$$   r   Únpp_polyvalr¤   è   sË   € Ø	‡z�z�!—'‘'˜:×&Ò&Ø�I‰I�aÔ)¨"Ó-Ó.ˆä�Š�q˜q RÔ(€AÜ�!”UœT•\×"Ò"Ø�J‰J�q‹MˆßØ�J‰J�qŸ7™7 T¨!¯&©&¥[Õ0Ó2ˆä�q˜•z 1°¸Ô<�E€BÜ�1�a—g‘g˜a•j 1•nÖ%ˆØˆr�3ˆw�Z˜"�$ÕŠñ &à€Ir   c                óŽ  € \         P                  ! V^VR7      p\        V \        \        ,          4      '       d   VP                  V 4      p V'       d5   VP                  WP                  RV P                  ,          ,           4      pM&V P                  VP                  8¼  d   \        R4      hVP                  W,
          ^ R7      # )r   r]   z,x.ndim must be < r.ndim when tensor == Falser‡   rq   )rM   r`   rŸ   r    r¡   r
   r¢   r    r^   ra   Úprod)rC   Úrr   rš   s   &&$$r   Únpp_polyvalfromrootsr¨   ù   s‡   € Ü�Š�q˜q RÔ(€Aô �!”UœT•\×"Ò"Ø�J‰J�q‹MˆçØ�J‰J�qŸ'™' D¨1¯6©6¥MÕ1Ó2‰Ø	
�‰�1—6‘6Ô	ÜÐGÓHÐHØ�7‰7�1•5˜qˆ7Ó!Ð!r   )Úfb)NN)Ú__doc__r�   Úscipy._lib.array_api_extraÚ_libÚarray_api_extrarM   Úscipy._lib._array_apir   r   r   r   r   Únumpy.exceptionsr   ÚImportErrorr&   r   r,   r8   r[   rc   rj   r   r„   r™   r¤   r¨   rB   r   r   Ú<module>r±      sŠ   ðñó ß (Ð (÷õ ð"Ý,ò
ò<ô4ô.%òB	òòò:	ð' Dô 'ð\ Dô ð""¨Tö "øðS ô "ç!ð"ús   ŸA ÁA(Á'A(