+
    ùª¨jl  ã                   ón   € R t ^ RIt^ RIHt ^ RIHt ^ RIHt ^ RIH	t
 ^ RIHtHt R.tR tR
R ltR	 tR# )zSparse matrix norms.

N)Úissparse)Úsvds)Úconvert_pydata_sparse_to_scipy)ÚsqrtÚabsÚnormc                 ó~   € \         P                  P                  V 4      p\        P                  P                  V4      # )N)ÚspÚ_sputilsÚ_todataÚnpÚlinalgr   )ÚxÚdatas   & ÚUC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\scipy\sparse\linalg\_norm.pyÚ_sparse_frobenius_normr      s)   € Ü�;‰;×Ñ˜qÓ!€DÜ�9‰9�>‰>˜$ÓÐó    c                óŠ	  € \        V RR7      p \        V 4      '       g   \        R4      hVf   VR9   d   \        V 4      # V P                  R8X  d   V P                  4       p Vf    \        \        V P                  4      4      pM8\        V\        4      '       g#   Rp \        V4      pY$8w  d   \        T4      hT3pV P                  p\        V4      ^8X  EdÒ   Vw  rxV) Tu;8:  d   V8  d   M MV) Tu;8:  d   V8  g"   M RV: RV P                  : 2p	\        V	4      hWv,          W†,          8X  d   \        R	4      hV^8X  d   \        V ^R
RR7      w  r«p
V^ ,          # VR8X  d   \        hVR9   d   \        V 4      # \         P"                  ! V P$                  \&        4      '       d   V P)                  \&        RR7      p V^8X  d*   \+        V 4      P-                  VR7      P/                  4       # V\         P0                  8X  d*   \+        V 4      P-                  VR7      P/                  4       # VR8X  d*   \+        V 4      P-                  VR7      P3                  4       # V\         P0                  ) 8X  d*   \+        V 4      P-                  VR7      P3                  4       # \        R4      h\        V4      ^8X  EdÂ   Vw  pV) Tu;8:  d   V8  g"   M RV: RV P                  : 2p	\        V	4      hV^ 8X  d   V P5                  VR7      # \         P"                  ! V P$                  \&        4      '       d   V P)                  \&        RR7      p V\         P0                  8X  d%   \7        \+        V 4      P/                  VR7      4      # V\         P0                  ) 8X  d%   \7        \+        V 4      P3                  VR7      4      # V^8X  d%   \7        \+        V 4      P-                  VR7      4      # VR9   d=   \7        \9        \+        V 4      P;                  ^4      P-                  VR7      4      4      #  V^,            \         P:                  ! \+        T 4      P;                  T4      P-                  TR7      ^T,          4      # \        R4      h  \         d   p\        T4      ThRp?ii ; i  \         d   p\        R4      ThRp?ii ; i)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 array
    Input sparse array.
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
    The selected norm of `x`.

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

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 arrays
=====  ============================
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 csr_array, diags_array
>>> 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_array(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_array([-1, 1], offsets=[0, 1], shape=(9, 10))
>>> norm(b, 2)
1.9753...
Úcsr)Útarget_formatz*input is not sparse. use numpy.linalg.normNÚdiaz6'axis' must be None, an integer or a tuple of integerszInvalid axis z for an array with shape zDuplicate axes given.Úarpack)ÚkÚsolverÚrngF)Úcopy)Úaxisz Invalid norm order for matrices.zInvalid norm order for vectors.z&Improper number of dimensions to norm.)NÚfroÚféþÿÿÿ)Nr   r   éÿÿÿÿ)é   N)r   r   Ú	TypeErrorr   ÚformatÚtocsrÚtupleÚrangeÚndimÚ
isinstanceÚintÚlenÚshapeÚ
ValueErrorr   ÚNotImplementedErrorr   Úcan_castÚdtypeÚfloatÚastyper   ÚsumÚmaxÚinfÚminÚcount_nonzeroÚ_ravelr   Úpower)r   Úordr   ÚmsgÚint_axisÚeÚndÚrow_axisÚcol_axisÚmessageÚ_ÚsÚas   &&&          r   r   r      sÝ  € ô~ 	' q¸Ô>€AÜ�A�;Š;ÜÐDÓEÐEð ‚|˜Ð1Ô1Ü% aÓ(Ð(ð 	‡x�x�5ÔØ�G‰G‹Iˆà‚|Ü”U˜1Ÿ6™6“]Ó#‰Ü˜œe×$Ò$ØFˆð	(Ü˜4“yˆHð ÔÜ˜C“.Ð Øˆ{ˆà	
�‰€BÜ
ˆ4ƒy�A…~Ø!ÑˆØ��xÖ$ "×$¨"¨°Ö)=¸2Ö)=Ø% d¡XÐ-FÀqÇwÁwÁkÐRˆGÜ˜WÓ%Ð%Ø�=˜H�MÔ)ÜÐ4Ó5Ð5Ø�!Œ8Ü˜1 ¨(¸Ô=‰GˆA�!Ø�Q•4ˆKØ�"Œ9Ü%Ð%àÐ$Ô$ä)¨!Ó,Ð,Ü�;Š;�q—w‘w¤×&Ò&Ø—‘œ U�Ó+ˆAØ�!Œ8Ü�q“6—:‘: 8�:Ó,×0Ñ0Ó2Ð2Ø”B—F‘FŒ]Ü�q“6—:‘: 8�:Ó,×0Ñ0Ó2Ð2Ø�BŒYÜ�q“6—:‘: 8�:Ó,×0Ñ0Ó2Ð2Ø”R—V‘V�GŒ^Ü�q“6—:‘: 8�:Ó,×0Ñ0Ó2Ð2äÐ?Ó@Ð@Ü	ˆT‹�a�Ø‰ˆØ��q–˜2–Ø% d¡XÐ-FÀqÇwÁwÁkÐRˆGÜ˜WÓ%Ð%Ø�!Œ8Ø—?‘?¨�?Ó*Ð*Ü�;Š;�q—w‘w¤×&Ò&Ø—‘œ U�Ó+ˆAØ”"—&‘&Œ=Üœ#˜a›&Ÿ*™*¨!˜*Ó,Ó-Ð-Ø”2—6‘6�'Œ>Üœ#˜a›&Ÿ*™*¨!˜*Ó,Ó-Ð-Ø�!Œ8äœ#˜a›&Ÿ*™*¨!˜*Ó,Ó-Ð-Ø�)ÔÜœ$œs 1›vŸ|™|¨A›×2Ñ2¸Ð2Ó:Ó;Ó<Ð<ð	GØ�!ŽGô �xŠxœ˜A›Ÿ™ SÓ)×-Ñ-°1Ð-Ó5°q¸3µwÓ?Ð?äÐAÓBÐBøôw ô 	(Ü˜C“. aÐ'ûð	(ûôn ô 	GÜÐ>Ó?ÀQÐFûð	Gús0   ÂR Ð-	R& ÒR#ÒRÒR#Ò&SÒ1R=Ò=Sc                 óÚ   € \        V R 4      '       d   V P                  4       P                  4       # \        V R4      '       d   V P                  P                  4       # V P                  4       # )ÚtoarrayÚA)ÚhasattrrE   ÚravelrF   )ÚMs   &r   r7   r7   Ã   sK   € Üˆq�)×ÒØ�y‰y‹{× Ñ Ó"Ð"Ü	��C�ŠØ�s‰s�y‰y‹{Ðà�w‰w‹yÐr   )NN)Ú__doc__Únumpyr   Úscipy.sparser   Úscipy.sparse.linalgr   Úscipy.sparse._sputilsr   Úsparser	   r   r   Ú__all__r   r   r7   © r   r   Ú<module>rR      s7   ðñó Ý !Ý $Ý @Ý ç àˆ(€ò ô
lCô^r   