403Webshell
Server IP : 93.86.61.54  /  Your IP : 216.73.216.156
Web Server : Apache/2.4.62 (Ubuntu)
System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64
User : www-data ( 33)
PHP Version : 8.4.22
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
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-310.pyc
o

��Eb+�@sHdZddlZddlmZddlmZmZmZdgZdd�Z	d	dd�Z
dS)
zSparse matrix norms.

�N)�issparse)�Inf�sqrt�abs�normcCs@t�|jtj�rt|��d���}t|�S|�d���}t|�S)N�)�np�
issubdtype�dtype�complexfloatingr�power�sumr)�x�sqnorm�r�;/usr/lib/python3/dist-packages/scipy/sparse/linalg/_norm.py�_sparse_frobenius_norms
�rc
Cst|�std��|dur|dvrt|�S|��}|durd}n*t|t�sId}zt|�}Wnty=}zt|�|�d}~ww||krFt|��|f}d}t|�dkr�|\}}||kr`|krnnn||krm|kswntd||j	f��||||kr�td��|dkr�t
�|d	kr�t
�|d
kr�t|�j|d�j
|d�dS|tkr�t|�j|d�j
|d�dS|d
kr�t|�j|d�j|d�dS|tkr�t|�j|d�j|d�dS|dvr�t|�Std��t|�d
k�r|\}	||	kr�|k�sntd||j	f��|tk�rt|�j
|	d�}
nh|tk�r!t|�j|	d�}
nY|dk�r/|dkj|	d�}
nK|d
k�r=t|�j|	d�}
n=|dv�rPtt|��d�j|	d��}
n*z|d
Wnt�yh}ztd�|�d}~wwt�t|��|�j|	d�d
|�}
|
j��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/master/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      Not implemented
    -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

    z*input is not sparse. use numpy.linalg.normN)N�fro�f)r�z6'axis' must be None, an integer or a tuple of integersrz*Invalid axis %r for an array with shape %rzDuplicate axes given.���r)�axis)rr���)Nrrz Invalid norm order for matrices.r)rNzInvalid norm order for vectors.z&Improper number of dimensions to norm.)r�	TypeErrorr�tocsr�
isinstance�tuple�int�len�
ValueError�shape�NotImplementedErrorrr
�maxr�minrrr�A�ravel)r�ordr�msg�int_axis�e�nd�row_axis�col_axis�a�Mrrrrs�X

��2�
�




��"
)NN)�__doc__�numpyr�scipy.sparserrrr�__all__rrrrrr�<module>s

Youez - 2016 - github.com/yon3zu
LinuXploit