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/polynomial/tests/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

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

6��aO�
@s0dZddlmZddlZddlmmZddlm	Z	m
Z
mZmZm
Z
mZmZdd�ZdgZddgZgd�Zgd	�Zgd
�Zgd�Zgd�Zgd
�Zgd�Zgd�Zeeeeeeeeeeg
ZGdd�d�ZGdd�d�ZGdd�d�ZGdd�d�ZGdd�d�Z Gdd�d�Z!Gdd�d�Z"Gdd�d�Z#dS) zTests for polynomial module.

�)�reduceN)�assert_almost_equal�
assert_raises�assert_equal�assert_�assert_warns�assert_array_equal�assert_raises_regexcCstj|dd�S)Ng���ư>)�tol)�poly�polytrim��x�r�H/usr/lib/python3/dist-packages/numpy/polynomial/tests/test_polynomial.py�trim
sr�)���r�)r���r�)rri����r�)r�ri��r�)rr�ri���r� )ri����r�8ri����r�@)	rri��r�ri���r�)
r�	ri����ri�ri����r�c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�
TestConstantscC�ttjddg�dS)Nrr)rr�
polydomain��selfrrr�test_polydomain �zTestConstants.test_polydomaincC�ttjdg�dS)Nr)rr�polyzeror%rrr�
test_polyzero#�zTestConstants.test_polyzerocCr)�Nr)rr�polyoner%rrr�test_polyone&r,zTestConstants.test_polyonecCr#)Nrr)rr�polyxr%rrr�
test_polyx)r(zTestConstants.test_polyxN)�__name__�
__module__�__qualname__r'r+r/r1rrrrr"s
r"c@�<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�TestArithmeticcCs�td�D]H}td�D]A}d|�d|��}t�t||�d�}||d7<||d7<t�dg|dgdg|dg�}tt|�t|�|d�q
qdS�Nr�At i=�, j=rr��err_msg)�range�np�zeros�maxr�polyaddrr�r&�i�j�msg�tgt�resrrr�test_polyadd/�$��zTestArithmetic.test_polyaddcCs�td�D]H}td�D]A}d|�d|��}t�t||�d�}||d7<||d8<t�dg|dgdg|dg�}tt|�t|�|d�q
qdSr7)r<r=r>r?r�polysubrrrArrr�test_polysub9rHzTestArithmetic.test_polysubcCsrtt�dg�dg�tt�dg�ddg�tdd�D]}dg|dg}dg|ddg}tt�|�|�qdS)Nrrr)rr�polymulxr<)r&rB�serrErrr�
test_polymulxCs�zTestArithmetic.test_polymulxcCs�td�D]A}td�D]:}d|�d|��}t�||d�}|||d7<t�dg|dgdg|dg�}tt|�t|�|d�q
qdSr7)r<r=r>r�polymulrrrArrr�test_polymulKs$��zTestArithmetic.test_polymulc
Cs�tttjdgdg�t�dgdg�\}}t||fd�t�ddgdg�\}}t||fd�td�D]B}td�D];}d|�d|��}dg|ddg}dg|ddg}t�||�}t�||�\}}t�t�||�|�}	t|	||d	�q7q1dS)
Nrrr)rr))rrrrr8r9r:)r�ZeroDivisionErrorr�polydivrr<r@rN)
r&�quo�remrBrCrD�ci�cjrErFrrr�test_polydivTs ��zTestArithmetic.test_polydivcCs|td�D]7}td�D]0}d|�d|��}t�|d�}ttj|g|t�dg��}t�||�}tt	|�t	|�|d�q
qdS)Nrr8r9rr:)
r<r=�arangerrrN�array�polypowrr)r&rBrCrD�crErFrrr�test_polypowis��zTestArithmetic.test_polypowN)	r2r3r4rGrJrMrOrVr[rrrrr6-s

	r6c@s�eZdZe�gd��Ze�dee�Ze�deee�Zej	�	d�ddZ
e�e
gd��Z
dd�Zd	d
�Zdd�Zd
d�Zdd�Zdd�ZdS)�TestEvaluation)��?g@g@�i,j->ij�
i,j,k->ijk��rrrc
s~tt�gdg�jd�t�dd���fdd�td�D�}td�D]}||}t��dg|dg�}t||�q ��dd}t��gd��}t||�td	�D]/}dg|}t�|��tt��dg�j	|�tt��ddg�j	|�tt��gd
��j	|�qQgd�}tj
jgd�|d
�}t�gd�|�}t|j
|�Gdd�dtj�}t�gd���|�}	ttt�gd�|	��|�dS)Nrrrc�g|]}�|�qSrr��.0rBr
rr�
<listcomp>��z/TestEvaluation.test_polyval.<locals>.<listcomp>rr)rrrrra�rrr)FTF�rrra)�mask)�rrac@seZdZdS)z&TestEvaluation.test_polyval.<locals>.CN)r2r3r4rrrr�C�srk�rrar)rr�polyval�sizer=�linspacer<rr>�shape�marXrri�ndarray�view�type)
r&�yrBrErF�dimsri�mxrk�cxrr
r�test_polyval}s.


zTestEvaluation.test_polyvalcs�tttjdgdgdd�tt�gdg�jd�tt�gdg�jdk�tt�gdgdg�jd�tt�gdgdg�jdk�tt�dd�d�tt�dt�	d��jd	k�t�
d
d���fdd�td�D�}tdd�D]}||}t��dg|�}t||�qm��d�d}t��gd
��}t||�td�D]/}dg|}t�
|��tt��dg�j|�tt��ddg�j|�tt��gd��j|�q�gd�}t�|�}t�
d
d��tt��|�t��|��d}t�dd��tjjdd|d�}tj�|dd�}t�|jdd��}t|j�D]}	t��|	|dd�|	f�||	<�qt||�t��d�g��tj�|dd�}t�|jdd��j�}t|jd�D]#}	t�jd�D]}
t��|
|dd�|	f�||	|
dd�f<�qX�qOt||�dS)NrF)�tensorr)rr)rr)rara)rarcrbrrrcr
rrre�rfz8TestEvaluation.test_polyvalfromroots.<locals>.<listcomp>)rrrrarrg)�ri����rr`r���)rnT)r�
ValueErrorr�polyvalfromrootsrrnrrpr=�onesror<rr>�	polyrootsrmrW�random�randint�empty�vstack)r&rurBrErFrv�ptest�r�rshape�ii�jjrr
r�test_polyvalfromroots�s\
�




�$
.�z$TestEvaluation.test_polyvalfromrootsc
Cs�|j\}}}|j\}}}ttdtj||dd�|j�||}t�|||j�}t||�t�	d�}	t�|	|	|j�}t
|jdk�dS�N�incompatibler�rra)rrur	r~r�	polyval2d�c2drr=r�rrp�
r&�x1�x2�x3�y1�y2�y3rErF�zrrr�test_polyval2d�s�

zTestEvaluation.test_polyval2dc
	Cs�|j\}}}|j\}}}ttdtj|||dd�|j�|||}t�||||j�}t||�t�	d�}	t�|	|	|	|j�}t
|jdk�dSr�)rrur	r~r�	polyval3d�c3drr=r�rrpr�rrr�test_polyval3d�s�

zTestEvaluation.test_polyval3dc
Csl|j\}}}|j\}}}t�d||�}t�|||j�}t||�t�d�}	t�|	|	|j�}t	|j
dk�dS)Nr^r�)rrarra)rrur=�einsumr�
polygrid2dr�rr�rrpr�rrr�test_polygrid2ds

zTestEvaluation.test_polygrid2dc
Csr|j\}}}|j\}}}t�d|||�}t�||||j�}t||�t�d�}	t�|	|	|	|j�}t	|j
dk�dS)Nr_r�)rrarrarra)rrur=r�r�
polygrid3dr�rr�rrpr�rrr�test_polygrid3ds

zTestEvaluation.test_polygrid3dN)r2r3r4r=rX�c1dr�r�r�r�rrrmruryr�r�r�r�r�rrrrr\ss$@r\c@�eZdZdd�Zdd�ZdS)�TestIntegralc	Cs4tttjdgd�tttjdgd�tttjdgdddg�tttjdgdgd�tttjdgdgd�tttjdgdd�tt��t�ddgd�Wd�n1sUwYtd	d
�D]}dg|d	dg}tjdg||d�}t|ddg�q_td
�D]-}|d}dg|dg}|gdg|d|g}tj|d|gd�}tt	|�t	|��q�td
�D]!}|d}dg|dg}tj|d|gdd�}tt�
d|�|�q�td
�D].}|d}dg|dg}|gdg|d	|g}tj|d|gd	d
�}tt	|�t	|��q�td
�D]9}td	d
�D]0}dg|dg}|dd�}t|�D]
}tj|dd�}�q&tj||d�}tt	|�t	|���q�qtd
�D]@}td	d
�D]7}dg|dg}|dd�}t|�D]}tj|d|gd�}�qdtj||tt|��d�}tt	|�t	|���qP�qItd
�D]B}td	d
�D]9}dg|dg}|dd�}t|�D]
}tj|d|gdd�}�q�tj||tt|��dd�}tt	|�t	|���q��q�td
�D]B}td	d
�D]9}dg|dg}|dd�}t|�D]
}tj|d|gd	d
�}�q�tj||tt|��d	d
�}tt	|�t	|���qܐq�dS)Nr��?rr)�lbnd)�scl��axisr]rr)�m�k)r�r�r�)r�r�r��r�)r�	TypeErrorr�polyintr~r�DeprecationWarningr<rrrm�list)r&rBr�rFr��polrErCrrr�test_polyint$s�
��	�	�	��zTestIntegral.test_polyintcCs�tj�d�}t�dd�|jD��j}tj|dd�}t||�t�dd�|D��}tj|dd�}t||�t�dd�|D��}tj|d	dd
�}t||�dS)N�rarcS�g|]}t�|��qSr�rr��rdrZrrrrex�z2TestIntegral.test_polyint_axis.<locals>.<listcomp>rr�cSr�rr�r�rrrre|r�rcSsg|]	}tj|dd��qS)ra)r�r�r�rrrre�sra)r�r�)r=r�r��Trr�r�r&r�rErFrrr�test_polyint_axists

zTestIntegral.test_polyint_axisN)r2r3r4r�r�rrrrr�"sPr�c@r�)�TestDerivativecCstttjdgd�tttjdgd�td�D]}dg|dg}tj|dd�}tt|�t|��qtd�D]'}tdd�D]}dg|dg}tjtj||d�|d�}t	t|�t|��q<q5td�D])}tdd�D]!}dg|dg}tjtj||dd�|dd�}t	t|�t|��qhqadS)	Nrr�rrrr�r)r�r�)
rr�r�polyderr~r<rrr�r)r&rBrErFrCrrr�test_polyder�s&���zTestDerivative.test_polydercCsltj�d�}t�dd�|jD��j}tj|dd�}t||�t�dd�|D��}tj|dd�}t||�dS)Nr�cSr�r�rr�r�rrrre�r�z4TestDerivative.test_polyder_axis.<locals>.<listcomp>rr�cSr�rr�r�rrrre�r�r)r=r�r�r�rr�rr�rrr�test_polyder_axis�s
z TestDerivative.test_polyder_axisN)r2r3r4r�r�rrrrr��sr�c@s@eZdZej�d�ddZdd�Zdd�Zdd	�Zd
d�Z	dS)
�
TestVanderr`rrcCs�t�d�}t�|d�}t|jdk�td�D]}dg|dg}t|d|ft�||��qt�	ddgddgdd	gg�}t�|d�}t|jd
k�td�D]}dg|dg}t|d|ft�||��qMdS)Nrar�rrr.rr�)rarr)
r=rWr�
polyvanderrrpr<rrmrX)r&r�vrB�coefrrr�test_polyvander�s
�zTestVander.test_polyvandercCsx|j\}}}tj�d�}t�||ddg�}t�|||�}t�||j�}t||�t�|g|gddg�}t	|j
dk�dS)Nr�rr)rrr�)rr=r�r�polyvander2dr��dot�flatrrrp�r&r�r�r�rZ�vanrErFrrr�test_polyvander2d�s
zTestVander.test_polyvander2dcCs�|j\}}}tj�d�}t�|||gd��}t�||||�}t�||j�}t||�t�|g|g|ggd��}t	|j
dk�dS)Nrlrh)rr�)rr=r�r�polyvander3dr�r�r�rrrpr�rrr�test_polyvander3d�s
zTestVander.test_polyvander3dcCst�d�}tttj|d�dS)Nrar)r=rWrr~rr�)r&rrrr�test_polyvandernegdeg�s
z TestVander.test_polyvandernegdegN)
r2r3r4r=r�rr�r�r�r�rrrrr��s

r�c@s$eZdZdd�Zdd�Zdd�ZdS)�
TestCompanioncCs"tttjg�tttjdg�dSr-)rr~r�
polycompanionr%rrr�test_raises�szTestCompanion.test_raisescCs<tdd�D]}dg|dg}tt�|�j||fk�qdS)Nrrr)r<rrr�rp)r&rBr�rrr�test_dimensions�s�zTestCompanion.test_dimensionscCstt�ddg�ddk�dS)Nrr)rr��)rrr�r%rrr�test_linear_root�szTestCompanion.test_linear_rootN)r2r3r4r�r�r�rrrrr��sr�c@r5)�TestMiscc	Cs�t�g�}tt|�dg�tdd�D]/}t�t�tjdd|d�ddd��}t	|}t�|�d|d}tt|�t|��qdS)Nrrrr)
r�
polyfromrootsrrr<r=�cosro�pi�Tlist)r&rFrB�rootsrErrr�test_polyfromroots�s
*�zTestMisc.test_polyfromrootscCsltt�dg�g�tt�ddg�dg�tdd�D]}t�dd|�}t�t�|��}tt|�t|��qdS)Nrrr�rr)rrr�r<r=ror�r)r&rBrErFrrr�test_polyroots�s�zTestMisc.test_polyrootscCs�dd�}dd�}tttjdgdgd�tttjdggdgd�tttjgdgd�tttjdgdgggd�tttjddgdgd�tttjdgddgd�tttjdgdgddggd	�tttjdgdgdddgd	�tttjdgdgdg�tttjdgdggd
��tttjdgdgg�t�dd�}||�}t�||d�}tt|�d�t	t�
||�|�t�||gd
��}tt|�d�t	t�
||�|�t�||d�}tt|�d�t	t�
||�|�t�||gd��}tt|�d�t	t�
||�|�t�|t�||g�jd�}t	|t�||g�j�t�|t�||g�jgd
��}t	|t�||g�j�t�
|�}|��}	d|ddd�<d|	ddd�<tj||	d|d	�}
t	|
|�tj||	gd
�|d	�}
t	|
|�tj|t�|	|	g�jd|d	�}t	|t�||g�j�tj|t�|	|	g�jgd
�|d	�}t	|t�||g�j�gd�}t	t�||d�ddg�t	t�||ddg�ddg�t�dd�}||�}t�||d�}t	t�
||�|�t�||gd��}
t	t�
||
�|�t	||
�dS)NcSs||d|dS)Nrrrr
rrr�fr(z TestMisc.test_polyfit.<locals>.fcSs|d|ddS)Nrrrrr
rrr�f2r(z!TestMisc.test_polyfit.<locals>.f2rrrr)�w)rrr�rar)rrrrar)rrrrar)ry�?ry��)rrr)rr~r�polyfitr�r=ror�lenrrmrXr��
zeros_like�copy)r&r�r�rru�coef3�coef4�coef2dr��yw�wcoef3�wcoef2d�coef1�coef2rrr�test_polyfitsj


"zTestMisc.test_polyfitcCsbgd�}tttj|d�tt�|�|dd��tt�|d�|dd��tt�|d�dg�dS)N)rrrrrrrrr)rr~rrr)r&r�rrr�
test_polytrimIs
zTestMisc.test_polytrimcCstt�dd�ddg�dS)Nrar�rr�polyliner%rrr�
test_polylineTszTestMisc.test_polylinecCstt�dd�dg�dS)Nrarr�r%rrr�test_polyline_zeroWszTestMisc.test_polyline_zeroN)	r2r3r4r�r�r�r�r�r�rrrrr��s	Fr�)$�__doc__�	functoolsr�numpyr=�numpy.polynomial.polynomial�
polynomialr�
numpy.testingrrrrrrr	r�T0�T1�T2�T3�T4�T5�T6�T7�T8�T9r�r"r6r\r�r�r�r�r�rrrr�<module>s4$F0c(4

https://t.me/RX1948 - 2025