o
    ki                     @   s  U d dl Z d dlZd dlmZ e eZejejejejej	ej
ejejej
ej	ejejiZeeej eej f ed< ejej	ejej
fZdedeej dB fddZ			dd
ejdejdededeejejf dB f
ddZdejdejdedejfddZdS )    N)FloorDiv_MIRROR_REL_OPtypereturnc                 C   s
   t | S N)r   get)r    r   b/var/www/addictedbytheproject.nl/epg/venv/lib/python3.10/site-packages/torch/utils/_sympy/solve.pymirror_rel_op   s   
r
      Texprthingtrialsfloordiv_inequalityc                 C   s  t t| }t| tjr|d u rtdt|  d S | j|}| j	|}|r3|r3td||  d S g }|r<|
|  |rH|
|| j	| j |D ]@}|d u rQqJt|tjs[tdt|D ]}	t|||d}
|
|krn n|
}q_t|tjr|j|krtd| | ||j	f  S qJd S )Nz$expression with unsupported type: %sz0thing (%s) found in both sides of expression: %szexpected sympy.Rel)r   zsolved: %s ---> %s)r
   r   
isinstancesympyRellogdebuglhshasrhsappendAssertionErrorrange_try_isolate_lhs)r   r   r   r   mirrorlhs_has_thingrhs_has_thingexpressionse_trialr   r   r	   	try_solve(   s:   
r#   r    c                    s`  t | }t| tjr+t| jtjrt fdd| jjD nd}|| j| | j| } t| tjr}t| jtj	r}| j\}}tj	 fdd|jD  }t| t
rT|jd u s}t| t
s\|js}|| }|| }t| t
rp|jrpt|}|d u rxtd|||} |r.t| tjr.t| jtr.| jjjr.| jjr.t| tjr| jj\}}	tt|| j|	 t|| jd |	 S t| tjr| jj\}}	tt|| j|	 t|| jd |	 S t| tjtjfrt| tjr| jn| jd }
t| jjd |
| jjd  S t| tjtjfr.t| tjr| jn| jd }
t| jjd |
| jjd  S | S )Nc                 3   s    | ]
}|  s|V  qd S r   r   .0ar   r   r	   	<genexpr>i   s    z#_try_isolate_lhs.<locals>.<genexpr>r   c                    s   g | ]	}|  s|qS r   r$   r%   r(   r   r	   
<listcomp>r   s    z$_try_isolate_lhs.<locals>.<listcomp>zexpected op to be not None   )r   r   r   r   r   Addsumargsr   MulINEQUALITY_TYPESis_negativeis_zeror
   r   r   divisoris_positive
is_integerEqAndGeLtNeOrGtLe)r    r   r   oplhs_not_thingr   r   other	numeratordenominatorquotientr   r(   r	   r   a   sf   



	  r   )r   T)loggingr   torch.utils._sympy.functionsr   	getLogger__name__r   r6   r:   r8   r=   r<   r9   r   dictr   Basicr   __annotations__r0   r
   intbooltupleExprr#   r   r   r   r   r	   <module>   sF   
 
 	
9