https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/numpy/lib/tests/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/numpy/lib/tests/__pycache__/test_polynomial.cpython-310.pyc
o

6��a�)�@s>ddlZddlmZmZmZmZmZmZm	Z	Gdd�d�Z
dS)�N)�assert_�assert_equal�assert_array_equal�assert_almost_equal�assert_array_almost_equal�
assert_raises�assert_allclosec@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%S)&�TestPolynomialcCs�t�gd��}tt|�d�tt|�d�t�gd��}tt|�d�tt|�d�t�gd��}tt|�d�ttt�gd	���d
�dS)N���?��zpoly1d([1., 2., 3.])z   2
1 x + 2 x + 3��@r�zpoly1d([3., 2., 1.])�   2
3 x + 2 x + 1)y���[f�?@y��g"GBtk~�y@�?z=            3      2
(1.9 + 2j) x - 3j x - 5.123 x + (2 + 1j))���������z    2
-3 x - 2 x - 1)�np�poly1dr�repr�str)�self�p�q�r�r�A/usr/lib/python3/dist-packages/numpy/lib/tests/test_polynomial.py�test_poly1d_str_and_repr	s"����z'TestPolynomial.test_poly1d_str_and_reprcCsXt�gd��}t�gd��}t|d�d�t|d�d�t|d�d�t|d�d�dS)	Nr
rrr�gC@rg�U@�rrr�rrrrrr�test_poly1d_resolutionsz%TestPolynomial.test_poly1d_resolutioncCs�t�gd��}t�gd��}t||t�dg�t�ddg�f�t|��t�gd���t|�d�t�gd���t�gd��}t�gd	��}t||t�gd
���t||t�gd���t||t�gd���t|d
t�gd���t||�t�gd���t||�t�gd���t|��t�ddg��t|�d�t�dg��tt�t�gd��t�ddg��t�ddg�t�dg�f�dS)N)rr�)�@rr��?g�?g@)gUUUUUU�?rr%�rr
r)r� @g,@r(r)r%r%r%)g�r'�@r$)	rr(gB@gZ@g�j@g�s@g@t@gk@g@T@)g"@�(@g0@r(g@)rr*g@@gD@gA@r)r)rrrrg�r')rrr�integ�deriv�polydivr"rrr�test_poly1d_math's$$ �zTestPolynomial.test_poly1d_mathcCs\t�gd��}tt�|�t�gd���tt|�d�t|d|d|d|dfd�dS)Nr
)rr)rrrrr
)rr)rr)rrr�asarray�array�len�rrrrr�test_poly1d_misc<s&zTestPolynomial.test_poly1d_misccCsDtjgd�dd�}tt|�d�tjgd�dd�}tt|�d�dS)Nr
�y)�variablez   2
1 y + 2 y + 3�lambdaz!        2
1 lambda + 2 lambda + 3�rrrr)rrrrr�test_poly1d_variable_argBs��z'TestPolynomial.test_poly1d_variable_argcCsbtt�dt�d�t�d�g�gd��gd�gd�gd�g}tt�|�gd��tt�t�gd����tt�t�gd	����tt�t�gd
����tt�t�gd����tt�t�gd����tt�t�d
dg���tt�t�ddg���tt�t�d
dg���tj�d�tj�	d�d
tj�	d�}tt�t�t�
|t�|�f����dS)Nr
r)rrr��rrr
)r$r r9)��r)ri����i����i��)yZd;�O�?y��C�l�@y���C�l��y�Zd;�O�)��?y��?@��?�y�?@y�?�)r=���r>r?y�?@y�?�)r=r@r>r?)r=r@�@y��r=r@rry������*�d)rr�poly�sqrtr�	isrealobj�iscomplexobj�random�seed�randn�concatenate�	conjugate)r�A�arrr�	test_polyLs �(zTestPolynomial.test_polycCstt�gd��ddg�dS)N)rrrr)rr�roots�rrrr�
test_rootsdszTestPolynomial.test_rootscCsTt�gd��}d|d<tt|�d�t�ddg�}d|d<d|d<tt|�d�dS)N)r$r
rrrr
rrrz 
0r7r2rrr�test_str_leading_zerosgs�z%TestPolynomial.test_str_leading_zeroscCs�t�gd��}t�ddd�}t�||�}gd�}t�ddd�dd	}tttjdgdgdd
d�tj|||dd
d�\}}gd
�}t||dd�gd�gd�gd�g}	t|	|dd�tj|||d|d
d�\}
}tgd�|
dd�gd�gd�gd�g}t||dd�tj|||d|dd�\}
}tgd�|
dd�gd�gd�gd�g}t||dd�|dd�tj	f}|dd�tj	f}t|t�||d��tj
||fdd�}tj
||fdd�}t|t�||d��tj||t�|�dd�tj	fdd
d�\}}t||dd�dfdd�t||dd�dfdd�t|	|dd�dd�dfdd�t|	|dd�dd�dfdd�tj�d�tjj
dd�}tjt�|jd�|dd
d�\}}t|��d d!d"�tt�|���d d!d"�tjt�|jd�|t�|jd�ddd#�\}}t|��d d!d"�tt�|���d �t�|jdd$�}tjt�|jd�||dd
d#�\}}t|��d d!d"�tt�|���d d!d"�tjt�|jd�||ddd#�\}}t|��d d!d"�tt�|���d%�dS)&N)rr)rrrr;)rrrrrrrr<rrg@T)�deg�cov)rU)gz6�>W�@g����H�?g��C�l�?r$)�decimal)g������?��������1w-!�?)rWg�H�}x@�B>�٬��)rXrYg�~j�t��?)�wrU)g�����@g*:��H�gY�8��m�?)g�����@�&S��H�}8�?)r[g����:@�h��s��)r\r]gz6�>W[�?�unscaled)gгY����?�ŏ1wſ���{�?)r_g�v��/�?�ŏ1w-!��)r`ragǺ���?)�axis�{)r$i')�sizeg�?g{�G�z�?)�atol)rZrTrUr)r&)rr0�linspace�polyval�aranger�
ValueError�polyfitr�newaxisrKrHrI�normal�zeros�shaper�stdrE�mean�ones�full)r�c�xr4�err�weights�mrU�est�val0�m2�cov2�val�m3�cov3�yy�ccrprZrrr�test_polyfitsst����.  ""
�$$zTestPolynomial.test_polyfitcCs�ddlm}t�|d�|d�|d�g�}||d�}t|d|d�k�|��}t|d|d	�k�|��}t|d
|d�k�t|d|d
�k�tt�|jj	tj
��t�|d�|d�g�}tt�|d�|d�g�d|d�|d�g�dS)Nr)�Decimalz4.0z3.0z2.0z1.333333333333333rz3.9999999999999990z8.0r
z1.333333333333333333333333333rz1.5r)
rVr�rrrr,r+�
issubdtype�coeffs�dtype�object_rDr)rr�r�p2rrr�test_objects�s�zTestPolynomial.test_objectscCsNt�gd��}|��}t|jgd�k���|��}t|jddgk���dS)N)y@rAr=)r=r=r=ry@rA)rrr+rr��allr,�rrr�rrr�test_complex�s
zTestPolynomial.test_complexcCs:t�gd��}|jdgd�d�}t|jgd�k���dS)N)r
rrr
)�	r;r9)�k)g�������?gUUUUUU�?gUUUUUU�?g@r;r9)rrr+rr�r�r�rrr�test_integ_coeffs�s
�z TestPolynomial.test_integ_coeffscCs,zt�t�d��WdStyYdSw)N)rr)rrDrmrirQrrr�test_zero_dims�s
�zTestPolynomial.test_zero_dimscCs,t�dd�}tt�|�t�t�|���dS)z.
        Regression test for gh-5096.
        r�N)rrhrrD�diag)r�vrrr�test_poly_int_overflow�s z%TestPolynomial.test_poly_int_overflowcCsxt�gd��}t�|�tj��}t|jjtj�t�|�tj��}t|jjtj�t�|�tj	��}t|jjtj	�dS)z/
        Regression test for gh-16354.
        )rrrN)
rr0r�astype�int64rr�r��float32�	complex64)r�zrrrr�test_zero_poly_dtype�sz#TestPolynomial.test_zero_poly_dtypecCsft�gd��}t�gd��}t|dkd�t|dkd�t||kd�t||kd�t||kd�dS)Nr:)rrr$FTr!r�rrr�test_poly_eq�szTestPolynomial.test_poly_eqcCs�t�gd��}t�gd��}t�||�\}}t|jjtj�t|jjtj�t||||�gd�}t�gd��}t�||�\}}t|tj�sJJ�t|tj�sRJ�t�||�\}	}
t|	tj�sbJ�t|
tj�sjJ�dS)N)rr9r9r)r@r>y��rr:)rrr-rr�r��
complex128�
isinstance)r�brNrrrs�d�s�t�ur�rrr�test_polydiv�szTestPolynomial.test_polydivcCsht�gd��}|jd7_t|jgd��|jdd7<t|jgd��ttt|dt�d��dS)	z# Coefficients should be modifiable r:r)rr
r$r�
)rr
�r�N)rrr�rr�AttributeError�setattrr0r2rrr�test_poly_coeffs_mutablesz'TestPolynomial.test_poly_coeffs_mutableN)�__name__�
__module__�__qualname__rr#r.r3r8rOrRrSr�r�r�r�r�r�r�r�r�r�rrrrr	s&
J	r	)�numpyr�
numpy.testingrrrrrrrr	rrrr�<module>s$

https://t.me/RX1948 - 2025