+
    in                         ^ RI Ht ^ RIHt ^ RIHt ^ RIHt ^ RIH	t	 ^ RI
Ht ^RIHtHtHtHt ^ RIHt R	 tR
 tR tR tR# )    )defaultdict)Add)Mul)S)construct_domain)PolyNonlinearError)SDM	sdm_irrefsdm_particular_from_rrefsdm_nullspace_from_rref)
filldedentc           	     
   \        V4      p\        W4      w  r4\        W4V4      pVP                  pVP                  '       g   VP
                  '       d4   VP                  4       P                  4       ^ ,          P                  4       p\        V4      w  rxp	V'       d   VR,          V8X  d   R# \        Wr^,           V4      p
\        WvP                  W(V	4      w  r\        \        4      pV
P                  4        F2  w  rWV,          ,          P!                  VP#                  V4      4       K4  	  \%        W4       F\  w  ppVV,          pVP                  4        F9  w  rWV,          ,          P!                  VVP#                  V4      ,          4       K;  	  K^  	  VP                  4        UUu/ uF  w  ppV\'        V!  bK  	  ppp\(        P*                  p\-        V4      \-        V4      ,
           F  pVVV&   K
  	  V# u uppi )a  Solve a linear system of equations.

Examples
========

Solve a linear system with a unique solution:

>>> from sympy import symbols, Eq
>>> from sympy.polys.matrices.linsolve import _linsolve
>>> x, y = symbols('x, y')
>>> eqs = [Eq(x + y, 1), Eq(x - y, 2)]
>>> _linsolve(eqs, [x, y])
{x: 3/2, y: -1/2}

In the case of underdetermined systems the solution will be expressed in
terms of the unknown symbols that are unconstrained:

>>> _linsolve([Eq(x + y, 0)], [x, y])
{x: -y, y: y}

N)len_linear_eq_to_dictsympy_dict_to_dmdomainis_RealFieldis_ComplexFieldto_ddmrrefto_sdmr
   r   r   oner   listitemsappendto_sympyzipr   r   Zeroset)eqssymsnsymseqsdictconstAaugKArrefpivotsnzcolsPV	nonpivotssolivnpiVisymstermszeros   &&                    }/Users/tonyclaw/.openclaw/workspace/skills/math-calculator/venv/lib/python3.14/site-packages/sympy/polys/matrices/linsolve.py	_linsolver8   0   s   0 IE (2NGGD1DA
 	~~~***{{}!!#A&--/ &dOE6 &*% 	!a8A +5%%OLA d
C	GAJJqM* y$R3iHHJDAQLajjm 34  % +.))+
6+ha1c5k>+C
6 66DYS!!A " J 7s   -G?c                &   \        V4      P                  ! R V  4       !  p\        VRRR7      w  rE\        \	        W54      4      p\        V 4      p\        V4      p\        \	        V\        V4      4      4      p	. p
\	        W4       Fc  w  rVP                  4        UUu/ uF  w  rW,          Wn,          bK  	  pppV'       d   Wl,          ) W&   V'       g   KR  V
P                  V4       Ke  	  \        \        V
4      Wx^,           3V4      pV# u uppi )z?Convert a system of dict equations to a sparse augmented matrixc              3   @   "   T F  qP                  4       x  K  	  R # 5i)N)values).0es   & r7   	<genexpr>#sympy_dict_to_dm.<locals>.<genexpr>z   s      @ZZs   T)field	extension)r    unionr   dictr   r   ranger   r   r	   	enumerate)
eqs_coeffseqs_rhsr"   elemsr'   elems_Kelem_mapneqsr#   	sym2indexr$   eqrhsr4   ceqdictsdm_augs   &&&              r7   r   r   x   s    L @Z @AE!%ttDJAC'(Hz?DIESuU|,-IGz+8:
C
),+
C%]NFM6NN6" , )G$tQY&7;GN Ds   Dc                
   . p. p\        V4      pV  F  pVP                  '       d   \        VP                  V4      w  rg\        VP                  V4      w  rWh,          pV	P                  4        F&  w  rW9   d   Wz;;,          V,          uu&   K!  V) Wz&   K(  	  VP                  4        U
Uu/ uF  w  rV'       g   K  WbK  	  pp
pYgrM\        WT4      w  rVP                  V4       VP                  V4       K  	  W#3# u upp
i )aI  Convert a system Expr/Eq equations into dict form, returning
the coefficient dictionaries and a list of syms-independent terms
from each expression in ``eqs```.

Examples
========

>>> from sympy.polys.matrices.linsolve import _linear_eq_to_dict
>>> from sympy.abc import x
>>> _linear_eq_to_dict([2*x + 3], {x})
([{x: 2}], [3])
)r    is_Equality_lin_eq2dictlhsrN   r   r   )r!   r"   coeffsindsymsetr=   coeffr5   cRtRkr0   rO   ds   &&            r7   r   r      s     F
CYF==='v6LE!!%%0FB KE
:HMH !rEH	 # ',kkm9mdaqTQTmE9q*DAa

1% & ; :s   ,C?=C?c           	        W9   d#   \         P                  V \         P                  /3# V P                  '       d   \	        \
        4      p. pV P                   FQ  p\        WA4      w  rVVP                  V4       VP                  4        F  w  rxW',          P                  V4       K  	  KS  	  \        V!  p	VP                  4        U
Uu/ uF  w  rV
\        V!  bK  	  pp
pW3# V P                  '       d   R;r. pV P                   FN  p\        WA4      w  rVV'       g   VP                  V4       K+  Vf   TpTpK5  \        \        RV ,          4      4      h	  \        P                  ! V4      p	Vf   V	/ 3# VP                  4        U
Uu/ uF  w  rWV,          bK  	  pp
pW,          V3# V P!                  V4      '       g   V / 3# \        RV ,          4      hu upp
i u upp
i )a  return (c, d) where c is the sym-independent part of ``a`` and
``d`` is an efficiently calculated dictionary mapping symbols to
their coefficients. A PolyNonlinearError is raised if non-linearity
is detected.

The values in the dictionary will be non-zero.

Examples
========

>>> from sympy.polys.matrices.linsolve import _lin_eq2dict
>>> from sympy.abc import x, y
>>> _lin_eq2dict(x + 2*y + 3, {x, y})
(3, {x: 1, y: 2})
Nz-
                    nonlinear cross-term: %sznonlinear term: %s)r   r   Oneis_Addr   r   argsrT   r   r   r   is_Mulr   r   r   
_from_args	has_xfree)arX   
terms_list
coeff_listaicitimijcijrY   r3   rV   r5   terms_coeffrO   s   &&             r7   rT   rT      s     	{vv155z!!	
 &

&&B!"-FBb!HHJ&&s+ ' 
 Z 6@6F6F6HI6H{sc6l"6HI|	
""
&&B!"-FB!!"%  ) 502354 *5 6 6  z*="927++-@-S!)^-E@'..[[  "u !5!9::5 J* As   	G
GN)collectionsr   sympy.core.addr   sympy.core.mulr   sympy.core.singletonr   sympy.polys.constructorr   sympy.polys.solversr   sdmr	   r
   r   r   sympy.utilities.miscr   r8   r   r   rT        r7   <module>rx      s?   : $   " 4 2  ,EP&#L5;rw   