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/linalg/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

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

d�c���^�dZddlZddlmZddlmZddlmZddlm	Z	m
Z
mZdgZd�Z
d	d�ZdS)
zSparse matrix norms.

�N)�issparse)�svds)�Inf�sqrt�abs�normc�~�tj�|��}tj�|��S)N)�sp�_sputils�_todata�np�linalgr)�x�datas  �;/usr/lib/python3/dist-packages/scipy/sparse/linalg/_norm.py�_sparse_frobenius_normrs+��
�;���q�!�!�D�
�9�>�>�$����c�n	�t|��std���|�|dvrt|��S|���}|�d}nbt	|t
��sMd}	t
|��}n"#t$r}t|��|�d}~wwxYw||krt|���|f}d}t|��dk�r�|\}}||cxkr|krnn||cxkr|ksntd|�d|j	�����||z||zkrtd	���|dkrt|d
d���\}	}
}	|
d
S|dkrt�|d
kr=t|���
|����|���dS|tkr=t|���
|����|���dS|dkr=t|���
|����|���dS|tkr=t|���
|����|���dS|dvrt|��Std���t|��d
k�r
|\}||cxkr|ksntd|�d|j	�����|tkr%t|���|���}�n9|tkr%t|���|���}�n|d
kr|d
k�
|���}n�|d
kr$t|���
|���}n�|dvrDt#t|���d���
|�����}nu	|d
zn"#t$r}td��|�d}~wwxYwt'jt|���|���
|���d
|z��}t)|d��r&|������St)|d��r|j���S|���Std���)a�

    Norm of a sparse matrix

    This function is able to return one of seven different matrix norms,
    depending on the value of the ``ord`` parameter.

    Parameters
    ----------
    x : a sparse matrix
        Input sparse matrix.
    ord : {non-zero int, inf, -inf, 'fro'}, optional
        Order of the norm (see table under ``Notes``). inf means numpy's
        `inf` object.
    axis : {int, 2-tuple of ints, None}, optional
        If `axis` is an integer, it specifies the axis of `x` along which to
        compute the vector norms.  If `axis` is a 2-tuple, it specifies the
        axes that hold 2-D matrices, and the matrix norms of these matrices
        are computed.  If `axis` is None then either a vector norm (when `x`
        is 1-D) or a matrix norm (when `x` is 2-D) is returned.

    Returns
    -------
    n : float or ndarray

    Notes
    -----
    Some of the ord are not implemented because some associated functions like,
    _multi_svd_norm, are not yet available for sparse matrix.

    This docstring is modified based on numpy.linalg.norm.
    https://github.com/numpy/numpy/blob/main/numpy/linalg/linalg.py

    The following norms can be calculated:

    =====  ============================
    ord    norm for sparse matrices
    =====  ============================
    None   Frobenius norm
    'fro'  Frobenius norm
    inf    max(sum(abs(x), axis=1))
    -inf   min(sum(abs(x), axis=1))
    0      abs(x).sum(axis=axis)
    1      max(sum(abs(x), axis=0))
    -1     min(sum(abs(x), axis=0))
    2      Spectral norm (the largest singular value)
    -2     Not implemented
    other  Not implemented
    =====  ============================

    The Frobenius norm is given by [1]_:

        :math:`||A||_F = [\sum_{i,j} abs(a_{i,j})^2]^{1/2}`

    References
    ----------
    .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*,
        Baltimore, MD, Johns Hopkins University Press, 1985, pg. 15

    Examples
    --------
    >>> from scipy.sparse import *
    >>> import numpy as np
    >>> from scipy.sparse.linalg import norm
    >>> a = np.arange(9) - 4
    >>> a
    array([-4, -3, -2, -1, 0, 1, 2, 3, 4])
    >>> b = a.reshape((3, 3))
    >>> b
    array([[-4, -3, -2],
           [-1, 0, 1],
           [ 2, 3, 4]])

    >>> b = csr_matrix(b)
    >>> norm(b)
    7.745966692414834
    >>> norm(b, 'fro')
    7.745966692414834
    >>> norm(b, np.inf)
    9
    >>> norm(b, -np.inf)
    2
    >>> norm(b, 1)
    7
    >>> norm(b, -1)
    6

    The matrix 2-norm or the spectral norm is the largest singular
    value, computed approximately and with limitations.

    >>> b = diags([-1, 1], [0, 1], shape=(9, 10))
    >>> norm(b, 2)
    1.9753...
    z*input is not sparse. use numpy.linalg.normN)N�fro�f)r�z6'axis' must be None, an integer or a tuple of integers�z
Invalid axis z for an array with shape zDuplicate axes given.r�lobpcg)�k�solverr���)�axis)rr���)Nrrz Invalid norm order for matrices.)rNzInvalid norm order for vectors.�toarray�Az&Improper number of dimensions to norm.)r�	TypeErrorr�tocsr�
isinstance�tuple�int�len�
ValueError�shaper�NotImplementedErrorr�sum�maxr�minr�powerr
�hasattrr�ravelr )
r�ordr�msg�int_axis�e�nd�row_axis�col_axis�_�s�a�Ms
             rrrs���|�A�;�;�F��D�E�E�E��|��1�1�1�%�a�(�(�(�	
���	�	�A��|����
��e�
$�
$��F��	(��4�y�y�H�H���	(�	(�	(��C�.�.�a�'�����	(�����8����C�.�.� ��{��	
�B�
�4�y�y�A�~�~�!���(���x�$�$�$�$�"�$�$�$�$�$�"���)=�)=�)=�)=�2�)=�)=�)=�)=��*�"�d�d�A�G�G�-�.�.�
.��b�=�H�r�M�)�)��4�5�5�5��!�8�8��1��(�3�3�3�G�A�q�!��Q�4�K�
�B�Y�Y�%�%�
�A�X�X��q�6�6�:�:�8�:�,�,�0�0�h�0�?�?��D�D�
�C�Z�Z��q�6�6�:�:�8�:�,�,�0�0�h�0�?�?��D�D�
�B�Y�Y��q�6�6�:�:�8�:�,�,�0�0�h�0�?�?��D�D�
�S�D�[�[��q�6�6�:�:�8�:�,�,�0�0�h�0�?�?��D�D�
�&�
&�
&�)�!�,�,�,��?�@�@�@�	�T���a���
�����q�
�
�
�
�2�
�
�
�
��*�"�d�d�A�G�G�-�.�.�
.��#�:�:��A���
�
��
�"�"�A�A�
�S�D�[�[��A���
�
��
�"�"�A�A�
�A�X�X��a����!��$�$�A�A�
�A�X�X��A���
�
��
�"�"�A�A�
�I�
�
��S��V�V�\�\�!�_�_�(�(�a�(�0�0�1�1�A�A�
K��a������
K�
K�
K� �!B�C�C��J�����
K�������Q�����c�*�*�.�.�A�.�6�6��C��@�@�A��1�i� � �	��9�9�;�;�$�$�&�&�&�
�Q��_�_�	��3�9�9�;�;���7�7�9�9���A�B�B�Bs0�%A5�5
B�?B�B�O�
O&�O!�!O&)NN)�__doc__�numpyr
�scipy.sparser�scipy.sparse.linalgr�sparser
rrr�__all__rr�rr�<module>rBs���������!�!�!�!�!�!�$�$�$�$�$�$������� � � � � � � � � � ��(�� � � �
nC�nC�nC�nC�nC�nCr

Youez - 2016 - github.com/yon3zu
LinuXploit