HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/numpy/matrixlib/tests/__pycache__/test_masked_matrix.cpython-310.pyc
o

6��a�"�@s�ddlZddlmZddlmZmZmZmZddl	m
Z
mZmZm
Z
mZmZmZmZmZmZmZmZddlmZddlmZGdd�deej�ZGd	d
�d
�ZGdd�d�ZGd
d�d�ZdS)�N)�assert_warns)�assert_�assert_equal�
assert_raises�assert_array_equal)�masked_array�
masked_values�masked�allequal�MaskType�getmask�MaskedArray�nomask�log�add�hypot�divide��mr_)�picklec@s,eZdZefdd�Zdd�Zedd��ZdS)�MMatrixcCst�|�}tj|||d�}|S)N)�data�mask)�np�matrixr
�__new__)�clsrr�mat�_data�r�J/usr/lib/python3/dist-packages/numpy/matrixlib/tests/test_masked_matrix.pyrs
zMMatrix.__new__cCstj�||�t�||�dS�N)rr�__array_finalize__r
)�self�objrrr r"szMMatrix.__array_finalize__cCs|�t�}d|_|S)NF)�viewr
�_sharedmask)r#�_viewrrr �_seriess
zMMatrix._seriesN)�__name__�
__module__�__qualname__rrr"�propertyr(rrrr rs
rc@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�TestMaskedMatrixcCs�t�gd�gd�g�}t|gd�gd�gd�}t|gd�gd�gd�}t|�}t|�t|�tt|d�t|d�u�t|d|dk�t|dtu�t|d|d�t|d	d
d�f|d	d
d�f�t|dd�df|dd�df�t|dd�|dd��t|d
d�|d
d��d|d<d|d<t||�d
|d	d
d�f<d
|d	d
d�f<t||�t|d<t||�t|d	d
d�f<t||�|d	dd�f|d	dd�f<t|d<tt	t
|�t�gd�gd�g���tgd�gd��|d
dd�f<tt	t
|�d
tgd����tt	t
|d
�tgd����tgd�gd��|d
dd�f<tt	t
|d
�tgd����tt	|d
tgd����t�t�d�d�}t
|d�}t||�tt	tgd�td�|j��td|j�dS)N����)�r1r0�r/rr)rr/r�r�r/r)r/r/)rr0rr/r0�	�c)rr/)r/r/r���?�@)rrrr/r��dtype)rrr�str�reprr�typer	rr
r�array�arangerrr�
fill_value)r#�x1�x2�x3�x4rrr �test_matrix_indexing sP""



$

�z%TestMaskedMatrix.test_matrix_indexingcCsztt�ttd���gd�dd�}tdtjd�D]!}t�tj||d��}t	|j
|j
�t	||�tt|j
tj��qdS)N�
)r/rr/rrr0r4r/)�protocol)rrr�list�ranger�HIGHEST_PROTOCOL�loads�dumpsr�_maskr�
isinstancer)r#�a�proto�	a_pickledrrr �test_pickling_subbaseclassLs"
�z+TestMaskedMatrix.test_pickling_subbaseclasscCs�tt�ddgddgg�t�d�d�}t|jdd�jd	�t|jdd�jd
�t|jdd�ddgg�t|jdd�d
gdgg�dS)Nr/r0r1r2)r0r0r4r)�axis)r/r0)r0r/g@r:g�?g@)rrr�zerosr�count�shape�mean)r#�mrrr �test_count_mean_with_matrixUs
$z,TestMaskedMatrix.test_count_mean_with_matrixcCsbtt�gd�g�gd�d�}t|jdd�t|jdt�tt�|jdd�|ddd�fk��tt�gd�g�gd�d�}tgd�gd�d�|_tt�gd�g�gd�d�}t||�tt�gd�g�gd�d�}|j}|gd	�|dd�<t||�d
|d<tt�t�d��dd�}|j}|dd�}t|j	t�
ddgg��t|jt�
d
d
gg��dS)Nr.)rrr/r4r/r0r)r1r0r/r3)r0r/rr6r9gF)rrrr�flatr	r�all�eyerr@r)r#�test�control�testflatrQ�b�b01rrr �	test_flat_s$(

zTestMaskedMatrix.test_flatcCstt�gd�gd�gd�g�}t�|�}tjgd�gd�gd�gtjd�}t||d�}|d	k}|d	k}t|���t|���t|�d
�t�gd���t|�d�t�gd��j	�t|�d
�t�gd���t|�d�t�gd
��j	�t|���t|���t|�d
�t�gd���t|�d�t�gd��j	�t|�d
�t�gd���t|�d�t�gd��j	�dS)N)g�p=
ף�?g�p=
ף�?g�������?)g�Q����?g��Q��?g)\��(�?)gףp=
��?gףp=
��?gffffff�?)TFF)FFF)TTFr;r4g�?r)FFTr/)TTT)
rr@r�bool_rrr]�anyr�T)r#�x�XrZ�mX�mXbig�mXsmallrrr �test_allany_onmatricesxs4
�

�� z'TestMaskedMatrix.test_allany_onmatricescCs`tt�gd��gd�d�}|��}t||�tt|tj��t|d<|��}t|gd�g�dS)N)r/r0r1r2)rrrrr4)rr)r0r1r2)rrr�
compressedrrrPr	)r#rQrbrrr �test_compressed�s
z TestMaskedMatrix.test_compressedcCsDtt�gd��gd�gd�}|��}t|jd�t|jj|j�dS)N)r/r0r1r2r8�rr/rrrr4)r/r8)rrr�ravelrrXrO)r#rQ�aravelrrr �
test_ravel�szTestMaskedMatrix.test_ravelcCs�ttt�d�tj�d���}t�|�}t|dtfdtfgd�}d|j	d<|�
tdftj�}t||�t
t|tj��t
t|t��dS)NrHrQrbr;r5rr0)rJ�ziprrA�random�randr@r�floatrr%rrrrPr
)r#�iteratorrrQr_rrr �	test_view�s


zTestMaskedMatrix.test_viewN)r)r*r+rGrTr[rdrmrorsryrrrr r-s,	
	r-c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�TestSubclassingcCs,tjddd�}t|gd�d�}||f|_dS)Nr8rwr;rpr4)rrArr�r#rh�mxrrr �setup�szTestSubclassing.setupcCs |j\}}tt|jtj��dSr!)rrrPrrrr{rrr �test_maskedarray_subclassing�s
z,TestSubclassing.test_maskedarray_subclassingcCsb|j\}}tjdd��ttt|�t��tt|�t�|��Wd�dS1s*wYdS)N�ignore)r)rr�errstaterrPrrrr{rrr �test_masked_unary_operations�s

"�z,TestSubclassing.test_masked_unary_operationscCs�|j\}}ttt||�t��ttt||�t��tt||�||�ttt||�jtj��t	t
��ttt�||�t��Wd�n1sIwYttt||�t��ttt||�t��dSr!)
rrrPrrrrrrr�DeprecationWarning�outerrr{rrr �test_masked_binary_operations�s

�z-TestSubclassing.test_masked_binary_operationscCs`|j\}}t|j��|jd�}ttt||�t��ttt||�t��tt||�t||��dS)Nr4)	rr�	__array__rrrPrrr)r#rhr|�xmxrrr �test_masked_binary_operations2�s

z.TestSubclassing.test_masked_binary_operations2N)r)r*r+r}r~r�r�r�rrrr rz�srzc@seZdZdd�Zdd�ZdS)�TestConcatenatorcCsttjjdd��dS)NcSstdS)Nz
1, 2; 3, 4rrrrr �<lambda>�sz6TestConcatenator.test_matrix_builder.<locals>.<lambda>)rr�ma�MAError)r#rrr �test_matrix_builder�sz$TestConcatenator.test_matrix_buildercCsPtd}tj�tjd�}t||�tt|�t|��tt|j�t|j��dS)N)�rr/r0r1)	rrr�r@�r_rrr?r)r#�actual�expectedrrr �test_matrix�s

zTestConcatenator.test_matrixN)r)r*r+r�r�rrrr r��sr�)�numpyr�
numpy.testingr�numpy.ma.testutilsrrrr�
numpy.ma.corerrr	r
rrr
rrrrr�numpy.ma.extrasr�numpy.compatrrrr-rzr�rrrr �<module>s8*