%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_twodim_base.cpython-39.pyc

a

z[ycJ�@sTdZddlmZmZmZmZmZmZddlm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZmZmZmZmZmZmZddlZddlmZddlZdd�ZGdd	�d	�ZGd
d�d�Z Gdd
�d
�Z!Gdd�d�Z"Gdd�d�Z#Gdd�d�Z$dd�Z%dd�Z&dd�Z'dd�Z(dd�Z)dd�Z*Gd d!�d!�Z+Gd"d#�d#�Z,Gd$d%�d%�Z-Gd&d'�d'�Z.dS)(z"Test functions for matrix module

�)�assert_equal�assert_array_equal�assert_array_max_ulp�assert_array_almost_equal�
assert_raises�assert_)�arange�add�fliplr�flipud�zeros�ones�eye�array�diag�histogram2d�tri�mask_indices�triu_indices�triu_indices_from�tril_indices�tril_indices_from�vanderN)�requires_array_functioncCst|�}t�||�}|S�N)rr	Zouter)�n�data�r�F/usr/lib64/python3.9/site-packages/numpy/lib/tests/test_twodim_base.py�get_matsrc@sTeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�TestEyecCsxttd�tgd�gd�gd�gd�g��ttddd�tgd�gd�gd�gd�gd��ttd�d	ktdtd��dS)
N���rrr�rr#rr�rrr#r�rrrr#�f��dtype�r#)rrr�bool��selfrrr�
test_basics&�����
�zTestEye.test_basiccCsbttt�d�td�tddgddgg��ttt�d�t�d�t�d�d�tgd�gd�g��dS)	N�r(r#rr!)�M�kr$r%)rr�npZuint64�intrr,rrr�test_uint64/s( �zTestEye.test_uint64cCs`ttddd�tgd�gd�gd�gd�g��ttddd�tgd�gd	�gd�gd�g��dS)
Nr!r#�r1r$r%r&�rrrr���r"�rrrr,rrr�	test_diag5s����zTestEye.test_diagcCsVttdd�tgd�gd�gd�gd�g��ttdd�tgd�gd�gd	�g��dS)
Nr!r*�r#rr�rr#r)rrr#�rrrr"r$r%r8r,rrr�test_2dBs
��
��zTestEye.test_2dcCs^ttdddd�tgd�gd�gd�g��ttdddd�tgd	�gd	�gd
�gd�g��dS)Nr*r!r/r5r%r&r6���r<r:r;r8r,rrr�test_diag2dNs����zTestEye.test_diag2dcCs0ttddd�ddgddgg�ttddd�ddgddgg�ttddd�ddgddgg�ttddd�ddgddgg�ttddd�ddgddgddgg�ttddd�ddgddgddgg�ttddd�ddgddgddgg�ttddd�ddgddgddgg�ttddd�ddgddgddgg�dS)Nr/r#rr7r>r*����rrr,rrr�test_eye_boundsZs$$$$zTestEye.test_eye_boundscCs$ttdddd�ddgddgg�dS)Nr/ZS3r(�1�rAr,rrr�test_stringses�zTestEye.test_stringscCs$ttddtd�ddgddgg�dS)Nr/r(TF)rrr+r,rrr�	test_booliszTestEye.test_boolcCs\tdddd�}tddddd�}t||�|jjs4J�|jjr@J�|jjrLJ�|jjsXJ�dS)Nr!r*r7r5�F)r1�order)rr�flags�c_contiguous�f_contiguous)r-Zmat_cZmat_frrr�
test_orderls
zTestEye.test_orderN)�__name__�
__module__�__qualname__r.r4r9r=r?rBrErFrLrrrrr s
r c@s6eZdZdd�Zddd�Zdd�Zdd	�Zd
d�ZdS)
�TestDiagcCs�dtd��d�}td�}td�D]}|||||f<q"tt|�|�td�}|��}td�D],}|||||df<||||d|f<q^tt|dd�|�tt|dd�|�dS)	N�d��l)rRrR)�rTr/r5r>)r�astyper�rangerr�copy)r-�vals�br1�crrr�test_vectorwszTestDiag.test_vectorNcCs�|durdtd�d�d�}td�}td�D]}|||f||<q.tt|�|�|d}td�D]}|||df||<qbtt|d�|dd��td�D]}||d|f||<q�tt|d	�|dd��dS)
NrQrRr#rS)rRrr*r/r>)rrUrrVrr)r-rXrYr1rrr�test_matrix�szTestDiag.test_matrixcCs(tdtd�dddd�}|�|�dS)NrQrRr#rGrS)rHr))rrr\)r-rXrrr�test_fortran_order�szTestDiag.test_fortran_ordercCs�ddgddgddgg}tt|dd�g�tt|dd�dg�tt|dd�ddg�tt|d	d�ddg�tt|d
d�dg�tt|dd�g�dS)Nr#r/r*r!rR�r5rr7r>r@)rr)r-�Arrr�test_diag_bounds�szTestDiag.test_diag_boundscCstttdggg�dS)Nr#)r�
ValueErrorrr,rrr�test_failure�szTestDiag.test_failure)N)rMrNrOr[r\r]r`rbrrrrrPvs

	rPc@seZdZdd�ZdS)�
TestFliplrcCsnttttd��td�}|dd�ddd�f}tt|�|�gd�gd�g}gd�gd�g}tt|�|�dS)Nr!r7�rr#r/�r*r!rR)r/r#r)rRr!r*)rrar
r
rr�r-�arYrrrr.�s��zTestFliplr.test_basicN�rMrNrOr.rrrrrc�srcc@seZdZdd�ZdS)�
TestFlipudcCs^td�}|ddd�dd�f}tt|�|�gd�gd�g}gd�gd�g}tt|�|�dS)Nr!r7rdre)rrrrfrrrr.�s��zTestFlipud.test_basicNrhrrrrri�sric@sbeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Ze	d
d��Z
ej�
dddg�dd��ZdS)�TestHistogram2dcCs
tgd��}tgd��}t�ddd�}t�ddd�}t||||f�d}tgd�gd�gd�gd	�gd
�gd�gd�gd�gd�g	�}t|j|�t|||�d}t|j|�tttd��ttd���\}}}t|tdd��t|t�ddd��t|t�ddd��dS)
N)g̙�
}��?g%�����?g�$F��?g�;c�jY�?gI�+����?)g�p5x���?g�?�_��?g�p����?g��b�d�?g�g<��=�?rr#�
)	rrrr#rrrrr)	rrrrrrr#rr)	rrrrrrrrr)	r#rr#rrrrrr)	rr#rrrrrrr�	�)	rr2�linspacerr�T�listrVr)r-�x�yZxedgesZyedges�H�answerrrr�test_simple�s8����
 zTestHistogram2d.test_simplecCs�tgd��}tgd��}t||dddgddggdd�\}}}tgd	�gd
�gd�gd�gd
�gd�g�}t||dd�t|t�ddd��t|t�ddd��dS)N)r#r#r/r*r!r!r!rR)r#r*r/rr#r/r*r!)r^rRrr^rRT)rV�density)�rrrr)rr#rr#r)rrr#rr)r#rrrr)rr#r#r#r�rrrrr#g @r*rT)rrrrr2rn�r-rqrrrs�xed�yedrtrrr�	test_asym�s"���zTestHistogram2d.test_asymcCshtgd��}tgd��}t||gd�gd�gdd�\}}}tgd�gd�gd�g�d}t||d	�dS)
N)	r#r/r*r#r/r*r#r/r*)	r#r#r#r/r/r/r*r*r*)r#r/r*rRT)rv)r#r#��?)r}r}��?g"@r*)rrrryrrr�test_density�s���zTestHistogram2d.test_densitycCsDtj�d�dd}t||dddgddgfd�\}}}t|d�dS)NrQ��?g��.A)r!rRrr#)rV)r2ZrandomZrandrr)r-�rrsrzr{rrr�test_all_outliers�s"z!TestHistogram2d.test_all_outlierscCsZtggddgddgfd�\}}}t|tdgg��tggdd�\}}}t|t�d��dS)Nrr#�Zbinsrwr!)r!r!)rrrr2r)r-rgZedge1Zedge2rrr�
test_empty�s zTestHistogram2d.test_emptycCs�tgd��}tgd��}d}t|||df�\}}}tgd�gd�gd�gd�gd�gd�gd�gd�gd�gd	�g
�}t||�t|tgd
���t||d|f�\}}}tgd�gd�gd
�gd�g�}t||�t|tgd
���dS)N)rg<D��瑷?g����?g!,��3{�?g�l�yT�?g�f��.�?r#)rg(@TT\�?g���IZ�?gY�N���?gK?~›�?g&W-��U�?r#)rg�������?g�������?g333333�?g�������?r}g333333�?gffffff�?g�������?g�������?r#r!)g@rwrwrw)rwr�rwrw)rwrwrwrw)r�rwrwrw)rwrwrwr�)rwr~r}g�?r#)
r�r�rwr�rwrwrwrwrwrw)
rwrwrwrwr�rwrwrwrwrw)
rwr�rwrwr�rwrwrwrwrw)
rwrwrwrwrwrwrwrwrwr�)rrr)r-rqrrZedgesrsZxeZyertrrr�test_binparameter_combination�sB����
��
z-TestHistogram2d.test_binparameter_combinationcCs�Gdd�d�}ddg}|�}t||�}t||f||fifk�t||�}t||f||fifk�t|||d�}t||f||ft|d�f�t|||dgd�}t||f||ft|dgd�f�ttt|||gd�t|||d�}t||f||ft|d�f�dS)Nc@seZdZdd�ZdS)z5TestHistogram2d.test_dispatch.<locals>.ShouldDispatchcSs
|||fSrr)r-�function�types�args�kwargsrrr�__array_function__!szHTestHistogram2d.test_dispatch.<locals>.ShouldDispatch.__array_function__N)rMrNrOr�rrrr�ShouldDispatch sr�r#r/r�rR)Zweights)rr�dictr�	Exception)r-r�ZxyZs_dr�rrr�
test_dispatchs

 zTestHistogram2d.test_dispatch)�x_len�y_len)rkrm)��cCsRt�|�t�|�}}tjtdd��t||�Wd�n1sD0YdS)Nz"x and y must have the same length.)�match)r2r
�pytestZraisesrar)r-r�r�rqrrrrr�test_bad_length3s
�zTestHistogram2d.test_bad_lengthN)rMrNrOrur|rr�r�r�rr�r�ZmarkZparametrizer�rrrrrj�s

rjc@seZdZdd�ZdS)�TestTricCsDtgd�gd�gd�g�}ttd�|�ttdtd�|�t��dS)Nr:�r#r#r�r#r#r#r*r()rrrr+rU)r-�outrrr�
test_dtype<s�zTestTri.test_dtypeN)rMrNrOr�rrrrr�;sr�cCs~tjdtjdD]d}tjd|d�}t�|�}t�|�}t|ddgddgg�t||j�t|j|j�t|j|j�qdS)N�AllFloat�
AllInteger)r/r/r(r#r)	r2�	typecodesr
�tril�triurrorr))r)rgrYrZrrr�test_tril_triu_ndim2Ds

r�cCs
tjdtjdD]�}tjddgddggddgddggddgddggg|d�}tjddgddggddgddggddgddggg|d�}tjddgddggddgddggddgddggg|d�}t�|�}t�|�}t||�t||�t|j|j�t|j|j�qdS)Nr�r�r#rr()r2r�rr�r�rrr))r)rgZa_tril_desiredZa_triu_desiredZa_triu_observedZa_tril_observedrrr�test_tril_triu_ndim3Ps8������



r�cCsnt�ddtjggd�tjddgg�}t�gd�gd�tjddgg�}|j}tt�|�|�tt�|�|�dS)Nr#r�r:r�)r2r�infrorr�r�)�arrZout_trilZout_triurrr�test_tril_triu_with_infis
�

�r�cCs�tjdD]D}|dkrq
tjd|d�}tt�|�j|j�tt�|�j|j�q
tjddgddggd	d�}tt�|�j|j�tt�|�j|j�tjdd
d�}tt�|�j|j�tt�|�j|j�dS)NZAll�V)r*r*r(z2001-01-01T12:00z2002-02-03T13:56z2004-01-01T12:00z2003-01-03T13:45Z
datetime64zf4,f4)r2r�rrr�r)r�r)rZr�rrr�test_tril_triu_dtypevs 
��r�cCs\tdtj�}t�d��dd�}t||tgd���tdtjd�}t||tgd���dS)Nr*rl)rr#r/r!rR�r#)r#r/rR)rr2r�r�reshaperr)�iurg�iu1rrr�test_mask_indices�s
r�cCsLtd�}tddd�}tddd�}tdddd�}t�gd�gd�gd	�gd
�g�}t�dd��dd�}t||tgd
���t||tgd���d||<t|tgd�gd�gd�gd�g��d||<t|tgd�gd�gd�gd�g��d||<t|tgd�gd�gd�gd�g��d||<t|tgd�gd�gd�gd�g��dS)Nr!r/r5rR��m�r1r��r#r/r*r!�rRr^rTr��rlrkrm���
���r#�)
r#rRr^rlrkrmr�r�r�r�)
r#r^rTrmr�r�r���r�r7)r7r/r*r!)r7r7rTr�)r7r7r7r��r7r7r7r7)r7r/r*r!rR)r7r7r�rlrk)r7r7r7r�r�)r7r7r7r7r����)r�r�r�r!)r�r�r�r�)r�r�r�r!rR)r�r�r�r�rk)r�r�r�r�r�)rr2rrr�r)Zil1Zil2Zil3Zil4rgrYrrr�test_tril_indices�s`
�
�
���������r�c@seZdZdd�ZdS)�TestTriuIndicescCsLtd�}tddd�}tddd�}tdddd�}t�gd�gd�gd	�gd
�g�}t�dd��dd�}t||tgd
���t||tgd���d||<t|tgd�gd�gd�gd�g��d||<t|tgd�gd�gd�gd�g��d||<t|tgd�gd�gd�gd�g��d||<t|tgd�gd�gd�gd�g��dS)Nr!r/r5rRr�r�r�r�r�r�r#r�)
r#r/r*r!r^rTr�rmr�r�)r#r/r*r!rRrTr�rlrkr�r�r�r�r�r7r�)rRr7r7r7)rlrkr7r7)r�r�r�r7)r7r7r7r7r7)r^r7r7r7r7)rmr�r7r7r7)r�r�r�r7r7r�)r7r7r�r�)rRr7r7r�)r7r7r�r�r�)r^r7r7r�r�)rmr�r7r7r�)rr2rrr�r)r-r�Ziu2Ziu3Ziu4rgrYrrr�test_triu_indices�s`
�
�
���������z!TestTriuIndices.test_triu_indicesN)rMrNrOr�rrrrr��sr�c@seZdZdd�ZdS)�TestTrilIndicesFromcCs(tttt�d��tttt�d��dS�N)r/)r/r/r/)rrarr2r
r,rrr�test_exceptions�sz#TestTrilIndicesFrom.test_exceptionsN�rMrNrOr�rrrrr��sr�c@seZdZdd�ZdS)�TestTriuIndicesFromcCs(tttt�d��tttt�d��dSr�)rrarr2r
r,rrrr��sz#TestTriuIndicesFrom.test_exceptionsNr�rrrrr��sr�c@seZdZdd�Zdd�ZdS)�
TestVandercCs�t�gd��}t|�}t�gd�gd�gd�gd�g�}t||dd�dd�f�|jd}td�D].}t||d�}t||dd�|||�f�qddS)	N)rr#r>r*rx)r#r#r#r#r#)r�i����r!r>r#)�Q�rlr*r#r#r^��N)r2rrr�shaperV)r-rZ�vZpowersr�rrrrr.s
�
zTestVander.test_basiccCs|tgd�tjd�}t|�}t�gd�gd�gd�g�}t||�tddg�}t|dd	�}t�gd
�gd�g�}t||�dS)N)rm��r�r()�yrmr#)�r�r#)�r�r#��?�?��?�r*r�)y@r�r#)y��r�r#)rr2Zint8rr)r-rZr�Zexpectedrrr�test_dtypess
�

�zTestVander.test_dtypesN)rMrNrOr.r�rrrrr�sr�)/�__doc__Z
numpy.testingrrrrrrZnumpyrr	r
rrr
rrrrrrrrrrrr2Znumpy.core.tests.test_overridesrr�rr rPrcrirjr�r�r�r�r�r�r�r�r�r�r�rrrr�<module>s, LX/
}	

/2

Zerion Mini Shell 1.0