o
    3Ih                     @   s"  d dl mZmZmZ d dlmZ d dlmZ d dlm	Z	 d dl
mZ d dlmZmZ d dlmZmZ dd	lmZmZ d
dddZejd ZeeZd
dddZd
dddZd
dddZG dd deZG dd deZG dd deZG dd deZG dd deZ G dd  d eZ!d!S )"    )AddArgumentIndexErrorFunction)Pow)S)default_sort_key)sympify)explog)MaxMin   )TokennoneTevaluatec                C   "   t tt| |dt||d|dS Nr   )r
   r   r	   x1x2r    r   Y/home/air/sanwanet/gpt-api/venv/lib/python3.10/site-packages/sympy/codegen/numpy_nodes.py
_logaddexp   s   "r      c                C   s   t | |dt S r   )r
   _ln2xr   r   r   r   _lb   s   r   c                C   s   t t| |dS r   )r   _twor   r   r   r   _exp2   s   r    c                C   r   r   )r   r   r    r   r   r   r   _logaddexp2   s   r!   c                   @   >   e Zd ZdZdZdd ZdddZdd	 Zd
d Zdd Z	dS )	logaddexpz Logarithm of the sum of exponentiations of the inputs.

    Helper class for use with e.g. numpy.logaddexp

    See Also
    ========

    https://numpy.org/doc/stable/reference/generated/numpy.logaddexp.html
    r   c                 G      t j| gt|tdR  S N)keyr   __new__sortedr   clsargsr   r   r   r(   ,      zlogaddexp.__new__r   c                 C   J   |dkr
| j \}}n|dkr| j \}}nt| |tjtjt||   S z@
        Returns the first derivative of this function.
        r   r   )r,   r   r   Oner	   selfargindexwrtotherr   r   r   fdiff/      
zlogaddexp.fdiffc                 K   
   t ||S N)r   r2   r   r   kwargsr   r   r   _eval_rewrite_as_log;      
zlogaddexp._eval_rewrite_as_logc                 O      |  tj|i |S r9   rewriter
   evalfr2   r,   r;   r   r   r   _eval_evalf>      zlogaddexp._eval_evalfc                    B    fdd| j D \}}t||}|t||ddkr|S t||S )Nc                 3   s     | ]}|j di  V  qd S Nr   )simplify.0r   r;   r   r   	<genexpr>B   s    z+logaddexp._eval_simplify.<locals>.<genexpr>Fr   )r,   r   r#   r2   r,   r;   ab	candidater   rJ   r   _eval_simplifyA   
   

zlogaddexp._eval_simplifyNr   
__name__
__module____qualname____doc__nargsr(   r6   r<   rC   rP   r   r   r   r   r#           	
r#   c                   @   r"   )
logaddexp2z Logarithm of the sum of exponentiations of the inputs in base-2.

    Helper class for use with e.g. numpy.logaddexp2

    See Also
    ========

    https://numpy.org/doc/stable/reference/generated/numpy.logaddexp2.html
    r   c                 G   r$   r%   r'   r*   r   r   r   r(   V   r-   zlogaddexp2.__new__r   c                 C   r.   r/   )r,   r   r   r0   r    r1   r   r   r   r6   Y   r7   zlogaddexp2.fdiffc                 K   r8   r9   )r!   r:   r   r   r   r<   e   r=   zlogaddexp2._eval_rewrite_as_logc                 O   r>   r9   r?   rB   r   r   r   rC   h   rD   zlogaddexp2._eval_evalfc                    rE   )Nc                 3   s$    | ]}|j di   V  qd S rF   )rG   factorrH   rJ   r   r   rK   l   s   " z,logaddexp2._eval_simplify.<locals>.<genexpr>Fr   )r,   r!   rZ   rL   r   rJ   r   rP   k   rQ   zlogaddexp2._eval_simplifyNrR   rS   r   r   r   r   rZ   J   rY   rZ   c                   @   (   e Zd ZdZd ZZdeiZee	Z
dS )aminz Minimum value along an axis.

    Helper class for use with e.g. numpy.amin


    See Also
    ========

    https://numpy.org/doc/stable/reference/generated/numpy.amin.html
    arrayaxisr`   NrT   rU   rV   rW   	__slots___fieldsr   defaultsstaticmethodr   _construct_axisr   r   r   r   r]   t   
    
r]   c                   @   r\   )amaxz Maximum value along an axis.

    Helper class for use with e.g. numpy.amax


    See Also
    ========

    https://numpy.org/doc/stable/reference/generated/numpy.amax.html
    r^   r`   Nra   r   r   r   r   rh      rg   rh   c                   @      e Zd ZdZdd ZdS )maximumz Element-wise maximum of array elements.

    Helper class for use with e.g. numpy.maximum


    See Also
    ========

    https://numpy.org/doc/stable/reference/generated/numpy.maximum.html
    c                 G   
   t | j S r9   )r   r,   r2   r,   r   r   r   _eval_rewrite_as_Max   r=   zmaximum._eval_rewrite_as_MaxN)rT   rU   rV   rW   rm   r   r   r   r   rj          rj   c                   @   ri   )minimumz Element-wise minimum of array elements.

    Helper class for use with e.g. numpy.minimum


    See Also
    ========

    https://numpy.org/doc/stable/reference/generated/numpy.minimum.html
    c                 G   rk   r9   )r   r,   rl   r   r   r   _eval_rewrite_as_Min   r=   zminimum._eval_rewrite_as_MinN)rT   rU   rV   rW   rp   r   r   r   r   ro      rn   ro   N)"sympy.core.functionr   r   r   sympy.core.powerr   sympy.core.singletonr   sympy.core.sortingr   sympy.core.sympifyr   &sympy.functions.elementary.exponentialr	   r
   (sympy.functions.elementary.miscellaneousr   r   astr   r   r   r0   r   r   r   r    r!   r#   rZ   r]   rh   rj   ro   r   r   r   r   <module>   s(    
**