관리-도구
편집 파일: test_function_base.cpython-311.pyc
� �܋fh � � � d dl Z d dlZd dlZd dlZd dlmZ d dlZd dlZd dlZd dl m Z d dlmZ d dlmZ d dlZd dlmZ d dlmZmZmZmZmZmZmZmZmZmZmZmZm Z d dl!m"c m#Z$ d dl%m&Z& d dl'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZG d d lHmIZI d � ZJd� ZK G d� d � � ZL G d� d� � ZM G d� d� � ZN G d� d� � ZO G d� d� � ZP G d� d� � ZQ G d� d� � ZR G d� d� � ZS G d� d� � ZT G d� d� � ZU G d � d!� � ZV G d"� d#� � ZW G d$� d%� � ZX G d&� d'� � ZY G d(� d)� � ZZ G d*� d+� � Z[ G d,� d-� � Z\ G d.� d/� � Z] G d0� d1� � Z^ G d2� d3� � Z_dsd5�Z`dtd7�Za G d8� d9� � Zb G d:� d;� � Zc G d<� d=� � Zd G d>� d?� � Zeejf �g d@dAejh dB z ejh dC z � � ejf �g dDg dE�� � G dF� dG� � � � � � Zi G dH� dI� � Zj G dJ� dK� � Zk G dL� dM� � Zl G dN� dO� � Zm G dP� dQ� � Zn G dR� dS� � Zo G dT� dU� � Zp G dV� dW� � Zq G dX� dY� � Zr G dZ� d[� � Zs G d\� d]� � Zt G d^� d_� � Zu G d`� da� � Zv G db� dc� � Zwg dd�Zx G de� df� � Zy G dg� dh� � Zz G di� dj� � Z{ G dk� dl� � Z| G dm� dn� � Z} G do� dp� � Z~ G dq� dr� � ZdS )u� N��Fraction)�arrays)�partial)�ma) �assert_�assert_equal�assert_array_equal�assert_almost_equal�assert_array_almost_equal� assert_raises�assert_allclose�IS_PYPY�assert_warns�assert_raises_regex�suppress_warnings�HAS_REFCOUNT�IS_WASM)�rand) �add_newdoc_ufunc�angle�average�bartlett�blackman�corrcoef�cov�delete�diff�digitize�extract�flipud�gradient�hamming�hanning�i0�insert�interp�kaiser�meshgrid�msort� piecewise�place�rot90�select�setxor1d�sinc�trapz� trim_zeros�unwrap�unique� vectorize)�normalize_axis_tuplec �n � t j | � � }t j � ||� � }|S �N)�np�arange�add�outer)�n�datas �u/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib64/python3.11/site-packages/numpy/lib/tests/test_function_base.py�get_matr@ s) � � �9�Q�<�<�D� �6�<�<��d�#�#�D��K� c � � t j t j | |� � j t j � � }| |_ ||_ |S )za Like real + 1j * imag, but behaves as expected when imag contains non-finite values )r9 �zeros� broadcast�shape�complex_�real�imag)rG rH �rets r? � _make_complexrJ % s9 � � �(�2�<��d�+�+�1�2�;� ?� ?�C��C�H��C�H��JrA c � � e Zd Zd� Zd� Zd� ZdS )� TestRot90c � � t t t t j d� � � � t t t t j d� � d�� � t t t t j d� � d�� � t t t t j d� � d�� � t t t t j d� � d�� � g d�g d �g}d dgddgd dgg}g d�g d�g}dd gddgdd gg}g d�g d �g}t ddd� � D ]!}t t ||�� � |� � �"t ddd� � D ]!}t t ||�� � |� � �"t ddd� � D ]!}t t ||�� � |� � �"t d dd� � D ]!}t t ||�� � |� � �"t t t |d�� � d�� � |� � t t |dd�� � t |dd�� � � � d S )N� �� rP rP �r � rP ��axes�rP rP �r rP �rR rR )���rR �� rN � rP r[ rR r rZ �r[ rN rZ �rP rR r ���� )�krX ����r rR �rR r �r` rT )r � ValueErrorr- r9 �ones�ranger )�self�a�b1�b2�b3�b4r` s r? � test_basiczTestRot90.test_basic1 sU � ��j�%������4�4�4��j�%����)9�)9��H�H�H�H��j�%������e�D�D�D�D��j�%������e�D�D�D�D��j�%����)9�)9��G�G�G�G� �Y�Y� �Y�Y� ���!�f��!�f��!�f��� �i�i��i�i����!�f��!�f��!�f��� �i�i��i�i��� �r�2�q�!�!� ,� ,�A���q�A�����+�+�+�+��r�2�q�!�!� ,� ,�A���q�A�����+�+�+�+��r�2�q�!�!� ,� ,�A���q�A�����+�+�+�+��q�"�a��� ,� ,�A���q�A�����+�+�+�+��U�5���/�/�/�e�<�<�<�a�@�@�@��U�1���.�.�.��a�2�E�0J�0J�0J�K�K�K�K�KrA c �* � t j d� � }t t |� � j d� � t t |d�� � t |d�� � � � t t |d�� � t |d�� � � � d S )N)�2 �( rZ )rq rp rZ rV rS �r ra �rR rP �rX ra )r9 rf r r- rE �rh ri s r? � test_axeszTestRot90.test_axesQ s� � ��G�K� � ���U�1�X�X�^�[�1�1�1��U�1�5�)�)�)�5���+@�+@�+@�A�A�A��U�1�5�)�)�)�5���+A�+A�+A�B�B�B�B�BrA c � � t j d� � � d� � }ddgddggddgd d ggg}ddgddggd dgd dggg}d dgddggd dgddggg}d d gddggddgddggg}t t |d�� � |� � t t |d �� � |� � t t |d�� � |� � t dd � � D ]5}t t ||d�� � t ||dz d�� � � � �6d S )N� rO rP rZ � � r rR rN r[ rb rS rc rs )rP r rd )r9 r: �reshaper r- rg )rh ri � a_rot90_01� a_rot90_12� a_rot90_20� a_rot90_10r` s r? �test_rotation_axeszTestRot90.test_rotation_axesW s� � ��I�a�L�L� � ��)�)���1�v��1�v���1�v��1�v�� � � �1�v��1�v���1�v��1�v�� � � �1�v��1�v���1�v��1�v�� � � �1�v��1�v���1�v��1�v�� � � �U�1�6�*�*�*�J�7�7�7��U�1�6�*�*�*�J�7�7�7��U�1�6�*�*�*�J�7�7�7��q���� @� @�A���q�A�F�3�3�3��z�Q�q�S�v�>�>�>� @� @� @� @� @� @rA N)�__name__� __module__�__qualname__rn rv r� � rA r? rL rL 0 sM � � � � � �L� L� L�@C� C� C�@� @� @� @� @rA rL c �D � e Zd Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z d� Z d � Zd S )�TestFlipc �� � t t j t j t j d� � d�� � t t j t j t j d� � d�� � t t j t j t j d� � d�� � t t j t j t j d� � d�� � d S )NrN rR ��axis�rN rN rP r^ �r rZ )r r9 � AxisError�fliprf �rh s r? rv zTestFlip.test_axesv s� � ��b�l�B�G�R�W�Q�Z�Z�a�@�@�@�@��b�l�B�G�R�W�V�_�_�1�E�E�E�E��b�l�B�G�R�W�V�_�_�2�F�F�F�F��b�l�B�G�R�W�V�_�_�6�J�J�J�J�J�JrA c �� � t d� � }|d d �d d d�f }t t j |d� � |� � g d�g d�g}g d�g d�g}t t j |d� � |� � d S )NrN ra rR rQ rY r] r\ �r@ r r9 r� �rh ri �bs r? � test_basic_lrzTestFlip.test_basic_lr| s� � ��A�J�J�� �a�a�a���2��g�J���R�W�Q��]�]�A�&�&�&� �Y�Y� �Y�Y� �� �Y�Y� �Y�Y� ���R�W�Q��]�]�A�&�&�&�&�&rA c �� � t d� � }|d d d�d d �f }t t j |d� � |� � g d�g d�g}g d�g d�g}t t j |d� � |� � d S )NrN ra r rQ rY r� r� s r? � test_basic_udzTestFlip.test_basic_ud� s� � ��A�J�J�� �d�d��d�A�A�A�g�J���R�W�Q��]�]�A�&�&�&� �Y�Y� �Y�Y� �� �Y�Y� �Y�Y� ���R�W�Q��]�]�A�&�&�&�&�&rA c �� � t j ddgddggddgddggg� � }t j ddgddggddgddggg� � }t t j |d� � |� � d S � Nr rR rP rZ rN r[ ry rz �r9 �arrayr r� r� s r? �test_3d_swap_axis0zTestFlip.test_3d_swap_axis0� � � ��H��1�v��1�v���1�v��1�v�� � !� !�� �H��1�v��1�v���1�v��1�v�� � !� !�� �R�W�Q��]�]�A�&�&�&�&�&rA c �� � t j ddgddggddgddggg� � }t j ddgddggddgddggg� � }t t j |d� � |� � d S r� r� r� s r? �test_3d_swap_axis1zTestFlip.test_3d_swap_axis1� r� rA c �� � t j ddgddggddgddggg� � }t j ddgddggddgddggg� � }t t j |d� � |� � d S r� r� r� s r? �test_3d_swap_axis2zTestFlip.test_3d_swap_axis2� r� rA c �B � t j d� � � dddd� � }t |j � � D ]_}t t j ||� � t j |� d|� � � � � |d� � � � �`d S )N�x rP rZ rN r[ r ) r9 r: r{ rg �ndimr r� r! �swapaxes)rh ri �is r? �test_4dzTestFlip.test_4d� s� � ��I�m�$�$�,�,�Q��1�a�8�8���q�v��� E� E�A�����A�����1�:�:�a��#3�#3�4�4�=�=�a��C�C� E� E� E� E� E� ErA c � � t j g d�g d�g� � }t j g d�g d�g� � }t t j |� � |� � d S )N�rR rP rZ �rN r[ ry )ry r[ rN �rZ rP rR r� r� s r? �test_default_axiszTestFlip.test_default_axis� sf � ��H�i�i�i��i�i�!� "� "���H�i�i�i��i�i�!� "� "���R�W�Q�Z�Z��#�#�#�#�#rA c � � t j ddgddggddgddggg� � }t t j |d � � � |� � t j ddgddggddgddggg� � }t t j |d� � � |� � t j ddgddggddgddggg� � }t t j |d� � � |� � d S ) Nr rR rP rZ rN r[ ry rz r� r� rV rs r� �rh ri r� �cs r? �test_multiple_axeszTestFlip.test_multiple_axes� s � ��H��1�v��1�v���1�v��1�v�� � !� !�� �R�W�Q�R�(�(�(�!�,�,�,��H��1�v��1�v���1�v��1�v�� � !� !�� �R�W�Q�V�,�,�,�a�0�0�0��H��1�v��1�v���1�v��1�v�� � !� !�� �R�W�Q�V�,�,�,�a�0�0�0�0�0rA N)r� r� r� rv r� r� r� r� r� r� r� r� r� rA r? r� r� t s� � � � � � �K� K� K�'� '� '�'� '� '�'� '� '�'� '� '�'� '� '�E� E� E�$� $� $�1� 1� 1� 1� 1rA r� c � � e Zd Zd� Zd� ZdS )�TestAnyc �� � g d�}g d�}g d�}t t j |� � � � t t j |� � � � t t j |� � � � d S )N�r r rR r �r r r r )rR r rR r )r r9 �any�rh �y1�y2�y3s r? rn zTestAny.test_basic� sg � � �\�\�� �\�\�� �\�\�����r� � �������r� � �����B�F�2�J�J������rA c � � g d�g d�g d�g}t t j |� � � � t t j |d�� � g d�� � t t j |d�� � g d�� � d S )N�r r r �r rR r �rR rR r r r� rR �r rR rR )r r9 r� r �rh r� s r? �test_ndzTestAny.test_nd� s| � ��i�i����I�I�I� .�����r� � �����2�6�"�1�-�-�-�y�y�y�9�9�9��2�6�"�1�-�-�-�y�y�y�9�9�9�9�9rA N�r� r� r� rn r� r� rA r? r� r� � s2 � � � � � � � � �:� :� :� :� :rA r� c � � e Zd Zd� Zd� ZdS )�TestAllc �P � g d�}g d�}g d�}t t j |� � � � t t j |� � � � t t j |� � � � t t j t j |� � � � � � d S )N)r rR rR r r� �rR rR rR rR )r r9 �allr� r� s r? rn zTestAll.test_basic� s� � � �\�\�� �\�\�� �\�\���B�F�2�J�J��������r� � �����B�F�2�J�J�������������}�%�%�&�&�&�&�&rA c � � g d�g d�g d�g}t t j |� � � � t t j |d�� � g d�� � t t j |d�� � g d�� � d S )N�r r rR r� �rR rR rR r r� rR )r r9 r� r r� s r? r� zTestAll.test_nd� s~ � ��i�i����I�I�I� .���B�F�2�J�J������2�6�"�1�-�-�-�y�y�y�9�9�9��2�6�"�1�-�-�-�y�y�y�9�9�9�9�9rA Nr� r� rA r? r� r� � s2 � � � � � �'� '� '�:� :� :� :� :rA r� c � � e Zd Zd� Zd� Zd� ZdS )�TestCopyc �� � t j ddgddgg� � }t j |� � }t ||� � d|d<