Файловый менеджер - Редактировать - /home/digitalm/venv/lib/python3.7/site-packages/numpy/lib/__pycache__/index_tricks.cpython-37.pyc
Назад
B �5�g�w � @ s d dl Z d dlZd dlZd dlZd dlm mZ d dlmZm Z m Z mZmZm Z mZ d dlmZmZ d dlmZ ddlmZ d dlmZmZ d dlmZ d dlmZmZ d d lmZ e j ej!d d�Z!dd ddddddddddddgZ"dd� Z#e!e#�dd� �Z$G dd� d�Z%G dd � d e%�Z&e&� Z'G d!d"� d"e%�Z(e(� Z)G d#d$� d$�Z*G d%d&� d&e*�Z+e+� Z,G d'd(� d(e*�Z-e-� Z.ed �G d)d� d��Z/ed �G d*d� d��Z0G d+d,� d,�Z1e1d-d.�Z2e1d/d.�Z3d8d0d1�Z4e!e4�d9d2d��Z5ed �d:d4d��Z6d5d6� Z7e!e7�d7d� �Z8dS );� N)�asarray� ScalarType�array�alltrue�cumprod�arange�ndim)�find_common_type� issubdtype� )�diff)�ravel_multi_index� unravel_index)� set_module)� overrides�linspace)� as_strided�numpy)�moduler r �mgrid�ogrid�r_�c_�s_� index_exp�ix_�ndenumerate�ndindex� fill_diagonal�diag_indices�diag_indices_fromc G s | S )N� )�argsr! r! �L/home/digitalm-up/venv/lib/python3.7/site-packages/numpy/lib/index_tricks.py�_ix__dispatcher s r$ c G s� g }t | �}x�t| �D ]�\}}t|tj�sHt|�}|jdkrH|�tj�}|j dkrZt d��t|jtj �rr|�� \}|�d| |jf d|| d �}|�|� qW t|�S )a5 Construct an open mesh from multiple sequences. This function takes N 1-D sequences and returns N outputs with N dimensions each, such that the shape is 1 in all but one dimension and the dimension with the non-unit shape value cycles through all N dimensions. Using `ix_` one can quickly construct index arrays that will index the cross product. ``a[np.ix_([1,3],[2,5])]`` returns the array ``[[a[1,2] a[1,5]], [a[3,2] a[3,5]]]``. Parameters ---------- args : 1-D sequences Each sequence should be of integer or boolean type. Boolean sequences will be interpreted as boolean masks for the corresponding dimension (equivalent to passing in ``np.nonzero(boolean_sequence)``). Returns ------- out : tuple of ndarrays N arrays with N dimensions each, with N the number of input sequences. Together these arrays form an open mesh. See Also -------- ogrid, mgrid, meshgrid Examples -------- >>> a = np.arange(10).reshape(2, 5) >>> a array([[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]]) >>> ixgrid = np.ix_([0, 1], [2, 4]) >>> ixgrid (array([[0], [1]]), array([[2, 4]])) >>> ixgrid[0].shape, ixgrid[1].shape ((2, 1), (1, 2)) >>> a[ixgrid] array([[2, 4], [7, 9]]) >>> ixgrid = np.ix_([True, True], [2, 4]) >>> a[ixgrid] array([[2, 4], [7, 9]]) >>> ixgrid = np.ix_([True, True], [False, False, True, False, True]) >>> a[ixgrid] array([[2, 4], [7, 9]]) r r z!Cross index must be 1 dimensional)r )�len� enumerate� isinstance�_nx�ndarrayr �size�astypeZintpr � ValueErrorr �dtypeZbool_ZnonzeroZreshape�append�tuple)r"