%PDF- %PDF-
Mini Shell

Mini Shell

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

a

z[yc*=�@s�ddlZddlmZddlZddlmZddlmmZddl	m
Z
ejZGdd�d�Ze
dkr�dZd	eZd
\ZZedd�D]nZd
eZe�ee��eed�Ze�e�Zeded�eede��ededd�dedd���q�dS)�N)�reduce)�float_)�
build_err_msgc@s�eZdZdd�Zd dd�Zd!dd�Zejd	d
�dd��Zejd	d
�d
d��Z	ejd	d
�dd��Z
ejd	d
�dd��Zejd	d
�dd��Zejd	d
�dd��Z
ejd	d
�dd��Zejd	d
�dd��Zejd	d
�dd��Zejd	d
�dd��ZdS)"�ModuleTestercCs||_|j|_|j|_|j|_|j|_|j|_|j|_|j|_|j|_|j	|_	t
|_
|j|_|j|_|j
|_
|j|_|j|_|j|_|j|_|j|_|j|_|j|_|j|_|j|_|j|_|j|_|j|_|j|_z|j|_Wnty�|jj|_Yn0g|_dS�N)�module�allequal�arange�array�concatenate�count�equal�filled�getmaskZgetmaskarray�id�inner�	make_mask�masked�masked_array�
masked_values�mask_or�nomask�ones�outer�repeat�resize�sort�take�	transpose�zerosZMaskType�umath�AttributeError�coreZ	testnames)�selfr�r$�?/usr/lib64/python3.9/site-packages/numpy/ma/timer_comparison.py�__init__s@zModuleTester.__init__�Tc
CsD|�|�}|�|�}|�|�|�|�|��}	|�|j||	d�|�}|�|j||	d�|�}|jjdkr�|�t�}t|t	j
�r�|jdkr�d|t	�|�<nt	�|�r�d}|jjdkr�|�t�}t|t	j
�r�|jdkr�d|t	�|�<nt	�|�r�d}�z|j
dk�p|j
dk�p|j
|j
k}
|
�sRt||g|d|j
�d|j
�d�|d	d
�}|
�sRJ|��|||�}|	|ju�r||�r||j||	d�}t|t��r�|}
dg}
n|��}
|
��}
|
��}
|
�s�dd|
�d�t|
�}t||g|d
|f|d	d
�}|
�s�J|��WnDt�y>}z*t||g||d	d
�}t|�|�WYd}~n
d}~00dS)zZ
        Assert that a comparison of two masked arrays is satisfied elementwise.

        ��mask�O�rr$z	
(shapes z, z
 mismatch)��x�y)�header�names�dgY@z
(mismatch %s%%)N)rrrr�dtype�char�astyper�
isinstance�npZndarray�sizeZisnan�shaperr�boolZravel�all�tolistr�len�
ValueError)r#Z
comparisonr-r.�err_msgr/Z
fill_value�xfZyf�mZcond�msg�valZreduced�match�er$r$r%�assert_array_compare0sd





$��
��z!ModuleTester.assert_array_comparecCs|j|j|||dd�dS)zH
        Checks the elementwise equality of two masked arrays.

        zArrays are not equal)r>r/N)rEr
)r#r-r.r>r$r$r%�assert_array_equalgs�zModuleTester.assert_array_equal�ignore)r:cCsHt�ddddtddddddddg�}gd	�}|j||d
�}|ddS)
�!
        Tests creation

        ��?���@�@�@�$��$@�@�r+rrrrrr+rrrrrr(rN)r6r
�pir)r#r-r@�xmr$r$r%�test_0os&zModuleTester.test_0c	Cs t�ddddtddddddddg�}t�gd	��}gd
�}gd�}|j||d�}|j||d�}t�|d
|�}|�d
�||�d���s�J�|j}|j	t
dd�|�ks�J�|�|�t|�t
dd�|�ks�J�dD]F}||_||_||_||_||_|�|�t|�t
dd�|�ks�J�q�dS)rHrIrJrKrLrMrNrOrP)rM�rPrKg�g�rUrNrOrIrUrPrQ)rrr+rrr+r+rrrrr+r(g@��x�DrcSs||Srr$r,r$r$r%�<lambda>��z%ModuleTester.test_1.<locals>.<lambda>cSs||Srr$r,r$r$r%rV�rW))��)��cSs||Srr$r,r$r$r%rV�rWN)
r6r
rRr�whereZset_fill_valuer�anyr8r7rrr<)	r#r-r.�m1�m2rSZymr?�sr$r$r%�test_1zs&&
$zModuleTester.test_1c	Cs�t�gd��}|j|gd�d�}|j|gd�d�}|�|�}t|�t|�t|d�t|d�ushJ�|d|dks|J�d|d<d|d<|�||�d|dd	�<d|dd	�<|j|d<|j|dd	�<||d
d
�<|j|d<|�gd�gd��|d
d
�<|�gd�gd��|d
d
�<t�d
�d}|�	|d�}|�gd�t
�}t�gd�t
�}|d|d|dd�jdk�sxJ�gd�}|�|�}|�|�}||u�s�J�|j|dd�}||u�s�J�d
S)z2
        Tests conversions and indexing.

        )r+r[rXrY�r+rrrr()rr+rr+r+�	r[�crYN)r+r[rYrX)rr+r+r�rIrP)r+Zhellor[rY)r)rrr+rr)�copy)
r6r
�str�repr�typerFrrr	r�objectr8r)	r#Zx1Zx2Zx3�x4�nr@r_�m3r$r$r%�test_2�s@




zModuleTester.test_2cCs�|�d�}|j|d<|�|d�}|�|�||g�|�s:J�|�|�|�gd��sTJ�|j|ddd�}|�|gd��|j|ddd�}|�||�s�J�|jddd�}|�||�s�J�|�dd�}|�||�s�J�d	S)
z&
        Tests resize/repeat

        rXr[)�)rrr+rrrr+r)r[r[r[r[r��axis)rrr+r+r[r[rYrYN)r	rrrrrrrF)r#rkZy4Zy5Zy6Zy7Zy8r$r$r%�test_3�s

zModuleTester.test_3c	CsF|�d�}t�d�}|j|dd�<|�ddd�}|�ddd�}|�t�|d�|�|d��s^J�|�t�|dd�|�|dd��s�J�|�t�|�|d	�|�|d	��|�||��s�J�|�t�	|�|d	�|�|d	��|�	||��s�J�|�
gd
�t�}|j|d<|�|gd��}|d	dk�sJ�|ddk�s0J�|ddk�sBJ�d
S)zB
        Test of take, transpose, inner, outer products.

        �rerZr[rYrX)r[rr+r+r)�abcr+�defr[rY)rrYrXrtN)r	r6r�reshaperrrrrrr
rj)r#r-r.�tr$r$r%�test_4�s&

 $
�
�
zModuleTester.test_4cCs|�d�}|�d�}|�d�}|j|d<|d7}|�||d�sDJ�|d7}|�||d�s`J�|�d�}|�d�}|j|d<|d8}|�||d�s�J�|d8}|�||d�s�J�|�d�d}|�d�d}|j|d<|d9}|�||d�s�J�|d9}|�||d��sJ�|�d�d}|�d�d}|j|d<|d}|�||��sVJ�|d}|�||��spJ�|�d�d}|�d�d}|j|d<|d}|�||d��s�J�||�d�}|�||�d��|�d��t�}|�d�}|j|d<|d7}|�||d��sJ�dS)z*
        Tests inplace w/ scalar

        �
r[r+rIrK)ryN)r	rrrFrr4r)r#r-r.rSr$r$r%�test_5�sR











zModuleTester.test_5cCs6|jdtd�}|�d�}|jdtd�}|j|d<|j}|jdtd�}|j|d<||7}||7}|�|||�srJ�|�|||�s�J�|�|j|�||j��s�J�|jdtd�}|jdtd�}|j|d<|j}|jdtd�}|j|d<||8}||8}|�|||��sJ�|�|||��s"J�|�|j|�||j���s@J�|jdtd�}|jdtd�}|j|d<|j}|jdtd�}|j|d<||9}||9}|�|||��s�J�|�|||��s�J�|�|j|�||j���s�J�|jdtd�}|jdtd�}|j|d<|j}|jdtd�}|j|d<||}||}dS)z)
        Tests inplace w/ array

        ry)r2r[���N)r	rrr)rr)r#r-r.rSr@�ar$r$r%�test_6"sT








zModuleTester.test_6c	Cs�|jdddtdgdddgdgdd�|jdddtdgdddgdgdd�f}dD]�}zt|j|�}Wnty�tt|�}Yn0t|j|�}|d	|j�}||�}||�}|�|�	d�|�	d�|�|�|j
|j
�q\d	S)
zTests ufuncrIrr{r[r+rZr()Zsqrt�logZlog10Zexp�	conjugateN)r
rR�getattrr r!�fromnumericrZninrFrZ_mask)r#�d�fZufZmf�args�ur�mrr$r$r%�test_7Vs**�zModuleTester.test_7c	Cs�|jgd�gd�d�}|�d|j|dd��|�d|j|gd�d��|j|gd�d	d
�\}}|�d|�|dksvJ�|j|dd�<|j|dd�|jus�J�|jgd�gd�d�}|�dd�}|j|dd�d	f<|�|j|dd�dd
g�|j|d	d�d|ju�sJ�|�dd
g|j|dd��|j|dd	d�\}}|�|dd
g�gd�}gd�gd�g}|�d�}|�|j|dd�d�|�|j|d|d�d�|�|�d�d|�d�g�}|�|�|d�tj�t�d��dd�|�|j|dd�t�d�dd�|�|j|d	d�|j|dd�|j|dd�dg�|�|j|d|d�d�|�|j|d|d�gd��|�|j|d	d�|j|dd�|j|dd�dg�|�	d�}gd�}	gd�gd�g}
|�
d�}gd�}|�|j|�||�dd�d�|�|j|�||	�dd�d�|�|j|�||�dd�d
�|�|�|j|�||�dd��d�|�||
�}
|�|�|
d�d�|�|j|
dd�gd��|�|j|
d	d�ddg�|�|j|
d|d�gd��dS)N)rUrIrKrPrbr(rKrrp)rIrIrKrI)�weightsr+)r��returnedrLr[rU)rqr�rI)rr+r+r+r+r)r+rrrrr+rZg@)rqr�rPg(@g������
@)rUrIrKrPrLrO)rrr+r+rr)rr+r+r+r+r+)rUrI��X@r�rLg@rM)rUrIr�r�rLrO)
r
rFZaveragerrvr	r6�addrrrrr)r#Zott�resultZwtsZw1Zw2r-r.r^r_rmZm4Zm5�zr$r$r%�test_99ysT
*$22

$zModuleTester.test_99cCs*|�d�}|j|dd�<|�ddd�}dS)NrsrerZr[rYrX)r	rrv)r#r-r$r$r%�test_A�s
zModuleTester.test_AN)r'r'T)r')�__name__�
__module__�__qualname__r&rErFr6ZerrstaterTrarnrrrxrzr}r�r�r�r$r$r$r%r
s2"�
7







*





4

3

"

-
r�__main__zNfrom __main__ import ModuleTester 
import numpy
tester = ModuleTester(module)
zimport numpy.ma.core as module
)ryryr+roztester.test_%i()ryz#%iz2..................................................zModuleTester.test_%i.__doc__zcore_current : z.3fz - )Ztimeit�	functoolsrZnumpyr6rZnumpy.core.fromnumericr"r�Z
numpy.testingrrRrr�Z
setup_baseZ	setup_curZnrepeatZnloop�range�i�func�TimerrZcurr�print�evalr$r$r$r%�<module>s*$


Zerion Mini Shell 1.0