Ë
    täi¤  ã                   óT   — d Z ddlmZ ddlmZmZmZ ddlmZ e G d„ de«      «       Z	y)z'Implementation of :class:`Ring` class. é    )ÚDomain)ÚExactQuotientFailedÚNotInvertibleÚNotReversible)Úpublicc                   óh   — e Zd ZdZdZd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zy)ÚRingzRepresents a ring domain. Tc                 ó   — | S )z)Returns a ring associated with ``self``. © )Úselfs    úg/Volumes/fast/ai/experiments/MLX_z-image/.venv/lib/python3.12/site-packages/sympy/polys/domains/ring.pyÚget_ringzRing.get_ring   s   € àˆó    c                 ó0   — ||z  rt        ||| «      ‚||z  S )z>Exact quotient of ``a`` and ``b``, implies ``__floordiv__``.  )r   ©r   ÚaÚbs      r   Úexquoz
Ring.exquo   s!   € àˆqŠ5Ü% a¨¨DÓ1Ð1à˜‘6ˆMr   c                 ó   — ||z  S )z7Quotient of ``a`` and ``b``, implies ``__floordiv__``. r   r   s      r   ÚquozRing.quo   s   € à�A‰vˆr   c                 ó   — ||z  S )z4Remainder of ``a`` and ``b``, implies ``__mod__``.  r   r   s      r   ÚremzRing.rem   s   € à�1‰uˆr   c                 ó   — t        ||«      S )z5Division of ``a`` and ``b``, implies ``__divmod__``. )Údivmodr   s      r   ÚdivzRing.div"   s   € ä�a˜‹|Ðr   c                 óp   — | j                  ||«      \  }}}| j                  |«      r||z  S t        d«      ‚)z"Returns inversion of ``a mod b``. zzero divisor)ÚgcdexÚis_oner   )r   r   r   ÚsÚtÚhs         r   ÚinvertzRing.invert&   s7   € à—*‘*˜Q Ó"‰ˆˆ1ˆaà�;‰;�qŒ>Ø�q‘5ˆLä Ó/Ð/r   c                 ób   — | j                  |«      s| j                  | «      r|S t        d«      ‚)z!Returns ``a**(-1)`` if possible. z#only units are reversible in a ring)r   r   ©r   r   s     r   ÚrevertzRing.revert/   s*   € à�;‰;�qŒ>˜TŸ[™[¨!¨œ_ØˆHäÐ EÓFÐFr   c                 óF   — 	 | j                  |«       y# t        $ r Y yw xY w)NTF)r%   r   r$   s     r   Úis_unitzRing.is_unit6   s'   € ð	Ø�K‰K˜ŒNØøÜò 	Ùð	ús   ‚ ”	 Ÿ c                 ó   — |S )zReturns numerator of ``a``. r   r$   s     r   Únumerz
Ring.numer=   s   € àˆr   c                 ó   — | j                   S )zReturns denominator of `a`. )Úoner$   s     r   Údenomz
Ring.denomA   s   € à�x‰xˆr   c                 ó   — t         ‚)zÊ
        Generate a free module of rank ``rank`` over self.

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> QQ.old_poly_ring(x).free_module(2)
        QQ[x]**2
        )ÚNotImplementedError)r   Úranks     r   Úfree_modulezRing.free_moduleE   s
   € ô "Ð!r   c           	      ó€   — ddl m}  ||  | j                  d«      j                  |D �cg c]  }|g‘Œ c}Ž «      S c c}w )z±
        Generate an ideal of ``self``.

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> QQ.old_poly_ring(x).ideal(x**2)
        <x**2>
        r   )ÚModuleImplementedIdealé   )Úsympy.polys.agca.idealsr2   r0   Ú	submodule)r   Úgensr2   Úxs       r   Úidealz
Ring.idealP   sI   € õ 	CÙ% dÐ,I¨D×,<Ñ,<¸QÓ,?×,IÑ,IÙÓ ™4�aˆqŠc˜4Ñ ð-"ó #ð 	#ùÚ s   ©
;c                 ób   — ddl m} ddlm} t	        ||«      s | j
                  |Ž } || |«      S )aÖ  
        Form a quotient ring of ``self``.

        Here ``e`` can be an ideal or an iterable.

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> QQ.old_poly_ring(x).quotient_ring(QQ.old_poly_ring(x).ideal(x**2))
        QQ[x]/<x**2>
        >>> QQ.old_poly_ring(x).quotient_ring([x**2])
        QQ[x]/<x**2>

        The division operator has been overloaded for this:

        >>> QQ.old_poly_ring(x)/[x**2]
        QQ[x]/<x**2>
        r   )ÚIdeal)ÚQuotientRing)r4   r:   Ú sympy.polys.domains.quotientringr;   Ú
isinstancer8   )r   Úer:   r;   s       r   Úquotient_ringzRing.quotient_ring]   s0   € õ$ 	2ÝAÜ˜!˜UÔ#Ø�—
‘
˜A�ˆAÙ˜D !Ó$Ð$r   c                 ó$   — | j                  |«      S )N)r?   )r   r>   s     r   Ú__truediv__zRing.__truediv__u   s   € Ø×!Ñ! !Ó$Ð$r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úis_Ringr   r   r   r   r   r"   r%   r'   r)   r,   r0   r8   r?   rA   r   r   r   r	   r	   	   sQ   „ á$à€Gòòòòòò0òGòòòò	"ò#ò%ó0%r   r	   N)
rE   Úsympy.polys.domains.domainr   Úsympy.polys.polyerrorsr   r   r   Úsympy.utilitiesr   r	   r   r   r   Ú<module>rJ      s2   ðÙ -õ .ß TÑ Tå "àôl%ˆ6ó l%ó ñl%r   