a
    hm                     @   s   U d dl Z d dlm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eeeej  dddZdejejeeeeejejf  d
ddZejejeejdddZdS )    N)Optional)FloorDiv_MIRROR_REL_OP)typereturnc                 C   s   t | d S N)r   get)r    r	   F/var/www/auris/lib/python3.9/site-packages/torch/utils/_sympy/solve.pymirror_rel_op   s    r      T)exprthingtrialsfloordiv_inequalityr   c                 C   s  t t| }t| tjr |d u r4tdt|  d S | j|}| j	|}|rf|rftd||  d S g }|rx|
|  |r|
|| j	| j |D ]|}|d u rqt|tjsJ t|D ]"}	t|||d}
|
|kr q|
}qt|tjr|j|krtd| | ||j	f  S qd S )Nz$expression with unsupported type: %sz0thing (%s) found in both sides of expression: %s)r   zsolved: %s ---> %s)r   r   
isinstancesympyRellogdebuglhshasrhsappendrange_try_isolate_lhs)r   r   r   r   ZmirrorZlhs_has_thingZrhs_has_thingZexpressionse_Ztrialr	   r	   r
   	try_solve)   s6    
r   )r   r   r   r   c                    sb  t | }t| tjrVt| jtjr<t fdd| jjD nd}|| j| | j| } t| tjrt| jtj	r| j\}}tj	 fdd|jD  }t| t
r|jd u st| t
s|js|| }|| }t| t
r|jrt|}|d usJ |||} |r^t| tjr^t| jtr^| jjjr^| jjr^t| tjrt| 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r4| 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       z#_try_isolate_lhs.<locals>.<genexpr>r   c                    s   g | ]}|  s|qS r	   r   r    r#   r	   r
   
<listcomp>r   r%   z$_try_isolate_lhs.<locals>.<listcomp>   )r   r   r   r   r   Addsumargsr   ZMulINEQUALITY_TYPESZis_negativeis_zeror   r   ZdivisorZis_positive
is_integerEqAndGeLtNeOrGtLe)r   r   r   opZlhs_not_thingr   r   other	numeratordenominatorZquotientr	   r#   r
   r   a   sd    



	  r   )r   T)loggingtypingr   r   Ztorch.utils._sympy.functionsr   	getLogger__name__r   r.   r2   r0   r5   r4   r1   r   dictr   ZBasicr   __annotations__r+   r   intbooltupleExprr   r   r	   r	   r	   r
   <module>   s2   

 	  9
