a
    kh                     @   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   s"   t tt| |dt||d|dS Nr   )r
   r   r	   x1x2r    r   G/var/www/auris/lib/python3.9/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   s"   t tt| |dt||d|dS r   )r   r   r   r   r   r   r   _logaddexp2   s    r    c                   @   s>   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   s   t j| gt|tdR  S N)keyr   __new__sortedr   clsargsr   r   r   r%   ,   s    zlogaddexp.__new__r   c                 C   sJ   |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	   selfZargindexZwrtotherr   r   r   fdiff/   s    
zlogaddexp.fdiffc                 K   s
   t ||S N)r   r-   r   r   kwargsr   r   r   _eval_rewrite_as_log;   s    zlogaddexp._eval_rewrite_as_logc                 O   s   |  tj|i |S r0   Zrewriter
   Zevalfr-   r)   r2   r   r   r   _eval_evalf>   s    zlogaddexp._eval_evalfc                    sF    fdd| j D \}}t||}|t||ddkr8|S t||S d S )Nc                 3   s   | ]}|j f i  V  qd S r0   )simplify.0r   r2   r   r   	<genexpr>B       z+logaddexp._eval_simplify.<locals>.<genexpr>Fr   )r)   r   r!   r-   r)   r2   ab	candidater   r:   r   _eval_simplifyA   s
    
zlogaddexp._eval_simplifyN)r   
__name__
__module____qualname____doc__nargsr%   r/   r3   r6   rA   r   r   r   r   r!       s   	
r!   c                   @   s>   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 )
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   s   t j| gt|tdR  S r"   r$   r'   r   r   r   r%   V   s    zlogaddexp2.__new__r   c                 C   sJ   |dkr| j \}}n|dkr(| j \}}n
t| |tjtjt||   S r*   )r)   r   r   r+   r   r,   r   r   r   r/   Y   s    
zlogaddexp2.fdiffc                 K   s
   t ||S r0   )r    r1   r   r   r   r3   e   s    zlogaddexp2._eval_rewrite_as_logc                 O   s   |  tj|i |S r0   r4   r5   r   r   r   r6   h   s    zlogaddexp2._eval_evalfc                    sF    fdd| j D \}}t||}|t||ddkr8|S t||S d S )Nc                 3   s"   | ]}|j f i   V  qd S r0   )r7   Zfactorr8   r:   r   r   r;   l   r<   z,logaddexp2._eval_simplify.<locals>.<genexpr>Fr   )r)   r    rH   r=   r   r:   r   rA   k   s
    
zlogaddexp2._eval_simplifyN)r   rB   r   r   r   r   rH   J   s   	
rH   c                   @   s(   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axisrL   NrC   rD   rE   rF   	__slots___fieldsr   defaultsstaticmethodr   Z_construct_axisr   r   r   r   rI   t   s   
rI   c                   @   s(   e Zd ZdZd ZZdeiZee	Z
dS )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
    rJ   rL   NrM   r   r   r   r   rR      s   
rR   c                   @   s   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   s
   t | j S r0   )r   r)   r-   r)   r   r   r   _eval_rewrite_as_Max   s    zmaximum._eval_rewrite_as_MaxN)rC   rD   rE   rF   rU   r   r   r   r   rS      s   rS   c                   @   s   e Zd ZdZdd ZdS )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   s
   t | j S r0   )r   r)   rT   r   r   r   _eval_rewrite_as_Min   s    zminimum._eval_rewrite_as_MinN)rC   rD   rE   rF   rW   r   r   r   r   rV      s   rV   N)"Zsympy.core.functionr   r   r   Zsympy.core.powerr   Zsympy.core.singletonr   Zsympy.core.sortingr   Zsympy.core.sympifyr   Z&sympy.functions.elementary.exponentialr	   r
   Z(sympy.functions.elementary.miscellaneousr   r   astr   r   r   r+   r   r   r   r   r    r!   rH   rI   rR   rS   rV   r   r   r   r   <module>   s&   
**