%PDF- %PDF-
Mini Shell

Mini Shell

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

a

z[yc�G�@s�dZddlZddlmZddlZddlZddlm	Z	m
Z
mZmZm
Z
mZddlmZmZmZmZddlmZe	e
eee
efZedd�eD��Zejeed	�d
d��ZejjZdKd
d�ZeZeZdd�Zdd�Z dd�Z!dd�Z"dd�Z#dd�Z$dd�Z%dd�Z&dd �Z'd!d"�Z(d#d$�Z)d%d&�Z*d'd(�Z+d)d*�Z,d+d,�Z-d-d.�Z.d/d0�Z/d1d2�Z0d3d4�Z1d5d6�Z2d7d8�Z3d9d:�Z4d;d<�Z5d=d>�Z6d?d@�Z7dAdB�Z8dCdD�Z9dEdF�Z:dGdH�Z;GdIdJ�dJ�Z<dS)Lz�Test inter-conversion of different polynomial classes.

This tests the convert and cast methods of all the polynomial classes.

�N)�Number)�
Polynomial�Legendre�	Chebyshev�Laguerre�Hermite�HermiteE)�assert_almost_equal�
assert_raises�assert_equal�assert_)�RankWarningccs|]}|jVqdS�N)�__name__)�.0�cls�r�I/usr/lib64/python3.9/site-packages/numpy/polynomial/tests/test_classes.py�	<genexpr>�r)�paramsZidscCs|jSr)Zparam)Zrequestrrr�Polysr�cCsnz>tt�|j|jk��tt�|j|jk��t|j|j�Wn*tyhd|�d|��}t|��Yn0dS)NzResult: z	
Target: )r�np�all�domain�windowr	�coef�AssertionError)�p1�p2�msgrrr�assert_poly_almost_equal&sr"c
Cs�t�ddd�}td�}|jtd�d}|jtd�d}||||d�}|jtd�d}|jtd�d}|j|||d�}	t|	j|�t|	j|�t|	|�||��dS)	Nr��
������?�rr)�kindrr)r�linspace�randomrrZconvertr	�
�Poly1�Poly2�xrZd1Zw1rZd2Zw2r rrr�test_conversion8sr2c
Cs�t�ddd�}td�}|jtd�d}|jtd�d}||||d�}|jtd�d}|jtd�d}|j|||d�}	t|	j|�t|	j|�t|	|�||��dS)Nrr#r$r%r'r)r*)rr,r-rr�castr	r.rrr�	test_castIsr4cCsr|jtd�d}|jtd�d}t�|d|dd�}|j||d�}t|j|�t|j|�t||�|�dS)Nr'r)rr#�r*)rr-rrr,�identityrr	)r�d�wr1�prrr�
test_identity_sr:cCsh|jtd�d}|jtd�d}|jd||d�}t|j|�t|j|�t|jdgddg�dS)Nr'r)�r*rr#)rr-r�basisrr�rr7r8r9rrr�
test_basisisr>cCs�|jtd�d}|jtd�d}td�}|j|||d�}t|��t|��t|j|�t|j|�t||�d�tj}tj}tj	|||d�}t|j
dd�dS)Nr'r))r;r*r���r#)rr-r�	fromrootsr�degree�lenr	rr3r)rr7r8�rrZpdomZpwinr rrr�test_fromrootsrsrDcCsdgd�}gd�}t�t��}|�||d�Wd�n1s>0Y|djjddks`J�dS)N)�rE��?)rFg@g@r(rz!The fit may be poorly conditioned)�pytestZwarnsr
�fit�message�args)rr1�y�recordrrr�test_bad_conditioned_fit�s
,rMcCs�dd�}t�dd�}||�}|�||d�}t|jddg�t||�|�t|��d�|jtd�d}|jtd�d}|j||d||d�}t||�|�t|j|�t|j|�|j||gd�||d�}t||�|�t|j|�t|j|�|�||dg�}t|j|j�t|j|j�|�||gd�g�}t|j|j�t|j|j�t�	|�}|t|j
�d}d	|ddd
�<|�|ddd
�|ddd
�d�}|j||d|d�}	|j||gd�|d�}
t||�|	|��t|	|�|
|��dS)NcSs||d|dS�Nr#r(r)r1rrr�f�sztest_fit.<locals>.frr&r'r)r*)rr#r(r&r#r()r8)rr,rHr	rrrAr-rZ
zeros_like�shape)rrOr1rKr9r7r8�zrr �p3rrr�test_fit�s>
"rScCs�|gd�ddgddgd�}|gd�ddgddgd�}|gd�ddgddgd�}|gd�ddgddgd�}t||k�t||k�t||k�t||k�dS�N�r#r(r&rr#r(r&r*)r#r#r#�r�rrr rR�p4rrr�
test_equal�srYcCs�|gd�ddgddgd�}|gd�ddgddgd�}|gd�ddgddgd�}|gd�ddgddgd�}t||k�t||k�t||k�t||k�dSrTrVrWrrr�test_not_equal�srZcCs*ttd�d�}ttd�d�}||�}||�}||}t|||�t|||�t|||�t|t|�|�tt|�||�t|t�|�|�tt�|�||�tttj	||dg|j
dd��tttj	||dg|jdd��|tu�rtttj	|t
dg��ntttj	|tdg��dS�N����?r%rr#�r�r)�listr-r"�tupler�arrayr
�	TypeError�op�addrrrr�r�c1�c2rr rRrrr�test_add�s"  
rjcCs2ttd�d�}ttd�d�}||�}||�}||}t|||�t|||�t|||�t|t|�|�tt|�||�t|t�|�|�tt�|�||�tttj	||dg|j
dd��tttj	||dg|jdd��|tu�rtttj	|t
dg��ntttj	|tdg��dSr[)rar-r"rbrrcr
rdre�subrrrrrgrrr�test_sub�s"  
rlcCsZttd�d�}ttd�d�}||�}||�}||}t|||�t|||�t|||�t|t|�|�tt|�||�t|t�|�|�tt�|�||�t|d||dg��td|||dg��tttj	||dg|j
dd��tttj	||dg|jdd��|tu�r@tttj	|t
dg��ntttj	|tdg��dS)	Nr\r^r%r(rr#r_r`)rar-r"rbrrcr
rdre�mulrrrrrgrrr�test_mul�s&  
rnc	Csvttd�d�}ttd�d�}ttd�d�}||�}||�}||�}|||}t|j�}t|||�t|||�t|||�t|t|�|�tt|�||�t|t�|�|�tt�|�||�td||dg��t|dd|�ttt	j
||dg|jdd��ttt	j
||dg|jdd	��|t
u�r\ttt	j
|tdg��nttt	j
|t
dg��dS�
Nr\r^r%r'r(rr#r_r`)rar-rr"rbrrcr
rdre�floordivrrrr�	rrhri�c3rr rRrX�c4rrr�
test_floordivs4
��
rtcCs8|gd��}|d}tjD]D}t|t�rt|t�r4q|d�}tt�||�|�tt	tj||�qt
tfD].}|d�}tt�||�|�tt	tj||�qhtfD]0}|dd�}tt�||�|�tt	tj||�q�t
�t�t�t�t�dg�fD]$}tt	tj||�tt	tj||�q�tD]}tt	tj||d���qdS)NrUr;rr#)rZ
ScalarType�
issubclassr�boolr"re�truedivr
rd�int�float�complexrbra�dictrc�classes)rrr �stype�sZptyperrr�test_truediv1s*


"rc	Csxttd�d�}ttd�d�}ttd�d�}||�}||�}||�}|||}t|j�}t|||�t|||�t|||�t|t|�|�tt|�||�t|t�|�|�tt�|�||�td||dg��t|d|dg��ttt	j
||dg|jdd��ttt	j
||dg|jdd	��|t
u�r^ttt	j
|tdg��nttt	j
|t
dg��dSro)rar-rr"rbrrcr
rdre�modrrrrrqrrr�test_modLs,
  
r�cCs.ttd�d�}ttd�d�}ttd�d�}||�}||�}||�}|||}t|j�}t||�\}	}
t|	|�t|
|�t||�\}	}
t|	|�t|
|�t||�\}	}
t|	|�t|
|�t|t|��\}	}
t|	|�t|
|�tt|�|�\}	}
t|	|�t|
|�t|t�|��\}	}
t|	|�t|
|�tt�|�|�\}	}
t|	|�t|
|�t|d�\}	}
t|	d|�t|
|dg��td|�\}	}
t|	|dg��t|
|dg��tt	t||dg|j
dd��tt	t||dg|jdd	��|tu�rtt	t|t
dg��ntt	t|tdg��dSro)rar-r�divmodr"rbrrcr
rdrrrr)rrhrirrrr rRrXrsZquoZremrrr�test_divmodgsP















r�cCsp|jdd}|j}t�|d|dd�}t�|j|||d����}t||�t�|�|����}t||�dS)Ng�?r)rr#r;r*)rrrr,�sortr@�rootsr	)rr7r8�tgt�resrrr�
test_roots�s
r�cCs|�d�}t|��d�dS�Nr;)r<rrA�rr9rrr�test_degree�s
r�cCs^|�d�}|��}t||k�t||u�t|j|ju�t|j|ju�t|j|ju�dSr�)r<�copyrrrr)rrr rrr�	test_copy�s
r�cCszt}|�|gd���}|�|���}|�|�d��}t||gd���t||gd���|�|gd���}|�|jdd��}|�|jdddgd��}t||gd���t||gd���|�|gd���}|�|jdd	��}|�|jddd	��}t||gd
���t||gd���d|j}|j|gd��|d�}|�|���}|�|�d��}t||gd���t||gd���dS)
N)r(��r()rr(r&r])rrr#r#r#r#��k)r#r(r&r])r#r#r#r#r#)Zlbnd)���r(r&r])r�r�r#r#r#r_)rr3�integr"r)r�PZp0rr r7rrr�
test_integ�s,
r�cCs�|jtd�d}|jtd�d}|gd�||d�}|jdddgd�}|jddgd�}t|�d�j|j�t|�d�j|j�|gd��}|jdddgd�}|jddgd�}t|�d�j|j�t|�d�j|j�dS)Nr'r)rUr*r(r#r�)rr-rr�r	Zderivr)rr7r8rr rRrrr�
test_deriv�sr�cCs�|jtd�d}|jtd�d}|gd�||d�}t�|d|dd�}||�}|�d�\}}t||�t||�t�ddd�}||�}|jdddgd	�\}}t||�t||�dS)
Nr'r)rUr*rr#�r(r_)rr-rrr,r	)rr7r8r9ZxtgtZytgtZxresZyresrrr�
test_linspace�s


r�cCs�|jtd�d}|jtd�d}|dg||d�}|gd�||d�}td�D]}t|||�||}qN|dg�}|gd��}td�D]}t|||�||}q�tttj|d�tttj|d�dS)	Nr'r)r#r*rUr;g�?r?)	rr-r�ranger"r
�
ValueErrorre�pow)rr7r8r�Ztst�irrr�test_pow�s


r�cCs\t}|j}t�|d|dd�}|�|gd���}d|dd|}||�}t||�dS)Nrr#r5rUr(r&)rrrr,r3r	)rr�r7r1r9r�r�rrr�	test_callsr�cCs||gd��}tt|jd�tt|jd�tt|�d��d�tt|�d��d�tt|�d��d�tt|�d��d�dS)NrUr^r?r&r(r#r)r
r�ZcutdegrrBr�rrr�test_cutdegsr�cCs||gd��}tt|jd�tt|jd�tt|�d��d�tt|�d��d�tt|�d��d�tt|�d��d�dS)NrUr^rr]r&r(r#)r
r��truncaterrBr�rrr�
test_truncatesr�cCs`gd�}||�}t|��j|dd��t|�d�j|dd��t|�d�j|dd��dS)N)r#g���ư>g�-���q=rr&g�����|�=r(g�h㈵��>r#)rZtrimr)r�cr9rrr�	test_trim"s
r�cCs`|j}|j}|dg||d�}tddg|���d|d}|dg||d�}tddg|���dS)Nr#r*rr()rrr	Zmapparmsr=rrr�
test_mapparms*sr�cCs:|gd��}t�d�}tttj||�tttj||�dS)NrUr&)rZonesr
rdrf)rr9r1rrr�test_ufunc_override6s
r�c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�TestInterpolatecCs||d|dSrNr)�selfr1rrrrODszTestInterpolate.fcCs(tttj|jd�tttj|jd�dS)Nr?g$@)r
r�r�interpolaterOrd)r�rrr�test_raisesGszTestInterpolate.test_raisescCs.tdd�D]}tt�|j|���|k�q
dS)Nr#r;)r�rrr�rOrA)r��degrrr�test_dimensionsKszTestInterpolate.test_dimensionscCsndd�}t�ddd�}tdd�D]H}td|d�D]4}tj||ddg|fd�}t||�|||�dd	�q2q dS)
NcSs||Srr)r1r9rrr�powxQsz0TestInterpolate.test_approximation.<locals>.powxrr(r$r#)rrJr5)�decimal)rr,r�rr�r	)r�r�r1r��tr9rrr�test_approximationOsz"TestInterpolate.test_approximationN)r�
__module__�__qualname__rOr�r�r�rrrrr�Bsr�)r)=�__doc__�operatorreZnumbersrrGZnumpyrZnumpy.polynomialrrrrrrZ
numpy.testingr	r
rrZnumpy.polynomial.polyutilsr
r|rbZclassidsZfixturerr-r"r/r0r2r4r:r>rDrMrSrYrZrjrlrnrtrr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr�<module>s^ �


	,-




Zerion Mini Shell 1.0