Ë
    täi÷  ã                   ó`   — d Z ddlmZmZmZ ddlmZ ddlmZ ddl	m
Z
 e
 G d„ de«      «       Zy)	z6Implementation of :class:`PythonRationalField` class. é    )ÚPythonIntegerÚPythonRationalÚSymPyRational)ÚRationalField)ÚCoercionFailed)Úpublicc                   óz   — e Zd ZdZeZ ed«      Z e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)ÚPythonRationalFieldz£Rational field based on :ref:`MPQ`.

    This will be used as :ref:`QQ` if ``gmpy`` and ``gmpy2`` are not
    installed. Elements are instances of :ref:`MPQ`.
    r   é   Ú	QQ_pythonc                  ó   — y )N© )Úselfs    úv/Volumes/fast/ai/experiments/MLX_z-image/.venv/lib/python3.12/site-packages/sympy/polys/domains/pythonrationalfield.pyÚ__init__zPythonRationalField.__init__   s   € Øó    c                 ó   — ddl m}  |«       S )z'Returns ring associated with ``self``. r   )ÚPythonIntegerRing)Úsympy.polys.domainsr   )r   r   s     r   Úget_ringzPythonRationalField.get_ring   s   € å9Ù Ó"Ð"r   c                 óB   — t        |j                  |j                  «      S )zConvert `a` to a SymPy object. )r   Ú	numeratorÚdenominator©r   Úas     r   Úto_sympyzPythonRationalField.to_sympy   s   € ä˜QŸ[™[¨!¯-©-Ó8Ð8r   c                 óþ   — |j                   r t        |j                  |j                  «      S |j                  r8ddlm} |j                  |«      \  }}t        t        |«      t        |«      «      S t        d|z  «      ‚)z%Convert SymPy's Rational to `dtype`. r   )ÚRRz"expected `Rational` object, got %s)
Úis_Rationalr   ÚpÚqÚis_Floatr   r   Úto_rationalÚintr   )r   r   r   r    r!   s        r   Ú
from_sympyzPythonRationalField.from_sympy"   s`   € à�=Š=Ü! !§#¡# q§s¡sÓ+Ð+Ø�ZŠZÝ.Ø—>‘> !Ó$‰DˆAˆqÜ!¤# a£&¬#¨a«&Ó1Ð1ä Ð!EÈÑ!IÓJÐJr   c                 ó   — t        |«      S )z*Convert a Python `int` object to `dtype`. )r   ©ÚK1r   ÚK0s      r   Úfrom_ZZ_pythonz"PythonRationalField.from_ZZ_python-   s   € ä˜aÓ Ð r   c                 ó   — |S )z/Convert a Python `Fraction` object to `dtype`. r   r'   s      r   Úfrom_QQ_pythonz"PythonRationalField.from_QQ_python1   s   € àˆr   c                 ó*   — t        t        |«      «      S )z(Convert a GMPY `mpz` object to `dtype`. )r   r   r'   s      r   Úfrom_ZZ_gmpyz PythonRationalField.from_ZZ_gmpy5   s   € äœm¨AÓ.Ó/Ð/r   c                 óv   — t        t        |j                  «       «      t        |j                  «       «      «      S )z(Convert a GMPY `mpq` object to `dtype`. )r   r   ÚnumerÚdenomr'   s      r   Úfrom_QQ_gmpyz PythonRationalField.from_QQ_gmpy9   s*   € äœm¨A¯G©G«IÓ6Ü+¨A¯G©G«IÓ6ó8ð 	8r   c                 óf   — |j                  |«      \  }}t        t        |«      t        |«      «      S )z*Convert a mpmath `mpf` object to `dtype`. )r#   r   r$   )r(   r   r)   r    r!   s        r   Úfrom_RealFieldz"PythonRationalField.from_RealField>   s)   € à�~‰~˜aÓ ‰ˆˆ1Üœc !›f¤c¨!£fÓ-Ð-r   c                 ó   — |j                   S )zReturns numerator of `a`. )r   r   s     r   r0   zPythonRationalField.numerC   s   € à�{‰{Ðr   c                 ó   — |j                   S )zReturns denominator of `a`. )r   r   s     r   r1   zPythonRationalField.denomG   s   € à�}‰}Ðr   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚdtypeÚzeroÚoneÚaliasr   r   r   r%   r*   r,   r.   r2   r4   r0   r1   r   r   r   r
   r
   	   s]   „ ñð €EÙ�‹8€DÙ
�‹(€CØ€Eòò#ò
9ò	Kò!òò0ò8ò
.ò
ór   r
   N)r:   Úsympy.polys.domains.groundtypesr   r   r   Ú!sympy.polys.domains.rationalfieldr   Úsympy.polys.polyerrorsr   Úsympy.utilitiesr   r
   r   r   r   Ú<module>rC      s3   ðÙ <÷ YÑ XÝ ;Ý 1Ý "àô?˜-ó ?ó ñ?r   