%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib64/python3.9/site-packages/numpy/lib/tests/__pycache__/
Upload File :
Create Path :
Current File : //lib64/python3.9/site-packages/numpy/lib/tests/__pycache__/test_polynomial.cpython-39.pyc

a

z[yc�,�@s^ddlZddlmZmZmZmZmZmZm	Z	ddl
Z
ejdejddZGdd�d�Z
dS)�N)�assert_�assert_equal�assert_array_equal�assert_almost_equal�assert_array_almost_equal�
assert_raises�assert_allcloseZ
AllIntegerZAllFloat�Oc@s�eZdZdd�Zdd�Zdd�Zej�de	�e
dd	�d
d��Zdd
�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�ZdS)(�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�E/usr/lib64/python3.9/site-packages/numpy/lib/tests/test_polynomial.py�test_poly1d_str_and_reprs"����z'TestPolynomial.test_poly1d_str_and_reprcCsXt�gd��}t�gd��}t|d�d�t|d�d�t|d�d�t|d�d�dS)	Nrrrr�gC@rg�U@�rrr�rrrrrr�test_poly1d_resolution%s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)rr
�)�@r
r��?g�?g@)gUUUUUU�?rr&�rrr)r� @g,@r)r)r&r&r&)g�r(�@r%)	rr)gB@gZ@g�j@g�s@g@t@gk@g@T@)g"@�(@g0@r)g@)rr+g@@gD@gA@r*r
)rrrrg�r()rrr�integ�deriv�polydivr#rrr�test_poly1d_math-s$$ �zTestPolynomial.test_poly1d_math�	type_codeN)r0�returnc	Cs�t�|�}tjgd�|d�}t�|�}tt�|�|�tt�|�j|�tt|�d�dddddd�}|��D]@\}}||}t||�|tjkr�t	|t
�s�J�qnt|j|�qndS)N�rr
r)�dtyper
rrr)rrrr
r)rr3�arrayrrZasarray�len�items�object_�
isinstance�int)	rr0r3�arrZcomparison_dct�index�refZscalarrrr�test_poly1d_miscBs



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_argWs��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)Nrr
)rrr�r2)r%r!rC)��r)ri����i����i��)yZd;�O�?y��C�l�@y���C�l��y�Zd;�O�)��?y��?@��?�y�?@y�?�)rF���rGrHy�?@y�?�)rFrIrGrH)rFrI�@y��rFrIrry������*�d)rr�poly�sqrtrZ	isrealobjZiscomplexobj�random�seedZrandn�concatenate�	conjugate)r�A�arrr�	test_polyas �zTestPolynomial.test_polycCstt�gd��ddg�dS)N)rrrr)rr�roots�rrrr�
test_rootsyszTestPolynomial.test_rootscCsTt�gd��}d|d<tt|�d�t�ddg�}d|d<d|d<tt|�d�dS)N)r%rr
rrrrrr
z 
0rA�rrrrr�test_str_leading_zeros|s�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*rrr
rD)rrrrrrrrErrg@T)�deg�cov)r\)gz6�>W�@g����H�?g��C�l�?r%)�decimal)g������?��������1w-!�?)r^g�H�}x@�B>�٬��)r_r`g�~j�t��?)�wr\)g�����@g*:��H�gY�8��m�?)g�����@�&S��H�}8�?)rbg����:@�h��s��)rcrdgz6�>W[�?Zunscaled)gгY����?�ŏ1wſ���{�?)reg�v��/�?�ŏ1w-!��)rfrggǺ���?)Zaxis�{)r%i')�sizeg�?g{�G�z�?)Zatol)rar[r\r*r')rr4ZlinspaceZpolyval�aranger�
ValueErrorZpolyfitrZnewaxisrQrOrPZnormal�zeros�shaperZstdrN�meanZonesZfull)r�c�xr>�errZweights�mr\ZestZval0Zm2Zcov2�valZm3Zcov3ZyyZccrnrarrr�test_polyfit�st����.  ""�
$$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.0rz1.333333333333333333333333333r
z1.5r)
r]rurrrr-r,Z
issubdtype�coeffsr3r7rMr)rrur�p2rrr�test_objects�s�zTestPolynomial.test_objectscCsNt�gd��}|��}t|jgd�k���|��}t|jddgk���dS)N)y@rJrF)rFrFrFry@rJ)rrr,rrv�allr-�rrrwrrr�test_complex�s
zTestPolynomial.test_complexcCs:t�gd��}|jdgd�d�}t|jgd�k���dS)N)rr
rr)�	rDrC)�k)g�������?gUUUUUU�?gUUUUUU�?g@rDrC)rrr,rrvryrzrrr�test_integ_coeffs�s
�z TestPolynomial.test_integ_coeffscCs,zt�t�d��Wnty&Yn0dS)N)rr)rrMrlrkrWrrr�test_zero_dims�szTestPolynomial.test_zero_dimscCs,t�dd�}tt�|�t�t�|���dS)z.
        Regression test for gh-5096.
        r�N)rrjrrMZdiag)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)
rr4rZastypeZint64rrvr3Zfloat32Z	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)Nr2)rr
r%FTr"rzrrr�test_poly_eq	szTestPolynomial.test_poly_eqcCs�t�gd��}t�gd��}t�||�\}}t|jjtj�t|jjtj�t||||�gd�}t�gd��}t�||�\}}t|tj�s�J�t|tj�s�J�t�||�\}	}
t|	tj�s�J�t|
tj�s�J�dS)N)r
rCrCr)rIrGy��rr2)rrr.rrvr3Z
complex128r8)r�brTrrro�d�s�t�ur�rrr�test_polydivszTestPolynomial.test_polydivcCsht�gd��}|jd7_t|jgd��|jdd7<t|jgd��ttt|dt�d��dS)	z# Coefficients should be modifiable r2r)r
rr%r
�
)r
r�rvN)rrrvrr�AttributeError�setattrr4rYrrr�test_poly_coeffs_mutable#sz'TestPolynomial.test_poly_coeffs_mutable)�__name__�
__module__�__qualname__r r$r/�pytestZmarkZparametrize�
TYPE_CODESrr=rBrUrXrZrtrxr{r~rr�r�r�r�r�rrrrr
s&
J	r
)ZnumpyrZ
numpy.testingrrrrrrrr�Z	typecodesr�r
rrrr�<module>s$

Zerion Mini Shell 1.0