+
    øª¨je6  ã                   óÂ   € R t ^ RIHtHtHtHt ^ RIHt ^ RIt	^ RIt	 ^ RI
HtHt Rt^ RIt^ RIHtHt RR	.tR
 tR tR tR tR tRR ltR#   ] d
    ^ RItRt L5i ; i)z1Basic linear factorizations needed by the solver.)Úblock_arrayÚ	csc_arrayÚ	eye_arrayÚissparse)ÚLinearOperatorN)Úcholesky_AAtÚCholmodTypeConversionWarningTF)ÚwarnÚcatch_warningsÚorthogonalityÚprojectionsc                óš  € \         P                  P                  V4      p\        V 4      '       d-   \        P
                  P                  P                  V RR7      pM!\         P                  P                  V RR7      pV^ 8X  g   V^ 8X  d   ^ # \         P                  P                  V P                  V4      4      pWCV,          ,          pV# )a_  Measure orthogonality between a vector and the null space of a matrix.

Compute a measure of orthogonality between the null space
of the (possibly sparse) matrix ``A`` and a given vector ``g``.

The formula is a simplified (and cheaper) version of formula (3.13)
from [1]_.
``orth =  norm(A g, ord=2)/(norm(A, ord='fro')*norm(g, ord=2))``.

References
----------
.. [1] Gould, Nicholas IM, Mary E. Hribar, and Jorge Nocedal.
       "On the solution of equality constrained quadratic
        programming problems arising in optimization."
        SIAM Journal on Scientific Computing 23.4 (2001): 1376-1395.
Úfro)Úord)ÚnpÚlinalgÚnormr   ÚscipyÚsparseÚdot)ÚAÚgÚnorm_gÚnorm_AÚnorm_A_gÚorths   &&    ÚjC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\scipy\optimize\_trustregion_constr\projections.pyr   r      s‘   € ô$ �Y‰Y�^‰^˜AÓ€Fä�‡{‚{Ü—‘×$Ñ$×)Ñ)¨!°Ð)Ó7‰ä—‘—‘  u�Ó-ˆð �„{�f ”kÙä�y‰y�~‰~˜aŸe™e A›hÓ'€Hà˜f•}Õ%€DØ€Kó    c                óÀ   a aaa	€ \        R\        R7      ;_uu_ 4        \        S 4      o	RRR4       V V	VV3R lpV V	3R lpV V	3R lpWgV3#   + '       g   i     L+; i)zLReturn linear operators for matrix A using ``NormalEquation`` approach.
    Úignore)ÚactionÚcategoryNc                 ó<  <€ S! SP                  V 4      4      pV SP                  P                  V4      ,
          p^ p\        SV4      S8”  dO   VS8¼  d    V# S! SP                  V4      4      pVSP                  P                  V4      ,
          pV^,          pK_  V# )é    ©r   ÚTr   )ÚxÚvÚzÚkr   ÚfactorÚ	max_refinÚorth_tols   &   €€€€r   Ú
null_spaceÚ/normal_equation_projections.<locals>.null_spaceD   sˆ   ø€ Ù�1—5‘5˜“8ÓˆØ�—‘—‘˜“
�Nˆð ˆÜ˜A˜qÓ! HÔ,Ø�IŒ~Øð ˆñ	 �q—u‘u˜Q“xÓ ˆAØ�A—C‘C—G‘G˜A“J•ˆAØ��FŠAàˆr   c                 ó2   <€ S! SP                  V 4      4      # ©N©r   ©r&   r   r*   s   &€€r   Úleast_squaresÚ2normal_equation_projections.<locals>.least_squaresV   s   ø€ Ù�a—e‘e˜A“hÓÐr   c                 óF   <€ SP                   P                  S! V 4      4      # r0   ©r%   r   r2   s   &€€r   Ú	row_spaceÚ.normal_equation_projections.<locals>.row_spaceZ   s   ø€ Ø�s‰s�w‰w‘v˜a“yÓ!Ð!r   )r
   r   r   )
r   ÚmÚnr,   r+   Útolr-   r3   r7   r*   s
   f&&ff&   @r   Únormal_equation_projectionsr<   9   sM   û€ ô 
˜xÔ2N×	OÖ	OÜ˜a“ˆ÷ 
P÷ð ö$ ö"ð  iÐ/Ð/÷; 
P×	Oús   žAÁA	c           	     óf  a aaaaa	a
€ \        \        S4      S P                  .S R..RR7      o	 \        P                  P
                  P                  S	4      o
T T	TTTTT
3R lpTTT
3R lpTT
3R lpYgT3#   \         d/    \        R^R7       \        S P                  4       SSSST4      u # i ; i)	z;Return linear operators for matrix A - ``AugmentedSystem``.NÚcsc)ÚformatzVSingular Jacobian matrix. Using dense SVD decomposition to perform the factorizations.©Ú
stacklevelc                 ó$  <€ \         P                  ! V \         P                  ! S	4      .4      pS! V4      pVR S p^ p\        SV4      S8”  dC   VS
8¼  d    V# VSP	                  V4      ,
          pS! V4      pW&,          pVR S pV^,          pKS  V# r0   )r   ÚhstackÚzerosr   r   )r&   r'   Úlu_solr(   r)   Únew_vÚ	lu_updater   ÚKr9   r+   r:   r,   Úsolves   &      €€€€€€€r   r-   Ú0augmented_system_projections.<locals>.null_spacev   s¡   ø€ ô �IŠI�qœ"Ÿ(š( 1›+Ð&Ó'ˆñ �q“ˆØ�2�AˆJˆð ˆÜ˜A˜qÓ! HÔ,Ø�IŒ~Øð ˆð ˜Ÿ™˜f›Õ%ˆEñ ˜e›ˆIð ÕˆFØ�r˜�
ˆAØ��FŠAð ˆr   c                 ó„   <€ \         P                  ! V \         P                  ! S4      .4      pS! V4      pVSSS,            # r0   ©r   rC   rD   )r&   r'   rE   r9   r:   rI   s   &  €€€r   r3   Ú3augmented_system_projections.<locals>.least_squares˜   s;   ø€ ô �IŠI�qœ"Ÿ(š( 1›+Ð&Ó'ˆñ �q“ˆà�a˜˜!�ˆ}Ðr   c                 óv   <€ \         P                  ! \         P                  ! S4      V .4      pS! V4      pVR S # r0   rL   )r&   r'   rE   r:   rI   s   &  €€r   r7   Ú/augmented_system_projections.<locals>.row_space¦   s7   ø€ ô �IŠI”r—x’x “{ AÐ&Ó'ˆñ �q“ˆà�b�qˆzÐr   )r   r   r%   r   r   r   Ú
factorizedÚRuntimeErrorr	   Úsvd_factorization_projectionsÚtoarray)r   r9   r:   r,   r+   r;   r-   r3   r7   rH   rI   s   fffff&   @@r   Úaugmented_system_projectionsrT   `   s­   þ€ ô 	”i “l A§C¡CÐ(¨1¨d¨)Ð4¸UÔC€Að
=Ü—‘×#Ñ#×.Ñ.¨qÓ1ˆ÷ó ÷Döð  iÐ/Ð/øôM ô =Üð +àõ	ô -¨Q¯Y©Y«[Ø-.°°8Ø-6¸ó=ò 	=ð	=ús   ¯)A7 Á76B0Â/B0c                ó`  a aaaa	a
a€ \         P                  P                  S P                  RRR7      w  o
oo	\        P                  P                  SR,          \        P                  4      V8  d   \        R	^R7       \        S SVSSV4      # V V	V
VVVV3R lpV	V
VV3R lpV	V
V3R lpWgV3# )
zMReturn linear operators for matrix A using ``QRFactorization`` approach.
    TÚeconomic)ÚpivotingÚmoder@   c                 ó  <€ SP                   P                  V 4      p\        P                  P	                  S	VR R7      p\
        P                  ! S
4      pW#S&   V SP                   P                  V4      ,
          p^ p\        SV4      S8”  dy   VS8¼  d    V# SP                   P                  V4      p\        P                  P	                  S	VR R7      pW#S&   VSP                   P                  V4      ,
          pV^,          pK‰  V# ©F)Úlower)r%   r   r   r   Úsolve_triangularr   rD   r   )r&   Úaux1Úaux2r'   r(   r)   r   ÚPÚQÚRr9   r+   r,   s   &     €€€€€€€r   r-   Ú0qr_factorization_projections.<locals>.null_spaceÃ   s×   ø€ à�s‰s�w‰w�q‹zˆÜ�|‰|×,Ñ,¨Q°¸EÐ,ÓBˆÜ�HŠH�Q‹KˆØˆ!‰Ø�—‘—‘˜“
�Nˆð ˆÜ˜A˜qÓ! HÔ,Ø�IŒ~Øð ˆð —3‘3—7‘7˜1“:ˆDÜ—<‘<×0Ñ0°°DÀÐ0ÓFˆDØˆa‰Dà�A—C‘C—G‘G˜A“J•ˆAØ��FŠAàˆr   c                 ó¶   <€ SP                   P                  V 4      p\        P                  P	                  SVR R7      p\
        P                  ! S4      pW#S&   V# rZ   )r%   r   r   r   r\   r   rD   )r&   r]   r^   r(   r_   r`   ra   r9   s   &   €€€€r   r3   Ú3qr_factorization_projections.<locals>.least_squaresÜ   sH   ø€ à�s‰s�w‰w�q‹zˆÜ�|‰|×,Ñ,¨Q°¸EÐ,ÓBˆÜ�HŠH�Q‹KˆØˆ!‰Øˆr   c                 ó‚   <€ V S,          p\         P                  P                  SVR RR7      pSP                  V4      pV# )Fr%   )r[   Útrans)r   r   r\   r   )r&   r]   r^   r(   r_   r`   ra   s   &   €€€r   r7   Ú/qr_factorization_projections.<locals>.row_spaceå   sC   ø€ à��tˆÜ�|‰|×,Ñ,¨Q°Ø38Ø36ð -ó 8ˆð �E‰E�$‹KˆØˆr   )éÿÿÿÿºNNNzPSingular Jacobian matrix. Using SVD decomposition to perform the factorizations.)	r   r   Úqrr%   r   r   Úinfr	   rR   )r   r9   r:   r,   r+   r;   r-   r3   r7   r_   r`   ra   s   ff&ff&   @@@r   Úqr_factorization_projectionsrl   ³   sš   þ€ ô �l‰l�o‰o˜aŸc™c¨D°zˆoÓB�G€A€qˆ!ä	‡y�y‡~�~�a˜•h¤§¡Ó'¨#Ô-Üð +àõ	ô -¨Q°°1Ø-5Ø-6Ø-0ó2ð 	2÷ó ÷2ð ÷ð  iÐ/Ð/r   c                óæ   a aaa	a
a€ \         P                  P                  S RR7      w  o	oo
S	RSV8„  3,          o	S
SV8„  R3,          o
SSV8„  ,          oV V	V
VVV3R lpV	V
V3R lpV	V
V3R lpWgV3# )zNReturn linear operators for matrix A using ``SVDFactorization`` approach.
    F)Úfull_matricesri   c                 ó¨  <€ SP                  V 4      p^S,          V,          pSP                  V4      pV SP                  P                  V4      ,
          p^ p\        SV4      S
8”  dj   VS	8¼  d    V# SP                  V4      p^S,          V,          pSP                  V4      pVSP                  P                  V4      ,
          pV^,          pKz  V# ©é   r$   )r&   r]   r^   r'   r(   r)   r   ÚUÚVtr+   r,   Úss   &     €€€€€€r   r-   Ú1svd_factorization_projections.<locals>.null_spaceý   s²   ø€ à�v‰v�a‹yˆØ��s�4�xˆØ�E‰E�$‹KˆØ�—‘—‘˜“
�Nˆð ˆÜ˜A˜qÓ! HÔ,Ø�IŒ~Øð ˆð —6‘6˜!“9ˆDØ�Q•3�t•8ˆDØ—‘�d“ˆAà�A—C‘C—G‘G˜A“J•ˆAØ��FŠAàˆr   c                 ól   <€ SP                  V 4      p^S,          V,          pSP                  V4      pV# rp   r1   ©r&   r]   r^   r(   rr   rs   rt   s   &   €€€r   r3   Ú4svd_factorization_projections.<locals>.least_squares  s/   ø€ à�v‰v�a‹yˆØ��s�4�xˆØ�E‰E�$‹KˆØˆr   c                 ó”   <€ SP                   P                  V 4      p^S,          V,          pSP                   P                  V4      pV# rp   r6   rw   s   &   €€€r   r7   Ú0svd_factorization_projections.<locals>.row_space  s7   ø€ à�s‰s�w‰w�q‹zˆØ��s�4�xˆØ�D‰D�H‰H�T‹NˆØˆr   )r   r   Úsvd)r   r9   r:   r,   r+   r;   r-   r3   r7   rr   rs   rt   s   f&&ff&   @@@r   rR   rR   ñ   sv   ý€ ô �|‰|×Ñ °ÐÓ7�H€A€qˆ"ð 	
ˆ!ˆQ�‰Wˆ*�€AØ	ˆA�‰G�QˆJ�€BØ	ˆ!ˆc‰'�
€A÷ò ÷0÷ð  iÐ/Ð/r   c                ó^  € \         P                  ! V 4      w  rVWV,          ^ 8X  d   \        V 4      p \        V 4      '       dL   Vf   RpVR	9  d   \	        R4      hVR8X  d,   \
        '       g    \        P                  ! R\        ^R7       RpMVf   RpVR
9  d   \	        R4      hVR8X  d   \        WWbW44      w  rxp	MGVR8X  d   \        WWbW44      w  rxp	M/VR8X  d   \        WWbW44      w  rxp	MVR8X  d   \        WWbW44      w  rxp	\        Wf3X4      p
\        WV3X4      p\        We3X	4      pW«V3# )aú	  Return three linear operators related with a given matrix A.

Parameters
----------
A : sparse array (or ndarray), shape (m, n)
    Matrix ``A`` used in the projection.
method : str, optional
    Method used for compute the given linear
    operators. Should be one of:

        - 'NormalEquation': The operators
           will be computed using the
           so-called normal equation approach
           explained in [1]_. In order to do
           so the Cholesky factorization of
           ``(A A.T)`` is computed. Exclusive
           for sparse matrices.
        - 'AugmentedSystem': The operators
           will be computed using the
           so-called augmented system approach
           explained in [1]_. Exclusive
           for sparse matrices.
        - 'QRFactorization': Compute projections
           using QR factorization. Exclusive for
           dense matrices.
        - 'SVDFactorization': Compute projections
           using SVD factorization. Exclusive for
           dense matrices.

orth_tol : float, optional
    Tolerance for iterative refinements.
max_refin : int, optional
    Maximum number of iterative refinements.
tol : float, optional
    Tolerance for singular values.

Returns
-------
Z : LinearOperator, shape (n, n)
    Null-space operator. For a given vector ``x``,
    the null space operator is equivalent to apply
    a projection matrix ``P = I - A.T inv(A A.T) A``
    to the vector. It can be shown that this is
    equivalent to project ``x`` into the null space
    of A.
LS : LinearOperator, shape (m, n)
    Least-squares operator. For a given vector ``x``,
    the least-squares operator is equivalent to apply a
    pseudoinverse matrix ``pinv(A.T) = inv(A A.T) A``
    to the vector. It can be shown that this vector
    ``pinv(A.T) x`` is the least_square solution to
    ``A.T y = x``.
Y : LinearOperator, shape (n, m)
    Row-space operator. For a given vector ``x``,
    the row-space operator is equivalent to apply a
    projection matrix ``Q = A.T inv(A A.T)``
    to the vector.  It can be shown that this
    vector ``y = Q x``  the minimum norm solution
    of ``A y = x``.

Notes
-----
Uses iterative refinements described in [1]
during the computation of ``Z`` in order to
cope with the possibility of large roundoff errors.

References
----------
.. [1] Gould, Nicholas IM, Mary E. Hribar, and Jorge Nocedal.
    "On the solution of equality constrained quadratic
    programming problems arising in optimization."
    SIAM Journal on Scientific Computing 23.4 (2001): 1376-1395.
ÚAugmentedSystemÚNormalEquationz$Method not allowed for sparse array.zmOnly accepts 'NormalEquation' option when scikit-sparse is available. Using 'AugmentedSystem' option instead.r@   ÚQRFactorizationÚSVDFactorizationz#Method not allowed for dense array.)r~   r}   )r   r€   )r   Úshaper   r   Ú
ValueErrorÚsksparse_availableÚwarningsr	   ÚImportWarningr<   rT   rl   rR   r   )r   Úmethodr,   r+   r;   r9   r:   r-   r3   r7   ÚZÚLSÚYs   &&&&&        r   r   r   '  sM  € ôT �8Š8�A‹;�D€Að 	…sˆa„xÜ�a‹Lˆô �‡{‚{ØŠ>Ø&ˆFØÐ>Ô>ÜÐCÓDÐDØÐ%Ô%×.@Ó.@Ü�MŠMð >ô (°Aõ7ð 'ˆFøàŠ>Ø&ˆFØÐ@Ô@ÜÐBÓCÐCàÐ!Ô!ä)¨!°¸YÓLñ 	-ˆ
¡9à	Ð$Ô	$ä*¨1°¸iÓMñ 	-ˆ
¡9à	Ð$Ô	$ä*¨1°¸iÓMñ 	-ˆ
¡9à	Ð%Ô	%ä+¨A°!¸yÓNñ 	-ˆ
 9ô 	˜�v˜zÓ*€AÜ	˜˜ Ó	.€BÜ˜�v˜yÓ)€Aà�!ˆ8€Or   )Ngê-�™—q=é   gVçž¯Ò<)Ú__doc__Úscipy.sparser   r   r   r   Úscipy.sparse.linalgr   Úscipy.linalgr   Úsksparse.cholmodr   r   rƒ   ÚImportErrorr„   Únumpyr   r	   r
   Ú__all__r   r<   rT   rl   rR   r   © r   r   Ú<module>r”      s|   ðÙ 7ç DÓ DÝ .Û Û ðßKØÐó ß )ð Øð€ò òF$0òNP0òf;0ò|30öltøð{ ô ÛØÒðús   ž
A ÁAÁA