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/matrixlib/tests/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/numpy/matrixlib/tests/__pycache__/test_interaction.cpython-310.pyc
o

6��ac.�@sdZddlZddlZddlZddlZddlmZmZm	Z	m
Z
mZmZm
Z
dd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Z Gd*d+�d+�Z!d,d-�Z"d.d/�Z#dS)0z�Tests of interaction of matrix with other parts of numpy.

Note that tests with MaskedArray and linalg are done in separate files.
�N)�assert_�assert_equal�
assert_raises�assert_raises_regex�assert_array_equal�assert_almost_equal�assert_array_almost_equalcCs|t�ddgddgg�}tt|gd�dd�ftj��t�t�d��dd��}t|dd�t�d	�f|dd�d	fj	�dS)
N����)rr	r�2��
���)
�np�matrixr�
isinstance�asmatrix�arange�reshaper�array�T)�m�x�r�H/usr/lib/python3/dist-packages/numpy/matrixlib/tests/test_interaction.py�test_fancy_indexings .rcCsDddg}ddg}t�||g�}tjj�|||�}tt|tj��dS)Nrrr	r)rr�
polynomial�	polyutils�	mapdomainrr)�dom1�dom2r�resrrr�test_polynomial_mapdomains
r$cCsNt�gd�g�}tj|dd�}t�gd�g�}t||�tt|�tju�dS)N�r
r	r��axis�rr	r
)rr�sortrr�type��a�actual�expectedrrr�test_sort_matrix_none)s

r/cCsPt�gd�g�}tj|ddd�}t�gd�g�}t||�tt|�tju�dS)Nr%r	r&r()rr�	partitionrrr*r+rrr�test_partition_matrix_none2s

r1cC�Ntjddgtd�}tjddggtd�}tt�|d�|�tt�d|�|�dS�Nr	r
��dtyper�)rr�objectr�dot��arr�desiredrrr�%test_dot_scalar_and_matrix_of_objects<�r<cCs�tjdtjddD]7}tjd|d�d}tjddgdd	gg|d�}tjdd
gddgg|d�}tt�||�|�tt�||�|�qdS)
N�
AllInteger�AllFloat�?rr4rr	r
rr6�	�)r�	typecodesrrr�inner)�dt�scar:r;rrr�test_inner_scalar_and_matrixEs�rGcCr2r3)rrr7rrDr9rrr�'test_inner_scalar_and_matrix_of_objectsOr=rHc	Cs0t�ddgddgg�}t�d��dd�j}t�||dggdgdgddgg�}tt|jd�tju�tt|jd�tj	u�t
|jdjd�t�d��ddd�}tt
tj||dggdgdgddgg�t�||dggdgdggd	�g�}tt|jd�tj	u�tt|jd�tju�t
|jdjd
�dS)Nr	r
rr�readonly�	writeonly�allocate)r
r
)rJrK�
no_subtype)r	r
r
)rrrrr�nditerrr*�operands�ndarrayr�shaper�RuntimeError)r,�b�irrr�!test_iter_allocate_output_subtypeXs(����rTcCsht�ddgddgg�}tjtjtjfD]}||�}tt|�tju�||dd�}tt|�tju�qdS)Nr	r
rrF)�subok)rr�
zeros_like�	ones_like�
empty_likerr*)r,�
like_functionrR�crrrrYss�rYcCs�tjgd�gd�gdd�}|jdddd�}t||u�|jddd	�}t||�tt|�tj�|jdddd�}t||�t||u�tt|�tju�dS)
Nr()rrr�f4r4TF)rU�copy�i4)r\)rr�astyperrr*�r,rRrrr�test_array_astype~s

r`cCs.t�ddgddgg�}ttdtj||g�dS)Nr	r
rrzshape too large to be a matrix)rrr�
ValueError�stack)rrrr�
test_stack�s
�rccCr2r3)rrr7r�multiplyr9rrr�test_object_scalar_multiply�r=rec	Cs:t�t�d��}tjtjfD]7}||dd�}tt|tj��t|jdk�||dd�}tt|tj��t|jdk�||�}tt�|��qtj	|d<tjtjfD]�}t
jdd��.}t
�d	�||dd�}tt|tj��tt�
t�|���tt|�dk�Wd�n1s�wYt
jdd��G}t
�d	�||dd�}tt|tj��tt�|d
�o�t�|d�o�t�|d��tt|�dkd
�tt|djt��Wd�n1s�wYt
jdd��'}t
�d	�||�}tt�|��t|tj	k�tt|�dk�Wd�n	1�swYqQdS)Nrrr&�r	rr	�rr	T)�record�always)r	r)rr)r
rzno warning raised)rr�eye�nanmin�nanmaxrrrP�isscalar�nan�warnings�catch_warnings�simplefilter�any�isnan�len�
issubclass�category�RuntimeWarning)�mat�fr#�wrrr�test_nanfunctions_matrices�sL

�
 ��	
���r{cCs0t�t�d��}tjtjtjtjtjtjtj	fD]7}||dd�}t
t|tj��t
|jdk�||dd�}t
t|tj��t
|jdk�||�}t
t�
|��qtjtjfD]?}||dd�}t
t|tj��t
|jdk�||dd�}t
t|tj��t
|jdk�||�}t
t|tj��t
|jdk�qVdS)	Nrrr&rfr	rg)rr)r	rA)rrrj�	nanargmin�	nanargmax�nansum�nanprod�nanmean�nanvar�nanstdrrrPrm�	nancumsum�
nancumprod)rxryr#rrr�"test_nanfunctions_matrices_general�s.��r�cCs�t�tj�dd��}t|�d�t�|d��t�ddgddgg�}t�ddgddgg�}tj|d|d�}tt|�tj�t|dd	gg�dS)
Nrrr	r
rr)r'�weightsg@g������
@)	rr�random�randr�mean�averagerr*)�yr,rz�rrrr�test_average_matrix�sr�cCsNt�dd�}||}t�||�}t�|�}t�|�}t�||�}t||�dS)Nrr)r�linspace�trapzrr)rr�r��mx�my�mrrrr�test_trapz_matrix�s

r�cCs@tt�t�d��tj�sJ�ttjt�d�dd�tj�sJ�dS)Nr	)�to_begin)rr�ediff1drrrrr�test_ediff1d_matrixs$r�cCs�dd�}t�ddgddgg�}t�ddgddgg�}t�|d|�}tt|tj��t||�t�|d|�}tt|tj��t||�dS)	NcSs|dS�Nr
r)�rowrrr�double
sz,test_apply_along_axis_matrix.<locals>.doublerr	r
rrr6)rr�apply_along_axisrrr)r�rr.�resultrrr�test_apply_along_axis_matrixs
r�cCs|t�ddg�}t�|�}ttt�||��tj�ttt�||��tj�ttt�||��tj�ttt�||��tj�dSr�)r�onesrrr*�kronrOr)r,rrrr�test_kron_matrixs
r�c@s$eZdZdd�Zdd�Zdd�ZdS)�TestConcatenatorMatrixcs�ddg�ddg�tjd��f}tjd��f}tt|�tj�tt|�tj�tt�|�gd�g�tt�|�dgdgdgdgg�tt��fdd	��dS)
Nr	r
rrr�rZ)r	r
rrcstjd��fS)N�rc)r�r_rr_rr�<lambda>2sz4TestConcatenatorMatrix.test_matrix.<locals>.<lambda>)rr�rr*rrrra)�self�ab_r�ab_crr_r�test_matrix%s z"TestConcatenatorMatrix.test_matrixcCs>tjdddgdf}tt|�tj�tt�|�gd�g�dS)Nr�r	r
r)r	r
r)rr�rr*rr)r�r�rrr�test_matrix_scalar4sz)TestConcatenatorMatrix.test_matrix_scalarcCspt�dg�}t�dg�}t�dg�}t�dg�}tjd}t�||g||gg�}t||�tt|�t|��dS)Nr	r
rrz
a, b; c, d)rrr��bmatrr*)r�r,rRrZ�dr-r.rrr�test_matrix_builder9s

z*TestConcatenatorMatrix.test_matrix_builderN)�__name__�
__module__�__qualname__r�r�r�rrrrr�#sr�cCsjt�t��}tt�ddg�t�ddg��Wd�n1swYt|j�}t	�
d�}t||�dS)Nr	r
zl
    Arrays are not equal

    (shapes (2,), (1, 2) mismatch)
     x: array([1, 2])
     y: matrix([[1, 2]]))�pytest�raises�AssertionErrorrrrr�str�value�textwrap�dedent)�exc_info�msg�
msg_referencerrr�%test_array_equal_error_message_matrixEs �

r�cCs�t�ddgg�}t�dtjgg�}t�dtjgg�}t�tjtjgg�}t�ddgtjtjgg�}ttfD] }|||||fD]}|||�t�|�}|||�|||�q?q6dS)Ng�?g@)rrrn�infrrr)�m1�m2�m3�m4�m5�assert_funcrr,rrr�test_array_almost_equal_matrixTs


��r�)$�__doc__r�r�ro�numpyr�
numpy.testingrrrrrrrrr$r/r1r<rGrHrTrYr`rcrer{r�r�r�r�r�r�r�r�r�rrrr�<module>s8$
	
	
		)

"

https://t.me/RX1948 - 2025