ó
    Š*£hÝ  ã                   ó|   • S 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KJr  \ " S S\5      5       rg	)
z2Implementation of :class:`GMPYIntegerRing` class. é    )ÚGMPYIntegerÚSymPyIntegerÚ	factorialÚ
gmpy_gcdexÚgmpy_gcdÚgmpy_lcmÚsqrt)Ú
int_valued)ÚIntegerRing)ÚCoercionFailed)Úpublicc                   ó¶   • \ rS rSrSr\r\" S5      r\" S5      r\	" \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Srg)ÚGMPYIntegerRingé   z§Integer ring based on GMPY's ``mpz`` type.

This will be the implementation of :ref:`ZZ` if ``gmpy`` or ``gmpy2`` is
installed. Elements will be of type ``gmpy.mpz``.
r   é   ÚZZ_gmpyc                 ó   • g)z$Allow instantiation of this domain. N© )Úselfs    Ú`/home/mande/repo/quber/.venv/lib/python3.13/site-packages/sympy/polys/domains/gmpyintegerring.pyÚ__init__ÚGMPYIntegerRing.__init__   s   � ó    c                 ó*   • [        [        U5      5      $ )z!Convert ``a`` to a SymPy object. )r   Úint©r   Úas     r   Úto_sympyÚGMPYIntegerRing.to_sympy   s   € äœC ›FÓ#Ð#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
   r   r   r   s     r   Ú
from_sympyÚGMPYIntegerRing.from_sympy#   sA   € à�<�<Ü˜qŸs™sÓ#Ð#Ü˜�]‰]Üœs 1›vÓ&Ð&ä Ð!>ÀÑ!BÓCÐCr   c                 ó$   • UR                  U5      $ )z3Convert ``ModularInteger(int)`` to GMPY's ``mpz``. ©Úto_int©ÚK1r   ÚK0s      r   Úfrom_FF_pythonÚGMPYIntegerRing.from_FF_python,   ó   € à�y‰y˜‹|Ðr   c                 ó   • [        U5      $ )z,Convert Python's ``int`` to GMPY's ``mpz``. )r   r(   s      r   Úfrom_ZZ_pythonÚGMPYIntegerRing.from_ZZ_python0   s   € ä˜1‹~Ðr   c                 óN   • UR                   S:X  a  [        UR                  5      $ g©z1Convert Python's ``Fraction`` to GMPY's ``mpz``. r   N©Údenominatorr   Ú	numeratorr(   s      r   Úfrom_QQÚGMPYIntegerRing.from_QQ4   ó"   € à�=‰=˜AÓÜ˜qŸ{™{Ó+Ð+ð r   c                 óN   • UR                   S:X  a  [        UR                  5      $ gr2   r3   r(   s      r   Úfrom_QQ_pythonÚGMPYIntegerRing.from_QQ_python9   r8   r   c                 ó$   • UR                  U5      $ )z3Convert ``ModularInteger(mpz)`` to GMPY's ``mpz``. r&   r(   s      r   Úfrom_FF_gmpyÚGMPYIntegerRing.from_FF_gmpy>   r-   r   c                 ó   • U$ )z*Convert GMPY's ``mpz`` to GMPY's ``mpz``. r   r(   s      r   Úfrom_ZZ_gmpyÚGMPYIntegerRing.from_ZZ_gmpyB   s   € àˆr   c                 ó<   • UR                   S:X  a  UR                  $ g)z(Convert GMPY ``mpq`` to GMPY's ``mpz``. r   N)r4   r5   r(   s      r   Úfrom_QQ_gmpyÚGMPYIntegerRing.from_QQ_gmpyF   s   € à�=‰=˜AÓØ—;‘;Ðð r   c                 óL   • UR                  U5      u  p4US:X  a  [        U5      $ g)z,Convert mpmath's ``mpf`` to GMPY's ``mpz``. r   N)Úto_rationalr   )r)   r   r*   r"   Úqs        r   Úfrom_RealFieldÚGMPYIntegerRing.from_RealFieldK   s(   € à�~‰~˜aÓ ‰ˆà�‹6Ü˜q“>Ð!ð r   c                 ó<   • UR                   S:X  a  UR                  $ g )Nr   )ÚyÚxr(   s      r   Úfrom_GaussianIntegerRingÚ(GMPYIntegerRing.from_GaussianIntegerRingR   s   € Ø�3‰3�!‹8Ø—3‘3ˆJð r   c                 ó&   • [        X5      u  p4nXEU4$ )z)Compute extended GCD of ``a`` and ``b``. )r   )r   r   ÚbÚhÚsÚts         r   ÚgcdexÚGMPYIntegerRing.gcdexV   s   € ä˜QÓ"‰ˆˆaØ�Qˆwˆr   c                 ó   • [        X5      $ )z Compute GCD of ``a`` and ``b``. )r   ©r   r   rP   s      r   ÚgcdÚGMPYIntegerRing.gcd[   ó   € ä˜‹~Ðr   c                 ó   • [        X5      $ )z Compute LCM of ``a`` and ``b``. )r   rW   s      r   ÚlcmÚGMPYIntegerRing.lcm_   rZ   r   c                 ó   • [        U5      $ )zCompute square root of ``a``. )Ú	gmpy_sqrtr   s     r   r	   ÚGMPYIntegerRing.sqrtc   s   € ä˜‹|Ðr   c                 ó   • [        U5      $ )zCompute factorial of ``a``. )Úgmpy_factorialr   s     r   r   ÚGMPYIntegerRing.factorialg   s   € ä˜aÓ Ð r   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   ÚdtypeÚzeroÚoneÚtypeÚtpÚaliasr   r   r#   r+   r/   r6   r:   r=   r@   rC   rH   rM   rT   rX   r\   r	   r   Ú__static_attributes__r   r   r   r   r      s„   † ñð €EÙ�‹8€DÙ
�‹(€CÙ	ˆc‹€BØ€Eò3ò$òDòòò,ò
,ò
òòò
"òòò
òòõ!r   r   N)rh   Úsympy.polys.domains.groundtypesr   r   r   rb   r   r   r   r	   r_   Úsympy.core.numbersr
   Úsympy.polys.domains.integerringr   Úsympy.polys.polyerrorsr   Úsympy.utilitiesr   r   r   r   r   Ú<module>ru      sA   ðÙ 8÷÷ ñ õ
 *Ý 7Ý 1Ý "àôZ!�kó Z!ó ñZ!r   