ó
”¼\c           @  s   d  Z  d d l m Z m Z d d l m Z m Z m Z m Z m	 Z	 d d l
 m Z d d l m Z d d l m Z e d e f d     Y Z d	 S(
   s3   Implementaton of :class:`GMPYRationalField` class. i’’’’(   t   print_functiont   division(   t   GMPYRationalt   SymPyRationalt
   gmpy_numert
   gmpy_denomt   gmpy_factorial(   t   RationalField(   t   CoercionFailed(   t   publict   GMPYRationalFieldc           B  sĪ   e  Z d  Z e Z e d  Z e d  Z e 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 RS(   s(   Rational field based on GMPY mpq class. i    i   t   QQ_gmpyc         C  s   d  S(   N(    (   t   self(    (    sD   lib/python2.7/site-packages/sympy/polys/domains/gmpyrationalfield.pyt   __init__   s    c         C  s   d d l  m } |   S(   s'   Returns ring associated with ``self``. i’’’’(   t   GMPYIntegerRing(   t   sympy.polys.domainsR   (   R   R   (    (    sD   lib/python2.7/site-packages/sympy/polys/domains/gmpyrationalfield.pyt   get_ring   s    c         C  s%   t  t t |   t t |    S(   s   Convert `a` to a SymPy object. (   R   t   intR   R   (   R   t   a(    (    sD   lib/python2.7/site-packages/sympy/polys/domains/gmpyrationalfield.pyt   to_sympy   s    c         C  se   | j  r t | j | j  S| j rQ d d l m } t t t | j	 |     St
 d |   d S(   s$   Convert SymPy's Integer to `dtype`. i’’’’(   t   RRs"   expected `Rational` object, got %sN(   t   is_RationalR   t   pt   qt   is_FloatR   R   t   mapR   t   to_rationalR   (   R   R   R   (    (    sD   lib/python2.7/site-packages/sympy/polys/domains/gmpyrationalfield.pyt
   from_sympy$   s    		c         C  s
   t  |  S(   s*   Convert a Python `int` object to `dtype`. (   R   (   t   K1R   t   K0(    (    sD   lib/python2.7/site-packages/sympy/polys/domains/gmpyrationalfield.pyt   from_ZZ_python.   s    c         C  s   t  | j | j  S(   s/   Convert a Python `Fraction` object to `dtype`. (   R   t	   numeratort   denominator(   R   R   R   (    (    sD   lib/python2.7/site-packages/sympy/polys/domains/gmpyrationalfield.pyt   from_QQ_python2   s    c         C  s
   t  |  S(   s(   Convert a GMPY `mpz` object to `dtype`. (   R   (   R   R   R   (    (    sD   lib/python2.7/site-packages/sympy/polys/domains/gmpyrationalfield.pyt   from_ZZ_gmpy6   s    c         C  s   | S(   s(   Convert a GMPY `mpq` object to `dtype`. (    (   R   R   R   (    (    sD   lib/python2.7/site-packages/sympy/polys/domains/gmpyrationalfield.pyt   from_QQ_gmpy:   s    c         C  s   t  t t | j |     S(   s*   Convert a mpmath `mpf` object to `dtype`. (   R   R   R   R   (   R   R   R   (    (    sD   lib/python2.7/site-packages/sympy/polys/domains/gmpyrationalfield.pyt   from_RealField>   s    c         C  s   t  |  t  |  S(   s3   Exact quotient of `a` and `b`, implies `__div__`.  (   R   (   R   R   t   b(    (    sD   lib/python2.7/site-packages/sympy/polys/domains/gmpyrationalfield.pyt   exquoB   s    c         C  s   t  |  t  |  S(   s,   Quotient of `a` and `b`, implies `__div__`. (   R   (   R   R   R%   (    (    sD   lib/python2.7/site-packages/sympy/polys/domains/gmpyrationalfield.pyt   quoF   s    c         C  s   |  j  S(   s,   Remainder of `a` and `b`, implies nothing.  (   t   zero(   R   R   R%   (    (    sD   lib/python2.7/site-packages/sympy/polys/domains/gmpyrationalfield.pyt   remJ   s    c         C  s   t  |  t  |  |  j f S(   s,   Division of `a` and `b`, implies `__div__`. (   R   R(   (   R   R   R%   (    (    sD   lib/python2.7/site-packages/sympy/polys/domains/gmpyrationalfield.pyt   divN   s    c         C  s   | j  S(   s   Returns numerator of `a`. (   R   (   R   R   (    (    sD   lib/python2.7/site-packages/sympy/polys/domains/gmpyrationalfield.pyt   numerR   s    c         C  s   | j  S(   s   Returns denominator of `a`. (   R    (   R   R   (    (    sD   lib/python2.7/site-packages/sympy/polys/domains/gmpyrationalfield.pyt   denomV   s    c         C  s   t  t t |    S(   s   Returns factorial of `a`. (   R   R   R   (   R   R   (    (    sD   lib/python2.7/site-packages/sympy/polys/domains/gmpyrationalfield.pyt	   factorialZ   s    (   t   __name__t
   __module__t   __doc__R   t   dtypeR(   t   onet   typet   tpt   aliasR   R   R   R   R   R!   R"   R#   R$   R&   R'   R)   R*   R+   R,   R-   (    (    (    sD   lib/python2.7/site-packages/sympy/polys/domains/gmpyrationalfield.pyR
      s,   				
											N(   R0   t
   __future__R    R   t   sympy.polys.domains.groundtypesR   R   R   R   R   t!   sympy.polys.domains.rationalfieldR   t   sympy.polys.polyerrorsR   t   sympy.utilitiesR	   R
   (    (    (    sD   lib/python2.7/site-packages/sympy/polys/domains/gmpyrationalfield.pyt   <module>   s   (