← Back
Editing: twodim_base.cpython-311.pyc
� ���c{z � �f � d Z ddlZddlZddlmZmZmZmZmZm Z m Z mZmZm Z mZmZmZmZmZmZmZmZ ddlmZmZ ddlmZ ddlmZ ddlmZ g d�Z ej ej d � � � Z ee� � Z! ee � � Z" ee� � Z#d� Z$d� Z% e e%� � d � � � Z& e e%� � d� � � Z'd'dd�d�Z(e ed � � dde)dfdd�d�� � � � Z* e e(� � e*� � Z+d(d�Z, e e,� � d)d�� � Z- e e,� � d)d�� � Z.d*dd�d�Z/e ed � � dde)fdd�d�� � � � Z0 e e/� � e0� � Z1d(d�Z2 e e2� � d)d�� � Z3 e e2� � d)d�� � Z4d+d�Z5 e e5� � d,d�� � Z6 d'd�Z7 e e7� � d-d �� � Z8 ed � � d)d!�� � Z9 ed � � d.d"�� � Z:d(d#�Z; e e;� � d)d$�� � Z< ed � � d.d%�� � Z= e e;� � d)d&�� � Z>dS )/z- Basic functions for manipulating 2d arrays � N)� asanyarray�arange�zeros� greater_equal�multiply�ones�asarray�where�int8�int16�int32�int64�intp�empty� promote_types�diagonal�nonzero�indices)�set_array_function_like_doc� set_module)� overrides)�iinfo)�broadcast_to)�diag�diagflat�eye�fliplr�flipud�tri�triu�tril�vander�histogram2d�mask_indices�tril_indices�tril_indices_from�triu_indices�triu_indices_from�numpy)�modulec � � |t j k r| t j k rt S |t j k r| t j k rt S |t j k r| t j k rt S t S )z# get small int that fits the range ) �i1�max�minr �i2r �i4r r )�low�highs �7/usr/lib/python3/dist-packages/numpy/lib/twodim_base.py�_min_intr4 ! sU � ��r�v�~�~�#���-�-����r�v�~�~�#���-�-����r�v�~�~�#���-�-����L� c � � | fS �N� ��ms r3 �_flip_dispatcherr; , � � � �4�Kr5 c �r � t | � � } | j dk rt d� � �| dd�ddd�f S )ae Reverse the order of elements along axis 1 (left/right). For a 2-D array, this flips the entries in each row in the left/right direction. Columns are preserved, but appear in a different order than before. Parameters ---------- m : array_like Input array, must be at least 2-D. Returns ------- f : ndarray A view of `m` with the columns reversed. Since a view is returned, this operation is :math:`\mathcal O(1)`. See Also -------- flipud : Flip array in the up/down direction. flip : Flip array in one or more dimensions. rot90 : Rotate array counterclockwise. Notes ----- Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. Requires the array to be at least 2-D. Examples -------- >>> A = np.diag([1.,2.,3.]) >>> A array([[1., 0., 0.], [0., 2., 0.], [0., 0., 3.]]) >>> np.fliplr(A) array([[0., 0., 1.], [0., 2., 0.], [3., 0., 0.]]) >>> A = np.random.randn(2,3,5) >>> np.all(np.fliplr(A) == A[:,::-1,...]) True � zInput must be >= 2-d.N����r �ndim� ValueErrorr9 s r3 r r 0 sB � �` �1� � �A��v��z�z��0�1�1�1��Q�Q�Q���"��W�:�r5 c �n � t | � � } | j dk rt d� � �| ddd�df S )ax Reverse the order of elements along axis 0 (up/down). For a 2-D array, this flips the entries in each column in the up/down direction. Rows are preserved, but appear in a different order than before. Parameters ---------- m : array_like Input array. Returns ------- out : array_like A view of `m` with the rows reversed. Since a view is returned, this operation is :math:`\mathcal O(1)`. See Also -------- fliplr : Flip array in the left/right direction. flip : Flip array in one or more dimensions. rot90 : Rotate array counterclockwise. Notes ----- Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. Requires the array to be at least 1-D. Examples -------- >>> A = np.diag([1.0, 2, 3]) >>> A array([[1., 0., 0.], [0., 2., 0.], [0., 0., 3.]]) >>> np.flipud(A) array([[0., 0., 3.], [0., 2., 0.], [1., 0., 0.]]) >>> A = np.random.randn(2,3,5) >>> np.all(np.flipud(A) == A[::-1,...]) True >>> np.flipud([1,2]) array([2, 1]) � zInput must be >= 1-d.Nr? .r@ r9 s r3 r r f s>