← Back
Editing: _index.cpython-311.pyc
� d�c�2 � � � d Z ddlZddlmZ eeej fZn# e $ r eej fZY nw xY wd� Z G d� d� � Zd� Zd � Z d � Zdd�Zd � Zd� ZdS )z*Indexing mixin for sparse matrix classes. � N� )� isintlikec � � t j | |� � \ }}| j j |j _ |j j |j _ ||fS )a Same as np.broadcast_arrays(a, b) but old writeability rules. NumPy >= 1.17.0 transitions broadcast_arrays to return read-only arrays. Set writeability explicitly to avoid warnings. Retain the old writeability rules, as our Cython code assumes the old behavior. )�np�broadcast_arrays�flags� writeable)�a�b�x�ys �5/usr/lib/python3/dist-packages/scipy/sparse/_index.py�_broadcast_arraysr sA � � ��q�!�$�$�D�A�q���)�A�G����)�A�G���a�4�K� c � � e Zd ZdZd� Zd� Zd� Zd� Zd� Zd� Z d� Z d � Zd � Zd� Z d� Zd � Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� ZdS )� IndexMixinzS This class provides common dispatching and validation logic for indexing. c �2 � | j rt d� � �dS )z�We do not currently support 1D sparse arrays. This function is called each time that a 1D array would result, raising an error instead. Once 1D sparse arrays are implemented, it should be removed. zcWe have not yet implemented 1D sparse slices; please index using explicit indices, e.g. `x[:, [0]]`N)� _is_array�NotImplementedError)�selfs r �_raise_on_1d_array_slicez#IndexMixin._raise_on_1d_array_slice s0 � � �>� �%�H�� � � � r c � � | � |� � \ }}t |t � � r�t |t � � r| � ||� � S t |t � � r*| � � � | � ||� � S |j dk r*| � � � | � ||� � S |j dk r| � ||� � S t d� � �t |t � � r�t |t � � r*| � � � | � ||� � S t |t � � rC|t d � � k r||k r| � � � S | � ||� � S |j dk r| � ||� � S t d� � �|j dk rkt |t � � r*| � � � | � ||� � S t |t � � r| � ||� � S n�t |t � � r| � ||� � S t |t � � rt d� � �|j d dk rN|j dk s|j d dk r2| � |d d �df |� � � � � S t'