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_classes.cpython-310.pyc
o

6��a�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�E/usr/lib/python3/dist-packages/numpy/polynomial/tests/test_classes.py�	<genexpr>s�r)�params�idscCs|jSr)�param)�requestrrr�Polysr�cCshz tt�|j|jk��tt�|j|jk��t|j|j�WdSty3d|�d|��}t|��w)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�randomrr�convertr	�
�Poly1�Poly2�xr�d1�w1r!�d2�w2r"rrr�test_conversion8�r9c
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	r1rrr�	test_castIr:r<cCsr|jtd�d}|jtd�d}t�|d|dd�}|j||d�}t|j|�t|j|�t||�|�dS)Nr)r+rr%�r,)rr/rrr.�identityrr	)r�d�wr4�prrr�
test_identity_srBcCsh|jtd�d}|jtd�d}|jd||d�}t|j|�t|j|�t|jdgddg�dS)Nr)r+�r,rr%)rr/r�basisrr�rr?r@rArrr�
test_basisisrFcCs�|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+)rCr,r���r%)rr/r�	fromrootsr�degree�lenr	rr;r)rr?r@�rr!�pdom�pwinr"rrr�test_fromrootsrsrNcCsdgd�}gd�}t�t��}|�||d�Wd�n1swY|djjddks0J�dS)N)�rO��?)rPg@g@r*rz!The fit may be poorly conditioned)�pytest�warnsr
�fit�message�args)rr4�y�recordrrr�test_bad_conditioned_fit�s�rXcCs�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)r4rrr�f��ztest_fit.<locals>.frr(r)r+r,)rr%r*r(r%r*)r@)rr.rSr	rrrIr/r�
zeros_like�shape)rrZr4rVrAr?r@�zr!r"�p3rrr�test_fit�s>
"r`cCs�|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�rr!r"r_�p4rrr�
test_equal�srfcCs�|gd�ddgddgd�}|gd�ddgddgd�}|gd�ddgddgd�}|gd�ddgddgd�}t||k�t||k�t||k�t||k�dSrarcrdrrr�test_not_equal�srgcCs*ttd�d�}ttd�d�}||�}||�}||}t|||�t|||�t|||�t|t|�|�tt|�||�t|t�|�|�tt�|�||�tttj	||dg|j
dd��tttj	||dg|jdd��|tur�tttj	|t
dg��dStttj	|tdg��dS�N����?r'rr%�r�r)�listr/r$�tupler�arrayr
�	TypeError�op�addrrrr�r�c1�c2r!r"r_rrr�test_add�s"  rwcCs2ttd�d�}ttd�d�}||�}||�}||}t|||�t|||�t|||�t|t|�|�tt|�||�t|t�|�|�tt�|�||�tttj	||dg|j
dd��tttj	||dg|jdd��|tur�tttj	|t
dg��dStttj	|tdg��dSrh)rnr/r$rorrpr
rqrr�subrrrrrtrrr�test_sub�s"  rycCsZttd�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ur�tttj	|t
dg��dStttj	|tdg��dS)	Nrirkr'r*rr%rlrm)rnr/r$rorrpr
rqrr�mulrrrrrtrrr�test_mul�s&  r{c	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
ur�ttt	j
|tdg��dSttt	j
|t
dg��dS�
Nrirkr'r)r*rr%rlrm)rnr/rr$rorrpr
rqrr�floordivrrrr�	rrurv�c3r!r"r_re�c4rrr�
test_floordivs4
��r�cCs6|gd��}|d}tjD]"}t|t�rt|t�rq
|d�}tt�||�|�tt	tj||�q
t
tfD]}|d�}tt�||�|�tt	tj||�q4tfD]}|dd�}tt�||�|�tt	tj||�qOt
�t�t�t�t�dg�fD]}tt	tj||�tt	tj||�qwtD]}tt	tj||d��q�dS)NrbrCrr%)r�
ScalarType�
issubclassr�boolr$rr�truedivr
rq�int�float�complexrorn�dictrp�classes)rr!r"�stype�s�ptyperrr�test_truediv1s,


"�r�c	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
ur�ttt	j
|tdg��dSttt	j
|t
dg��dSr|)rnr/rr$rorrpr
rqrr�modrrrrr~rrr�test_modLs,
  r�cCs0ttd�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�rtt	t|t
dg��dStt	t|tdg��dSr|)rnr/r�divmodr$rorrpr
rqrrrr)rrurvrr!r"r_rer��quo�remrrr�test_divmodgsP















r�cCsp|jdd}|j}t�|d|dd�}t�|j|||d����}t||�t�|�|����}t||�dS)Ng�?r+rr%rCr,)rrrr.�sortrH�rootsr	)rr?r@�tgt�resrrr�
test_roots�s
r�cCs|�d�}t|��d�dS�NrC)rDrrI�rrArrr�test_degree�s
r�cCs^|�d�}|��}t||k�t||u�t|j|ju�t|j|ju�t|j|ju�dSr�)rD�copyrrrr)rr!r"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(rj)rrr%r%r%r%��k)r%r*r(rj)r%r%r%r%r%)�lbnd)���r*r(rj)r�r�r%r%r%rl)rr;�integr$r)r�P�p0r!r"r?rrr�
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+rbr,r*r%r�)rr/rr�r	�derivr)rr?r@r!r"r_rrr�
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+rbr,rr%�r*rl)rr/rrr.r	)rr?r@rA�xtgt�ytgt�xres�yresrrr�
test_linspace�s


r�cCs�|jtd�d}|jtd�d}|dg||d�}|gd�||d�}td�D]
}t|||�||}q'|dg�}|gd��}td�D]
}t|||�||}qDtttj|d�tttj|d�dS)	Nr)r+r%r,rbrCg�?rG)	rr/r�ranger$r
�
ValueErrorrr�pow)rr?r@r��tst�irrr�test_pow�s


r�cCs\t}|j}t�|d|dd�}|�|gd���}d|dd|}||�}t||�dS)Nrr%r=rbr*r()rrrr.r;r	)rr�r?r4rAr�r�rrr�	test_callsr�cCs||gd��}tt|jd�tt|jd�tt|�d��d�tt|�d��d�tt|�d��d�tt|�d��d�dS)NrbrkrGr(r*r%r)r
r��cutdegrrJr�rrr�test_cutdeg�r�cCs||gd��}tt|jd�tt|jd�tt|�d��d�tt|�d��d�tt|�d��d�tt|�d��d�dS)Nrbrkrrjr(r*r%)r
r��truncaterrJr�rrr�
test_truncater�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%)r�trimr)r�crArrr�	test_trim"s
r�cCs`|j}|j}|dg||d�}tddg|���d|d}|dg||d�}tddg|���dS)Nr%r,rr*)rrr	�mapparmsrErrr�
test_mapparms*sr�cCs:|gd��}t�d�}tttj||�tttj||�dS)Nrbr()r�onesr
rqrs)rrAr4rrr�test_ufunc_override6s
r�c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�TestInterpolatecCs||d|dSrYr)�selfr4rrrrZDr[zTestInterpolate.fcCs(tttj|jd�tttj|jd�dS)NrGg$@)r
r�r�interpolaterZrq)r�rrr�test_raisesGszTestInterpolate.test_raisescCs.tdd�D]}tt�|j|���|k�qdS)Nr%rC)r�rrr�rZrI)r��degrrr�test_dimensionsKs�zTestInterpolate.test_dimensionscCsndd�}t�ddd�}tdd�D]$}td|d�D]}tj||ddg|fd�}t||�|||�dd	�qqdS)
NcSs||Srr)r4rArrr�powxQsz0TestInterpolate.test_approximation.<locals>.powxrr*r&r%)rrUr�)�decimal)rr.r�rr�r	)r�r�r4r��trArrr�test_approximationOs��z"TestInterpolate.test_approximationN)r�
__module__�__qualname__rZr�r�r�rrrrr�Bs
r�)r)=�__doc__�operatorrr�numbersrrQ�numpyr�numpy.polynomialrrrrrr�
numpy.testingr	r
rr�numpy.polynomial.polyutilsr
r�ro�classids�fixturerr/r$r2r3r9r<rBrFrNrXr`rfrgrwryr{r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr�<module>s` �


	,-




https://t.me/RX1948 - 2025