3
���h�k � @ s d Z ddlZddlmZmZmZmZmZmZm Z m
Z
mZmZm
Z
mZmZmZmZmZ ddlmZ ddlmZ ddlmZ ddd d
ddd
ddddddddgZejejdd�Zee�Zee�Zee
�Zdd� Zdd� Zee�dd
� �Z ee�dd� �Z!ed�dde"dfdd ��Z#d8d d!�Z$ee$�d9d"d��Z%ee$�d:d#d��Z&ed�dde"fd$d��Z'd;d%d&�Z(ee(�d<d'd��Z)ee(�d=d(d
��Z*d>d)d*�Z+ee+�d?d,d��Z,d@d-d.�Z-ee-�dAd0d��Z.ed�dBd1d��Z/ed�dCd2d��Z0dDd3d4�Z1ee1�dEd5d��Z2ed�dFd6d��Z3ee1�dGd7d��Z4dS )Hz- Basic functions for manipulating 2d arrays
� N)�
asanyarray�arange�zeros�
greater_equal�multiply�ones�asarray�where�int8�int16�int32�int64�empty�
promote_types�diagonal�nonzero)�
set_module)� overrides)�iinfo�diag�diagflat�eye�fliplr�flipud�tri�triu�tril�vander�histogram2d�mask_indices�tril_indices�tril_indices_from�triu_indices�triu_indices_from�numpy)�modulec C sL |t jkr| t jkrtS |tjkr0| tjkr0tS |tjkrH| tjkrHtS tS )z# get small int that fits the range ) �i1�max�minr
�i2r �i4r r
)�low�high� r- �6/tmp/pip-build-5_djhm0z/numpy/numpy/lib/twodim_base.py�_min_int s r/ c C s | fS )Nr- )�mr- r- r. �_flip_dispatcher* s r1 c C s0 t | �} | jdk rtd��| dd�ddd�f S )a�
Flip array in the left/right direction.
Flip 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.
rot90 : Rotate array counterclockwise.
Notes
-----
Equivalent to m[:,::-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�
ValueError)r0 r- r- r. r . s -
c C s, t | �} | jdk rtd��| ddd�df S )a
Flip array in the up/down direction.
Flip 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.
rot90 : Rotate array counterclockwise.
Notes
-----
Equivalent to ``m[::-1,...]``.
Does not require the array to be two-dimensional.
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])
r3 zInput must be >= 1-d.N.r4 )r r5 r6 )r0 r- r- r. r a s 1
�Cc C sf |dkr| }t | |f||d�}||kr*|S |dkr8|}n
| | }d|d|| � j|d|d �< |