
    \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   zInteger 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    [/var/www/auris/envauris/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    <<qss##]]s1v&& !>!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,       yy|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    33!833J 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Qw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8D
(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   