
    ΅i,                         S SK Jr  S SKrS SKJr  S SKJr  S SKJr  S SK	J
r
  S SKJr  S SKJrJr   " S S	\
\S
9r\R                   r " S S\
\S
9rg)    N)Expr)
_sympifyit)
AtomicExpr)Number)global_parameters)S	Singletonc                   t  ^  \ 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\4S	 jrS
 r \" S\5      S 5       r\r\" S\5      S 5       r\" S\5      S 5       r\" S\5      S 5       r\r\" S\5      S 5       rS rS rS rS rU 4S jrS r S r!S r"S r#S r$S r%\" S\5      S 5       r&\&r'S r(S r)Sr*U =r+$ )IntInfinity   aL  Positive integer infinite quantity.

Integer infinity is a value in an extended integers which
is greater than all other integers.  We distinguish it from
sympy's existing notion of infinity in that it reports that
it is_integer.

Infinity is a singleton, and can be accessed by ``S.IntInfinity``,
or can be imported as ``int_oo``.
TF      Y@ c                 .    [         R                  " U 5      $ Nr   __new__clss    T/home/james-whalen/.local/lib/python3.13/site-packages/torch/utils/_sympy/numbers.pyr   IntInfinity.__new__*       !!#&&    returnc                     g)Nint_oor   selfprinters     r   	_sympystrIntInfinity._sympystr-   s    r   c                     X:X  a  U$ g r   r   r   oldnews      r   
_eval_subsIntInfinity._eval_subs0       ;J r   otherc                 :   [        U[        5      (       aq  [        R                  (       a\  U[        R
                  [        R                  4;   a  U$ U[        R                  [        R                  4;   a  [        R                  $ U $ [        R                  " X5      $ r   )

isinstancer   r   evaluater   InfinityNegativeInfinityNegativeIntInfinityNaN__add__r   r(   s     r   r0   IntInfinity.__add__=   sh    eV$$):)C)CQ%7%788..66uuK~~d**r   c                 z   [        U[        5      (       a  [        R                  (       a|  U[        R
                  L a  [        R                  $ U[        R                  L a  [        R
                  $ U[        R                  [        R                  4;   a  [        R                  $ U $ [        R                  " X5      $ r   )
r*   r   r   r+   r   r,   r-   r   r/   __sub__r1   s     r   r4   IntInfinity.__sub__I   sz    eV$$):)C)C

")))***zz!..uuK~~d**r   c                 &    U * R                  U5      $ r   r0   r1   s     r   __rsub__IntInfinity.__rsub__U       u%%r   c                 0   [        U[        5      (       al  [        R                  (       aW  UR                  (       d  U[
        R                  L a  [
        R                  $ UR                  (       a  U $ [
        R                  $ [        R                  " X5      $ r   )
r*   r   r   r+   is_zeror   r/   is_extended_positiver.   __mul__r1   s     r   r>   IntInfinity.__mul__Y   s[    eV$$):)C)C}}uu))(((~~d**r   c                    [        U[        5      (       a  [        R                  (       a  U[        R
                  [        R                  [        R                  [        R                  [        R                  4;   a  [        R                  $ UR                  (       a  [        R
                  $ [        R                  $ [        R                  " X5      $ r   r*   r   r   r+   r   r,   r   r-   r.   r/   is_extended_nonnegative__truediv__r1   s     r   rC   IntInfinity.__truediv__e   s    eV$$):)C)C

""%%  uu,,zz!%%%!!$..r   c                 "    [         R                  $ r   r   r   r   s    r   __abs__IntInfinity.__abs__u       }}r   c                 "    [         R                  $ r   r   r.   rG   s    r   __neg__IntInfinity.__neg__x   s    $$$r   c                 \   UR                   (       a  [        R                  $ UR                  (       a  [        R                  $ U[        R
                  L a  [        R
                  $ U[        R                  L a  [        R
                  $ UR                  SL a  UR                  (       a  SSK	J
n  U" U5      nUR                  (       a  [        R                  $ UR                  (       a  [        R                  $ UR                  (       a  [        R
                  $ XR                  5       -  $ g g )NFr   )re)r=   r   r   is_extended_negativeZeror/   ComplexInfinityis_extended_real	is_number$sympy.functions.elementary.complexesrP   is_positiveis_negativer<   evalf)r   exptrP   	expt_reals       r   _eval_powerIntInfinity._eval_power{   s    $$== $$66M155=55L1$$$55L  E)dnn?4I$$((($$vv  uu::<'' /=)r   c                 "    [         R                  $ r   )mlibfinfr   precs     r   _as_mpf_valIntInfinity._as_mpf_val   s    yyr   c                     > [         TU ]  5       $ r   super__hash__r   	__class__s    r   rh   IntInfinity.__hash__       w!!r   c                 &    U[         R                  L $ r   rF   r1   s     r   __eq__IntInfinity.__eq__   s    %%r   c                 &    U[         R                  L$ r   rF   r1   s     r   __ne__IntInfinity.__ne__   s    AMM))r   c                     U[         R                  L a  [        R                  $ U[         R                  L a  [        R                  $ [        R
                  $ r   r   r,   sympyfalser   truer1   s     r   __gt__IntInfinity.__gt__   s8    AJJ;;amm#;;::r   c                     U[         R                  L a  [        R                  $ U[         R                  L a  [        R
                  $ [        R
                  $ r   rt   r1   s     r   __ge__IntInfinity.__ge__   s8    AJJ;;amm#::::r   c                     U[         R                  L a  [        R                  $ U[         R                  L a  [        R
                  $ [        R
                  $ r   r   r,   ru   rw   r   rv   r1   s     r   __lt__IntInfinity.__lt__   s8    AJJ::amm#;;;;r   c                     U[         R                  L a  [        R                  $ U[         R                  L a  [        R                  $ [        R
                  $ r   r~   r1   s     r   __le__IntInfinity.__le__   s8    AJJ::amm#::;;r   c                 X    [        U[        5      (       d  [        $ [        R                  $ r   r*   r   NotImplementedr   r/   r1   s     r   __mod__IntInfinity.__mod__       %&&!!uur   c                     U $ r   r   rG   s    r   floorIntInfinity.floor       r   c                     U $ r   r   rG   s    r   ceilingIntInfinity.ceiling   r   r   ),__name__
__module____qualname____firstlineno____doc__
is_integeris_commutativerU   rT   is_comparabler=   is_prime_op_priority	__slots__r   strr   r%   r   r   r0   __radd__r4   r8   r>   __rmul__rC   rH   rM   r\   rc   rh   rn   rq   rx   r{   r   r   r   __rmod__r   r   __static_attributes____classcell__rj   s   @r   r   r      sO   	 JNIMH LI'C 
 (+ )+ H(	+ )	+ (& )& (+ )+ H(/ )/%(,"&* ( )
 H r   r   )	metaclassc                   z  ^  \ 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	\4S
 jr \" S\5      S 5       r\r\" S\5      S 5       r\" S\5      S 5       r\" S\5      S 5       r\r\" S\5      S 5       rS rS rS rS rU 4S jrS r S r!S r"S r#S r$S r%\" S\5      S 5       r&\&r'S r(S r)S r*Sr+U =r,$ ) r.      zNegative integer infinite quantity.

NegativeInfinity is a singleton, and can be accessed
by ``S.NegativeInfinity``.

See Also
========

IntInfinity
r   TFr   c                 .    [         R                  " U 5      $ r   r   r   s    r   r   NegativeIntInfinity.__new__   r   r   c                     X:X  a  U$ g r   r   r"   s      r   r%   NegativeIntInfinity._eval_subs   r'   r   r   c                     g)Nz-int_oor   r   s     r   r   NegativeIntInfinity._sympystr   s    r   r(   c                 4   [        U[        5      (       an  [        R                  (       aY  U[        R
                  L a  [        R
                  $ U[        R                  [        R                  4;   a  [        R                  $ U $ [        R                  " X5      $ r   )	r*   r   r   r+   r   r,   r   r/   r0   r1   s     r   r0   NegativeIntInfinity.__add__   s`    eV$$):)C)C

"zz!..uuK~~d**r   c                 4   [        U[        5      (       an  [        R                  (       aY  U[        R
                  L a  [        R                  $ U[        R                  [        R                  4;   a  [        R                  $ U $ [        R                  " X5      $ r   )
r*   r   r   r+   r   r-   r,   r.   r/   r4   r1   s     r   r4   NegativeIntInfinity.__sub__  sd    eV$$):)C)C***zz!..66uuK~~d**r   c                 &    U * R                  U5      $ r   r7   r1   s     r   r8   NegativeIntInfinity.__rsub__  r:   r   c                 0   [        U[        5      (       al  [        R                  (       aW  UR                  (       d  U[
        R                  L a  [
        R                  $ UR                  (       a  U $ [
        R                  $ [        R                  " X5      $ r   )
r*   r   r   r+   r<   r   r/   r=   r   r>   r1   s     r   r>   NegativeIntInfinity.__mul__  sY    eV$$):)C)C}}uu))== ~~d**r   c                    [        U[        5      (       a  [        R                  (       a  U[        R
                  [        R                  [        R                  [        R                  [        R                  4;   a  [        R                  $ UR                  (       a  U $ [        R
                  $ [        R                  " X5      $ r   rA   r1   s     r   rC   NegativeIntInfinity.__truediv__!  s    eV$$):)C)C

""%%  uu,,::!!$..r   c                 "    [         R                  $ r   rF   rG   s    r   rH   NegativeIntInfinity.__abs__1  rJ   r   c                 "    [         R                  $ r   rF   rG   s    r   rM   NegativeIntInfinity.__neg__4  rJ   r   c                    UR                   (       GaJ  U[        R                  [        R                  [        R                  [        R
                  [        R                  4;   a  [        R                  $ [        U[        R                  5      (       aB  UR                  (       a1  UR                  (       a  [        R                  $ [        R
                  $ [        R
                  U-  n[        R                  U-  nUS:X  a  UR                  (       a  U$ U[        R                  L a2  UR                  (       a!  UR                  (       d  [        R                  $ X2-  $ g )Nr   )rU   r   r/   r,   r-   r   r.   r*   ru   Integerr=   is_oddNegativeOne	is_finiterS   r<   )r   rZ   inf_parts_parts       r   r\   NegativeIntInfinity._eval_power7  s    >>>

""%%  uu$..43L3L;;000==(}}d*H]]D(F1}!1!1A---$$((($$5 r   c                 "    [         R                  $ r   )r_   fninfra   s     r   rc   NegativeIntInfinity._as_mpf_valT  s    zzr   c                     > [         TU ]  5       $ r   rf   ri   s    r   rh   NegativeIntInfinity.__hash__W  rl   r   c                 &    U[         R                  L $ r   rL   r1   s     r   rn   NegativeIntInfinity.__eq__Z  s    ----r   c                 &    U[         R                  L$ r   rL   r1   s     r   rq   NegativeIntInfinity.__ne__]  s    A1111r   c                     U[         R                  L a  [        R                  $ U[         R                  L a  [        R
                  $ [        R
                  $ r   r   r-   ru   rw   r.   rv   r1   s     r   rx   NegativeIntInfinity.__gt__`  s<    A&&&::a+++;;;;r   c                     U[         R                  L a  [        R                  $ U[         R                  L a  [        R                  $ [        R
                  $ r   r   r1   s     r   r{   NegativeIntInfinity.__ge__h  s<    A&&&::a+++::;;r   c                     U[         R                  L a  [        R                  $ U[         R                  L a  [        R                  $ [        R
                  $ r   r   r-   ru   rv   r.   rw   r1   s     r   r   NegativeIntInfinity.__lt__p  s<    A&&&;;a+++;;::r   c                     U[         R                  L a  [        R                  $ U[         R                  L a  [        R
                  $ [        R
                  $ r   r   r1   s     r   r   NegativeIntInfinity.__le__x  s<    A&&&;;a+++::::r   c                 X    [        U[        5      (       d  [        $ [        R                  $ r   r   r1   s     r   r   NegativeIntInfinity.__mod__  r   r   c                     U $ r   r   rG   s    r   r   NegativeIntInfinity.floor  r   r   c                     U $ r   r   rG   s    r   r   NegativeIntInfinity.ceiling  r   r   c                 F    [         R                  S[         R                  S0$ )N   )r   r   r   rG   s    r   as_powers_dict"NegativeIntInfinity.as_powers_dict  s    q!--33r   )-r   r   r   r   r   r   r   rT   r   r   rQ   rU   r   r   r   r%   r   r   r   r   r0   r   r4   r8   r>   r   rC   rH   rM   r\   rc   rh   rn   rq   rx   r{   r   r   r   r   r   r   r   r   r   r   s   @r   r.   r.      sR   	 LJNMIHI'C  (+ )+ H(+ )+ (& )& (+ )+ H(/ )/%:".2 ( )
 H4 4r   r.   )mpmath.libmplibmpr_   ru   r   sympy.core.decoratorsr   sympy.core.exprr   sympy.core.numbersr   sympy.core.parametersr   sympy.core.singletonr   r	   r   r   r.   r   r   r   <module>r      sI       , & % 3 -|&I |~ 
4&I 4r   