ó
    Š*£h’  ã                   ó|   • S r SSKJr  SSKJrJrJrJr	J
r
JrJr  SSKJr  SSKJr  SSKJr  \ " S S\5      5       rg	)
z4Implementation of :class:`PythonIntegerRing` class. é    )Ú
int_valued)ÚPythonIntegerÚSymPyIntegerÚsqrtÚ	factorialÚpython_gcdexÚ
python_gcdÚ
python_lcm)ÚIntegerRing)ÚCoercionFailed)Úpublicc                   ó    • \ rS rSrSr\r\" S5      r\" S5      rSr	S r
S rS rS	 rS
 rS rS rS rS rS rS rS rS rS rS rS rSrg)ÚPythonIntegerRingé   z¶Integer ring based on Python's ``int`` type.

This will be used as :ref:`ZZ` if ``gmpy`` and ``gmpy2`` are not
installed. Elements are instances of the standard Python ``int`` type.
r   é   Ú	ZZ_pythonc                 ó   • g)z$Allow instantiation of this domain. N© )Úselfs    Úb/home/mande/repo/quber/.venv/lib/python3.13/site-packages/sympy/polys/domains/pythonintegerring.pyÚ__init__ÚPythonIntegerRing.__init__   s   � ó    c                 ó   • [        U5      $ )z!Convert ``a`` to a SymPy object. )r   ©r   Úas     r   Úto_sympyÚPythonIntegerRing.to_sympy   s   € ä˜A‹Ðr   c                 ó²   • UR                   (       a  [        UR                  5      $ [        U5      (       a  [        [	        U5      5      $ [        SU-  5      e)z&Convert SymPy's Integer to ``dtype``. zexpected an integer, got %s)Ú
is_Integerr   Úpr   Úintr   r   s     r   Ú
from_sympyÚPythonIntegerRing.from_sympy!   sA   € à�<�<Ü  §¡Ó%Ð%Ü˜�]‰]Ü ¤ Q£Ó(Ð(ä Ð!>ÀÑ!BÓCÐCr   c                 ó$   • UR                  U5      $ )z5Convert ``ModularInteger(int)`` to Python's ``int``. )Úto_int©ÚK1r   ÚK0s      r   Úfrom_FF_pythonÚ PythonIntegerRing.from_FF_python*   s   € à�y‰y˜‹|Ðr   c                 ó   • U$ )z.Convert Python's ``int`` to Python's ``int``. r   r'   s      r   Úfrom_ZZ_pythonÚ PythonIntegerRing.from_ZZ_python.   s   € àˆr   c                 ó<   • UR                   S:X  a  UR                  $ g©z3Convert Python's ``Fraction`` to Python's ``int``. r   N©ÚdenominatorÚ	numeratorr'   s      r   Úfrom_QQÚPythonIntegerRing.from_QQ2   ó   € à�=‰=˜AÓØ—;‘;Ðð r   c                 ó<   • UR                   S:X  a  UR                  $ gr0   r1   r'   s      r   Úfrom_QQ_pythonÚ PythonIntegerRing.from_QQ_python7   r6   r   c                 ó6   • [        UR                  U5      5      $ )z5Convert ``ModularInteger(mpz)`` to Python's ``int``. )r   r&   r'   s      r   Úfrom_FF_gmpyÚPythonIntegerRing.from_FF_gmpy<   s   € ä˜RŸY™Y q›\Ó*Ð*r   c                 ó   • [        U5      $ )z,Convert GMPY's ``mpz`` to Python's ``int``. )r   r'   s      r   Úfrom_ZZ_gmpyÚPythonIntegerRing.from_ZZ_gmpy@   s   € ä˜QÓÐr   c                 ó^   • UR                  5       S:X  a  [        UR                  5       5      $ g)z,Convert GMPY's ``mpq`` to Python's ``int``. r   N)Údenomr   Únumerr'   s      r   Úfrom_QQ_gmpyÚPythonIntegerRing.from_QQ_gmpyD   s%   € à�7‰7‹9˜‹>Ü  §¡£Ó+Ð+ð r   c                 óL   • UR                  U5      u  p4US:X  a  [        U5      $ g)z.Convert mpmath's ``mpf`` to Python's ``int``. r   N)Úto_rationalr   )r(   r   r)   r!   Úqs        r   Úfrom_RealFieldÚ PythonIntegerRing.from_RealFieldI   s)   € à�~‰~˜aÓ ‰ˆà�‹6Ü  Ó#Ð#ð r   c                 ó   • [        X5      $ )z)Compute extended GCD of ``a`` and ``b``. )r   ©r   r   Úbs      r   ÚgcdexÚPythonIntegerRing.gcdexP   s   € ä˜AÓ!Ð!r   c                 ó   • [        X5      $ )z Compute GCD of ``a`` and ``b``. )r	   rK   s      r   ÚgcdÚPythonIntegerRing.gcdT   ó   € ä˜!ÓÐr   c                 ó   • [        X5      $ )z Compute LCM of ``a`` and ``b``. )r
   rK   s      r   ÚlcmÚPythonIntegerRing.lcmX   rR   r   c                 ó   • [        U5      $ )zCompute square root of ``a``. )Úpython_sqrtr   s     r   r   ÚPythonIntegerRing.sqrt\   s   € ä˜1‹~Ðr   c                 ó   • [        U5      $ )zCompute factorial of ``a``. )Úpython_factorialr   s     r   r   ÚPythonIntegerRing.factorial`   s   € ä Ó"Ð"r   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   ÚdtypeÚzeroÚoneÚaliasr   r   r#   r*   r-   r4   r8   r;   r>   rC   rH   rM   rP   rT   r   r   Ú__static_attributes__r   r   r   r   r      sv   † ñð €EÙ�‹8€DÙ
�‹(€CØ€Eò3òòDòòòò
ò
+ò ò,ò
$ò"ò ò òõ#r   r   N)r`   Úsympy.core.numbersr   Úsympy.polys.domains.groundtypesr   r   r   rW   r   rZ   r   r	   r
   Úsympy.polys.domains.integerringr   Úsympy.polys.polyerrorsr   Úsympy.utilitiesr   r   r   r   r   Ú<module>rk      sC   ðÙ :õ *÷÷ ñ õ 8Ý 1Ý "àôT#˜ó T#ó ñT#r   