+
    ùª¨j0  ã                   óˆ   € R t ^ RIt^ RIHt R.tRR ltR t]R 4       t]R 4       t	R t
R	 tR
 tR tRR ltR tR tR tR# )zSparse block 1-norm estimator.
N)ÚaslinearoperatorÚ
onenormestc                ó^  € \        V 4      p V P                  ^ ,          V P                  ^,          8w  d   \        R4      hV P                  ^,          pW8¼  Ed   \        P                  ! \        V 4      P                  \        P                  ! V4      4      4      pVP                  WU38w  d'   \        RR\        VP                  4      ,           4      h\        V4      P                  ^ R7      pVP                  V38w  d'   \        RR\        VP                  4      ,           4      h\        P                  ! V4      p\        WX4      p	VRV3,          p
Wx,          pM\        W P                  W4      w  r¹r¬pV'       g	   V'       d(   V3pV'       d
   Wé3,          pV'       d
   Wê3,          pV# V# )aÆ  
Compute a lower bound of the 1-norm of a sparse array.

Parameters
----------
A : ndarray or other linear operator
    A linear operator that can be transposed and that can
    produce matrix products.
t : int, optional
    A positive parameter controlling the tradeoff between
    accuracy versus time and memory usage.
    Larger values take longer and use more memory
    but give more accurate output.
itmax : int, optional
    Use at most this many iterations.
compute_v : bool, optional
    Request a norm-maximizing linear operator input vector if True.
compute_w : bool, optional
    Request a norm-maximizing linear operator output vector if True.

Returns
-------
est : float
    An underestimate of the 1-norm of the sparse array.
v : ndarray, optional
    The vector such that ||Av||_1 == est*||v||_1.
    It can be thought of as an input to the linear operator
    that gives an output with particularly large norm.
w : ndarray, optional
    The vector Av which has relatively large 1-norm.
    It can be thought of as an output of the linear operator
    that is relatively large in norm compared to the input.

Notes
-----
This is algorithm 2.4 of [1]_.

In [2]_ it is described as follows.
"This algorithm typically requires the evaluation of
about 4t matrix-vector products and almost invariably
produces a norm estimate (which is, in fact, a lower
bound on the norm) correct to within a factor 3."

.. versionadded:: 0.13.0

References
----------
.. [1] Nicholas J. Higham and Francoise Tisseur (2000),
       "A Block Algorithm for Matrix 1-Norm Estimation,
       with an Application to 1-Norm Pseudospectra."
       SIAM J. Matrix Anal. Appl. Vol. 21, No. 4, pp. 1185-1201.

.. [2] Awad H. Al-Mohy and Nicholas J. Higham (2009),
       "A new scaling and squaring algorithm for the matrix exponential."
       SIAM J. Matrix Anal. Appl. Vol. 31, No. 3, pp. 970-989.

Examples
--------
>>> import numpy as np
>>> from scipy.sparse import csc_array
>>> from scipy.sparse.linalg import onenormest
>>> A = csc_array([[1., 0., 0.], [5., 8., 2.], [0., -1., 0.]], dtype=float)
>>> A.toarray()
array([[ 1.,  0.,  0.],
       [ 5.,  8.,  2.],
       [ 0., -1.,  0.]])
>>> onenormest(A)
9.0
>>> np.linalg.norm(A.toarray(), ord=1)
9.0
z1expected the operator to act like a square matrixzinternal error: zunexpected shape ©ÚaxisºNNN)r   ÚshapeÚ
ValueErrorÚnpÚasarrayÚmatmatÚidentityÚ	ExceptionÚstrÚabsÚsumÚargmaxÚelementary_vectorÚ_onenormest_coreÚH)ÚAÚtÚitmaxÚ	compute_vÚ	compute_wÚnÚ
A_explicitÚcol_abs_sumsÚargmax_jÚvÚwÚestÚnmultsÚ
nresamplesÚresults   &&&&&          Ú[C:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\scipy\sparse\linalg\_onenormest.pyr   r      sd  € ôT 	˜Ó€AØ‡w�wˆq…z�Q—W‘W˜Q•ZÔÜÐLÓMÐMð
 	
�‰��
€AØ…vÜ—Z’ZÔ 0°Ó 3× :Ñ :¼2¿;º;Àq»>Ó JÓKˆ
Ø×Ñ ˜vÔ%ÜÐ.Ø'¬#¨j×.>Ñ.>Ó*?Õ?óAð Aä˜:“×*Ñ*°Ð*Ó2ˆØ×Ñ ! Ô&ÜÐ.Ø'¬#¨l×.@Ñ.@Ó*AÕAóCð Cä—9’9˜\Ó*ˆÜ˜aÓ*ˆØ�q˜(�{Õ#ˆØÕ$‰ä(8¸¿C¹CÀÓ(JÑ%ˆ�˜:÷ —IØ�ˆßØ�d�NˆFßØ�d�NˆFØˆàˆ
ó    c                ó   a a€ RoVV 3R lpV# )z…
Decorator for an elementwise function, to apply it blockwise along
first dimension, to avoid excessive memory usage in temporaries.
c                 ó~  <€ V P                   ^ ,          S8  d	   S! V 4      # S! V RS 4      p\        P                  ! V P                   ^ ,          3VP                   R,          ,           VP                  R7      pWRS% ?\	        SV P                   ^ ,          S4       F  pS! WVS,            4      W#VS,           % K  	  V# )é    N:é   NN©Údtype)r   r
   Úzerosr,   Úrange)ÚxÚy0ÚyÚjÚ
block_sizeÚfuncs   &   €€r%   ÚwrapperÚ%_blocked_elementwise.<locals>.wrapper€   sŸ   ø€ Ø�7‰7�1�:˜
Ô"Ù˜“7ˆNá�a˜˜�nÓ%ˆBÜ—’˜!Ÿ'™' !�*˜¨¯©°"­Õ5¸R¿X¹XÔFˆAØˆkˆzˆNØÜ˜: q§w¡w¨q¥z°:Ö>�Ù$(¨¨Q¨z­\Ð):Ó$;��A�j•LÒ!ñ ?àˆHr&   é   © )r4   r5   r3   s   f @r%   Ú_blocked_elementwiser9   y   s   ù€ ð
 €Jö
ð €Nr&   c                ón   € V P                  4       p^W^ 8H  &   V\        P                  ! V4      ,          pV# )a!  
This should do the right thing for both real and complex matrices.

From Higham and Tisseur:
"Everything in this section remains valid for complex matrices
provided that sign(A) is redefined as the matrix (aij / |aij|)
(and sign(0) = 1) transposes are replaced by conjugate transposes."

)Úcopyr
   r   )ÚXÚYs   & r%   Úsign_round_upr>   Ž   s0   € ð 	
�‰‹€AØ€Aˆ1�f�IØŒ�Š�‹…N€AØ€Hr&   c                 óZ   € \         P                  ! \         P                  ! V 4      ^R7      # )r*   r   )r
   Úmaxr   )r<   s   &r%   Ú_max_abs_axis1rA   Ÿ   s   € ä�6Š6”"—&’&˜“) !Ô$Ð$r&   c           	      óà   € RpRp\        ^ V P                  ^ ,          V4       FG  p\        P                  ! \        P                  ! WW1,            4      ^ R7      pVf   TpK?  W$,          pKI  	  V# )é   Nr   r7   )r.   r   r
   r   r   )r<   r3   Úrr2   r1   s   &    r%   Ú_sum_abs_axis0rE   ¤   s_   € Ø€JØ€AÜ�1�a—g‘g˜a•j *Ö-ˆÜ�FŠF”2—6’6˜!˜a�lÐ+Ó,°1Ô5ˆØŠ9ØŠAà�FŠAñ .ð €Hr&   c                 óF   € \         P                  ! V \        R 7      p^W!&   V# )r+   )r
   r-   Úfloat)r   Úir   s   && r%   r   r   °   s   € Ü
�Š�œ%Ô €AØ€A�DØ€Hr&   c                 óÈ   € V P                   ^8w  g   V P                  VP                  8w  d   \        R4      hV P                  ^ ,          p\        P                  ! W4      V8H  # )r*   z2expected conformant vectors with entries in {-1,1})Úndimr   r	   r
   Údot)r   r    r   s   && r%   Úvectors_are_parallelrL   ¶   sJ   € ð 	‡v�v�„{�a—g‘g §¡Ô(ÜÐMÓNÐNØ	�‰��
€AÜ�6Š6�!‹<˜1ÑÐr&   c                 óÜ   a€ V P                    FZ  o\        ;QJ d)    V3R  lVP                    4       F  '       g   K   RM	  RM! V3R  lVP                    4       4      '       d   KY   R# 	  R# )c              3   ó<   <"  € T F  p\        SV4      x € K  	  R # 5i©N©rL   ©Ú.0r    r   s   & €r%   Ú	<genexpr>Ú;every_col_of_X_is_parallel_to_a_col_of_Y.<locals>.<genexpr>Â   s   øé € Ð;±s°!Ô'¨¨1×-Ð-³sùó   ƒTF)ÚTÚany)r<   r=   r   s   &&@r%   Ú(every_col_of_X_is_parallel_to_a_col_of_YrX   À   sB   ø€ Ø�SŒSˆß‹sÔ;°q·s²sÓ;�s�sŠsÔ;°q·s²sÓ;×;Ô;Úñ ñ r&   c                 óœ  aa€ SP                   w  r4SR V 3,          o\        ;QJ d)    VV3R l\        V 4       4       F  '       g   K   RM	  RM! VV3R l\        V 4       4       4      '       d   R# VeW   \        ;QJ d)    V3R lVP                   4       F  '       g   K   RM	  RM! V3R lVP                   4       4      '       d   R# R# )r   c              3   óN   <"  € T F  p\        SSR V3,          4      x € K  	  R# 5i)r   NrP   )rR   r2   r<   r   s   & €€r%   rS   Ú*column_needs_resampling.<locals>.<genexpr>Í   s$   øé € Ð
>±X°Ô  1 Q¨ T¥7×+Ð+³Xùs   ƒ"%TFc              3   ó<   <"  € T F  p\        SV4      x € K  	  R # 5irO   rP   rQ   s   & €r%   rS   r[   Ð   s   øé € Ð7±3¨aÔ# A q×)Ð)³3ùrU   )r   rW   r.   rV   )rH   r<   r=   r   r   r   s   &f&  @r%   Úcolumn_needs_resamplingr]   Ç   s}   ù€ ð �7‰7�D€AØ	ˆ!ˆQˆ$�€Aß
ƒsÕ
>´U¸1´XÓ
>‡s‡s‚sÕ
>´U¸1´XÓ
>×>Ò>ÙØ‚}ß‹3Ô7°1·3²3Ó7�3�3Š3Ô7°1·3²3Ó7×7Ò7ÙÙr&   c                 ó’   € \         P                  P                  ^ ^VP                  ^ ,          R7      ^,          ^,
          VRV 3&   R# )r)   )Úsizer   N)r
   ÚrandomÚrandintr   )rH   r<   s   &&r%   Úresample_columnrb   Õ   s7   € Ü�i‰i×Ñ  1¨1¯7©7°1­:ÐÓ6°qÕ8¸1Õ<€A€aˆ€dƒGr&   c                 óF   € \         P                  ! W4      ;'       g    W8  # rO   )r
   Úallclose)ÚaÚbs   &&r%   Úless_than_or_closerg   Ù   s   € Ü�;Š;�qÓ×'Ð' ¡Ð'r&   c                ó¶  € \        V 4      p\        V4      pV^8  d   \        R4      hV^8  d   \        R4      hV P                  ^ ,          pW&8¼  d   \        R4      h^ p^ p\        P                  ! Wb3\
        R7      p	V^8”  dX   \        ^V4       F  p
\        W©4       K  	  \        V4       F*  p
\        W©4      '       g   K  \        W©4       V^,          pK)  	  V	\        V4      ,          p	\        P                  ! ^ \        P                  R7      p^ p\        P                  ! Wb3\
        R7      p^pRp \        P                  ! VP                  V	4      4      pV^,          p\        V4      p\        P                  ! V4      p\        P                  ! V4      pVV8”  g   V^8X  d   V^8¼  d
   VV,          pVRV3,          pV^8¼  d   VV8:  d   TpEMïTpTpWã8”  d   EMã\!        V4      p?\#        VV4      '       d   EMÃV^8”  d;   \        V4       F+  p
\        W­V4      '       g   K  \        W­4       V^,          pK*  	  ?\        P                  ! VP                  V4      4      pV^,          p\%        V4      p?V^8¼  d   \        V4      VX,          8X  d   EM'\        P&                  ! V4      RRR1,          RV\)        V4      ,            P+                  4       p?V^8”  dm   \        P,                  ! VRV V4      P/                  4       '       d   M¯\        P,                  ! Wû4      p\        P0                  ! VV( ,          VV,          34      p\        V4       F  p\3        WoV,          4      V	RV3&   K  	  VRV \        P,                  ! VRV V4      ( ,          p\        P0                  ! VV34      pV^,          pEK�  \3        VX4      pVVXWx3# )aj  
Compute a lower bound of the 1-norm of a sparse array.

Parameters
----------
A : ndarray or other linear operator
    A linear operator that can produce matrix products.
AT : ndarray or other linear operator
    The transpose of A.
t : int, optional
    A positive parameter controlling the tradeoff between
    accuracy versus time and memory usage.
itmax : int, optional
    Use at most this many iterations.

Returns
-------
est : float
    An underestimate of the 1-norm of the sparse array.
v : ndarray, optional
    The vector such that ||Av||_1 == est*||v||_1.
    It can be thought of as an input to the linear operator
    that gives an output with particularly large norm.
w : ndarray, optional
    The vector Av which has relatively large 1-norm.
    It can be thought of as an output of the linear operator
    that is relatively large in norm compared to the input.
nmults : int, optional
    The number of matrix products that were computed.
nresamples : int, optional
    The number of times a parallel column was observed,
    necessitating a re-randomization of the column.

Notes
-----
This is algorithm 2.4.

z$at least two iterations are requiredzat least one column is requiredz't should be smaller than the order of Ar+   Nr   éÿÿÿÿ)r   r	   r   r
   ÚonesrG   r.   rb   r]   r-   Úintpr   r   rE   r@   r   r>   rX   rA   ÚargsortÚlenr;   ÚisinÚallÚconcatenater   )r   ÚATr   r   ÚA_linear_operatorÚAT_linear_operatorr   r"   r#   r<   rH   Úind_histÚest_oldÚSÚkÚindr=   Úmagsr!   Úbest_jÚind_bestr    ÚS_oldÚZÚhÚseenr2   Únew_indr   s   &&&&                         r%   r   r   Ý   s[  € ôR )¨Ó+ÐÜ)¨"Ó-ÐØˆq„yÜÐ?Ó@Ð@Øˆ1„uÜÐ:Ó;Ð;Ø	�‰��
€AØ„vÜÐBÓCÐCð €FØ€Jô 	�Š��œeÔ$€Að 	ˆ1„uÜ�q˜!–ˆAô ˜AÖ!ñ ô �q–ˆAÜ)¨!×/Ô/Ü Ô%Ø˜a•’
ñ ð
 Œˆq‹…M€Aä�xŠx˜¤§¡Ô)€HØ€GÜ
�Š�!�œuÔ%€AØ	€AØ
€CØ
Ü�JŠJÐ(×/Ñ/°Ó2Ó3ˆØ�!�ˆÜ˜aÓ ˆÜ�fŠf�T‹lˆÜ—’˜4“ˆØ�Œ=˜A œFØ�AŒvØ˜v�;�Ø�!�V�)•ˆAà�Œ6�c˜W”nØˆCÙØˆØˆØŒ9ÙÜ˜!ÓˆØä3°A°u×=Ò=ÙØˆqŒ5ô ˜1–X�Ü-¨a°E×:Ô:Ü# AÔ)Ø !•O’Jñ ð ä�JŠJÐ)×0Ñ0°Ó3Ó4ˆØ�!�ˆÜ˜1ÓˆØà�Œ6”c˜!“f  (¥Ô+Ùô �jŠj˜‹m™D˜b˜DÕ!Ð"2 1¤S¨£]¥?Ð3×8Ñ8Ó:ˆØØˆqŒ5ô �wŠw�s˜2˜A�w Ó)×-Ñ-×/Ò/Øô —7’7˜3Ó)ˆDÜ—.’. # t e¥*¨c°$­iÐ!8Ó9ˆCÜ�q–ˆAÜ'¨¨q­6Ó2ˆAˆa�ˆd‹Gñ ð �b�q�'œ2Ÿ7š7 3 r¨ 7¨HÓ5Ð5Õ6ˆÜ—>’> 8¨WÐ"5Ó6ˆØ	ˆQ�‹Ü˜!˜XÓ&€AØ��1�fÐ(Ð(r&   )rC   é   FFrO   )Ú__doc__Únumpyr
   Úscipy.sparse.linalgr   Ú__all__r   r9   r>   rA   rE   r   rL   rX   r]   rb   rg   r   r8   r&   r%   Ú<module>r†      sx   ðñó Ý 0ð ˆ.€ôkò\ð* ñó ðð  ñ%ó ð%ò	òòòôò=ò(ôO)r&   