+
    /åûj¬<  ã                   óÎ   € ^ RI Ht ^ RIHtHtHt ^ RIHt ^ RIH	t	H
t
 RR/R ltRR	RR/R
 ltR tR tR tR tR tR tR tRR/R ltRR/R ltRR/R ltR tR tR tR tR# )é    )ÚZZ)ÚSDMÚ	sdm_irrefÚsdm_rref_den)ÚDDM)Ú	ddm_irrefÚddm_irref_denÚmethodÚautoc               ó~  € \        WRR7      w  r\        W4      w  rVR8X  d   \        V 4      p\        V4      w  rVMrVR8X  d"   \	        V 4      w  rxp\        V4      V,          pMJVR8X  d6   V P                  RR7      w  rš\	        V
4      w  rxp\        V4      V,          pM\        RV 24      h\        WS4      w  rYWV3# )	aZ  
Compute the reduced row echelon form of a ``DomainMatrix``.

This function is the implementation of :meth:`DomainMatrix.rref`.

Chooses the best algorithm depending on the domain, shape, and sparsity of
the matrix as well as things like the bit count in the case of :ref:`ZZ` or
:ref:`QQ`. The result is returned over the field associated with the domain
of the Matrix.

See Also
========

sympy.polys.matrices.domainmatrix.DomainMatrix.rref
    The ``DomainMatrix`` method that calls this function.
sympy.polys.matrices.rref._dm_rref_den
    Alternative function for computing RREF with denominator.
F©ÚdenominatorÚGJÚFFÚCDT©ÚconvertúUnknown method for rref: )Ú_dm_rref_choose_methodÚ
_dm_to_fmtÚ	_to_fieldÚ_dm_rref_GJÚ_dm_rref_den_FFÚclear_denoms_rowwiseÚ
ValueError)ÚMr
   Úuse_fmtÚold_fmtÚMfÚM_rrefÚpivotsÚM_rref_fÚdenÚ_ÚMrs   &$         ÚUC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\sympy\polys\matrices\rref.pyÚ_dm_rrefr'   %   sÅ   € ô& -¨QÀEÔJ�O€Fä˜AÓ'�J€Aà�„~ä�q‹\ˆÜ$ R›‰ˆ�à	�4Œä /°Ó 2Ñˆ�vÜ˜8Ó$ sÕ*‰à	�4Œà×&Ñ&¨tÐ&Ó4‰ˆÜ /°Ó 3Ñˆ�vÜ˜8Ó$ sÕ*‰ô Ð4°V°HÐ=Ó>Ð>ä˜6Ó+�I€Fð ˆ>Ðó    Úkeep_domainTc               ó^  € \        WRR7      w  r#\        W4      w  rVR8X  d   \        V 4      w  rVpEMjVR8X  d£   \        \	        V 4      4      w  r‡V'       dl   VP
                  V P
                  8w  dQ   VP                  RR7      w  r•V'       d   V^ V^ ,          3,          P                  pMñVP
                  P                  pMÚTpVP
                  P                  pMÁVR8X  d­   V P                  RR7      w  rš\        V
4      w  r¶pV'       dE   VP
                  V P
                  8w  d*   \	        V4      V,          pV P
                  P                  pMLTpV'       d   V^ V^ ,          3,          P                  pM%VP
                  P                  pM\        RV 24      h\        WT4      w  rYWVV3# )aÊ  
Compute the reduced row echelon form of a ``DomainMatrix`` with denominator.

This function is the implementation of :meth:`DomainMatrix.rref_den`.

Chooses the best algorithm depending on the domain, shape, and sparsity of
the matrix as well as things like the bit count in the case of :ref:`ZZ` or
:ref:`QQ`. The result is returned over the same domain as the input matrix
unless ``keep_domain=False`` in which case the result might be over an
associated ring or field domain.

See Also
========

sympy.polys.matrices.domainmatrix.DomainMatrix.rref_den
    The ``DomainMatrix`` method that calls this function.
sympy.polys.matrices.rref._dm_rref
    Alternative function for computing RREF without denominator.
Tr   r   r   r   r   r   )r   r   r   r   r   ÚdomainÚclear_denomsÚelementÚoner   r   )r   r)   r
   r   r   r    r#   r!   r"   r$   r%   ÚM_rref_rs   &$$         r&   Ú_dm_rref_denr0   Y   sk  € ô( -¨QÀDÔI�O€Fä˜AÓ'�J€Aà�„~ä-¨aÓ0Ñˆ’Và	�4Œä&¤y°£|Ó4Ñˆ÷ ˜8Ÿ?™?¨a¯h©hÔ6Ø ×-Ñ-°dÐ-Ó;‰IˆAçØ˜Q  q¥	˜\Õ*×2Ñ2‘à—m‘m×'Ñ'‘ð ˆFØ—-‘-×#Ñ#‰Cà	�4Œà×&Ñ&¨tÐ&Ó4‰ˆä /°Ó 3Ñˆ�vç˜8Ÿ?™?¨a¯h©hÔ6ä˜xÓ(¨3Õ.ˆFØ—(‘(—,‘,‰Cð ˆFçØ˜Q  q¥	˜\Õ*×2Ñ2‘à—m‘m×'Ñ'‘äÐ4°V°HÐ=Ó>Ð>ä˜6Ó+�I€Fð ˜ÐÐr(   c                óÆ   € V P                   P                  pW!8X  d    W3# VR8X  d   V P                  4       p W3# VR8X  d   V P                  4       p W3# \	        RV 24      h)z?Convert a matrix to the given format and return the old format.ÚdenseÚsparsezUnknown format: )ÚrepÚfmtÚto_denseÚ	to_sparser   )r   r5   r   s   && r&   r   r   §   sr   € à�e‰e�i‰i€GØ„~Øð ˆ:Ðð 
�ŒØ�J‰J‹Lˆð
 ˆ:Ðð	 
�ŒØ�K‰K‹Mˆð ˆ:Ðô Ð+¨C¨5Ð1Ó2Ð2r(   c                ód   € V P                   P                  R8X  d   \        V 4      # \        V 4      # )z:Compute RREF using Gauss-Jordan elimination with division.r3   )r4   r5   Ú_dm_rref_GJ_sparseÚ_dm_rref_GJ_dense©r   s   &r&   r   r   ¸   s(   € à‡u�u‡y�y�HÔÜ! !Ó$Ð$ä  Ó#Ð#r(   c                ód   € V P                   P                  R8X  d   \        V 4      # \        V 4      # )z:Compute RREF using fraction-free Gauss-Jordan elimination.r3   )r4   r5   Ú_dm_rref_den_FF_sparseÚ_dm_rref_den_FF_denser;   s   &r&   r   r   À   s(   € à‡u�u‡y�y�HÔÜ% aÓ(Ð(ä$ QÓ'Ð'r(   c                ó®   € \        V P                  4      w  rp\        WP                  V P                  4      p\        V4      pV P                  V4      V3# )zACompute RREF using sparse Gauss-Jordan elimination with division.)r   r4   r   Úshaper+   ÚtupleÚfrom_rep)r   ÚM_rref_dr!   r$   Ú
M_rref_sdms   &    r&   r9   r9   È   sF   € ä# A§E¡EÓ*Ñ€H�aÜ�XŸw™w¨¯©Ó1€JÜ�6‹]€FØ�:‰:�jÓ! 6Ð)Ð)r(   c                ój  € V P                   P                  ;'       g    V P                   P                  pV P                  P	                  4       P                  4       p\        W!R7      p\        W P                  V P                   4      p\        V4      pV P                  VP                  4       4      V3# )z@Compute RREF using dense Gauss-Jordan elimination with division.)Ú_partial_pivot)r+   Úis_RRÚis_CCr4   Úto_ddmÚcopyr   r   r@   rA   rB   Úto_dfm_or_ddm)r   Úpartial_pivotÚddmr!   Ú
M_rref_ddms   &    r&   r:   r:   Ð   s{   € à—H‘H—N‘N×4Ð4 a§h¡h§n¡n€MØ
�%‰%�,‰,‹.×
Ñ
Ó
€CÜ�sÔ9€FÜ�SŸ'™' 1§8¡8Ó,€JÜ�6‹]€FØ�:‰:�j×.Ñ.Ó0Ó1°6Ð9Ð9r(   c                óÄ   € \        V P                  V P                  4      w  rp\        WP                  V P                  4      p\        V4      pV P                  V4      W#3# ©zACompute RREF using sparse fraction-free Gauss-Jordan elimination.)r   r4   r+   r   r@   rA   rB   )r   rC   r#   r!   rD   s   &    r&   r=   r=   Ú   sL   € ä(¨¯©°·±Ó9Ñ€H�6Ü�XŸw™w¨¯©Ó1€JÜ�6‹]€FØ�:‰:�jÓ! 3Ð.Ð.r(   c                ó  € V P                   P                  4       P                  4       p\        WP                  4      w  r#\        WP                  V P                  4      p\        V4      pV P                  VP                  4       4      W#3# rP   )
r4   rI   rJ   r	   r+   r   r@   rA   rB   rK   )r   rM   r#   r!   rN   s   &    r&   r>   r>   â   sd   € à
�%‰%�,‰,‹.×
Ñ
Ó
€CÜ §X¡XÓ.�K€CÜ�SŸ'™' 1§8¡8Ó,€JÜ�6‹]€FØ�:‰:�j×.Ñ.Ó0Ó1°3Ð>Ð>r(   r   Fc               ó  € VR8w  d2   VP                  R4      '       d   VR\        R4      )  pRpW3# Rp W3# RpV P                  pVP                  '       d   \	        WR7      pW3# VP
                  '       d   \        WR7      pW3# VP                  '       g   VP                  '       d   RpRpW3# VP                  '       d+   V P                  P                  R8X  d   V'       g   RpRpW3# V'       d   RpW3# RpW3# )	z3Choose the fastest method for computing RREF for M.r   Ú_denseNr2   r3   r   r   r   )ÚendswithÚlenr+   Úis_ZZÚ_dm_rref_choose_method_ZZÚis_QQÚ_dm_rref_choose_method_QQrG   rH   Úis_EXr4   r5   )r   r
   r   r   ÚKs   &&$  r&   r   r   ë   s  € ð �ÔØ�?‰?˜8×$Ò$Ø˜Oœc (›m˜^Ð,ˆFØˆGðJ ˆ?ÐðG ‰GðF ˆ?Ðð? ˆà�H‰Hˆà�7�7ˆ7Ü.¨qÔJˆFð4 ˆ?Ðð3 �W�WˆWÜ.¨qÔJˆFð0 ˆ?Ðð/ �W�WˆW˜ŸŸ˜àˆFØˆGð( ˆ?Ðð' �W�WˆW˜Ÿ™Ÿ™ gÔ-·kð ˆFØˆGð ˆ?Ð÷ Ø�ð ˆ?Ðð �àˆ?Ðr(   c               ó˜  € \        V 4      w  r#pV\        ^V^,          4      8  d   R# \        V 4      w  rV\        V Uu. uF  qwP	                  4       NK  	  up^R7      p\
        P                  p	V F8  p
\
        P                  ! Wš4      p	V	P	                  4       ^V,          8”  g   K7   R# 	  V	P	                  4       ^28  d   R# R# u upi )z5Choose the fastest method for computing RREF over QQ.r   ©Údefaultr   r   )Ú_dm_row_densityÚminÚ_dm_QQ_numers_denomsÚmaxÚ
bit_lengthr   r.   Úlcm)r   r   Údensityr$   ÚncolsÚnumersÚdenomsÚnÚ
numer_bitsÚ	denom_lcmÚds   &$         r&   rY   rY     s®   € ô (¨Ó*Ñ€G�ð ”�Q˜˜a�“Ô Ùô *¨!Ó,�N€FÜ©fÓ5©f¨—l‘l–n©fÑ5¸qÔA€Jä—‘€IÛˆÜ—F’F˜9Ó(ˆ	Ø×ÑÓ! A j¥LÖ0Úñ ð ×ÑÓ Ô"Ùáùò) 6s   ¿Cc               ó”  € Rp\        V 4      w  r4pV^
8  d   W5^,          8  d   R# R# V^8  d   R# V^W$,          ,           8”  d   R# \        V 4      p\        V Uu. uF  qwP                  4       NK  	  up^R7      p\        ^RV,          V,          4      p	^W$V^,          ,          ,          ,           V	,          p
W:8  d   R# R# u upi )z5Choose the fastest method for computing RREF over ZZ.i'  r   r   r]   gUUUUUUå?)r_   Ú_dm_elementsrb   rc   )r   r   ÚPARAMre   Únrows_nzrf   ÚelementsÚeÚbitsÚwidenessÚmax_densitys   &$         r&   rW   rW   F  s¾   € ð$ €Eô
  /¨qÓ1Ñ€G�uð �"„}Ø˜1•WÔÙáð �„{ÙØ	�1�u•~Õ%Ô	%Ùô ˜A‹€HÜ©Ó1© 1—‘–©Ñ1¸1Ô=€Dô �1�c˜%•i Õ(Ó)€Hà�u t¨Q¥wÕ.Õ/Õ/°8Õ;€KàÔÙáùò 2s   ÁCc                óð   € V P                   ^,          pV P                  P                  4       P                  4       pV'       g   ^ ^ V3# \	        V4      p\        \        \        V4      4      V,          pWCV3# )a¨  Density measure for sparse matrices.

Defines the "density", ``d`` as the average number of non-zero entries per
row except ignoring rows that are fully zero. RREF can ignore fully zero
rows so they are excluded. By definition ``d >= 1`` except that we define
``d = 0`` for the zero matrix.

Returns ``(density, nrows_nz, ncols)`` where ``nrows_nz`` counts the number
of nonzero rows and ``ncols`` is the number of columns.
)r@   r4   Úto_sdmÚvaluesrU   ÚsumÚmap)r   rf   Úrows_nzrp   re   s   &    r&   r_   r_   |  sb   € ð �G‰G�A�J€EØ�e‰e�l‰l‹n×#Ñ#Ó%€GßØ�!�Uˆ{Ðä�w“<ˆÜ”cœ#˜wÓ'Ó(¨8Õ3ˆØ %Ð'Ð'r(   c                ó*   € V P                  4       w  rV# )z*Return nonzero elements of a DomainMatrix.)Ú
to_flat_nz)r   rq   r$   s   &  r&   rn   rn   ’  s   € à—,‘,“.�K€HØ€Or(   c                óš   € \        V 4      pV Uu. uF  q"P                  NK  	  ppV Uu. uF  q"P                  NK  	  ppW43# u upi u upi )zBReturns the numerators and denominators of a DomainMatrix over QQ.)rn   Ú	numeratorr   )ÚMqrq   rr   rg   rh   s   &    r&   ra   ra   ˜  sH   € ä˜BÓ€HÙ#+Ó,¡8˜a�kŒk¡8€FÐ,Ù%-Ó.¡X �mŒm¡X€FÐ.Øˆ>Ðùò -ùÚ.s
   �AªAc                ób   € V P                   pVP                  '       d   V P                  4       # V # )z.Convert a DomainMatrix to a field if possible.)r+   Úhas_assoc_FieldÚto_field)r   r[   s   & r&   r   r      s(   € à	�‰€AØ××ÐØ�z‰z‹|Ðàˆr(   N)Úsympy.polys.domainsr   Úsympy.polys.matrices.sdmr   r   r   Úsympy.polys.matrices.ddmr   Úsympy.polys.matrices.denser   r	   r'   r0   r   r   r   r9   r:   r=   r>   r   rY   rW   r_   rn   ra   r   © r(   r&   Ú<module>r‰      s˜   ðõ< #ç AÑ AÝ (ß ?ð1˜&ô 1ðhK 4ð K°ô Kò\ò"$ò(ò*ò:ò/ò?ð+°Uô +ð\*°ô *ðZ3°ô 3òl(ò,òôr(   