o
    i                     @   s8   d dl mZ d dlmZ G dd dZG dd dZdS )    )numpy_support)typesc                   @   s    e Zd ZdZdd Zdd ZdS )UfuncLowererBasezHCallable class responsible for lowering calls to a specific gufunc.
    c                 C   s    || _ || _||| _g | _d S N)ufuncmake_ufunc_kernel_fnkernellibs)selfr   make_kernel_fnr    r   V/home/ubuntu/veenaModal/venv/lib/python3.10/site-packages/numba/np/ufunc/ufunc_base.py__init__   s   

zUfuncLowererBase.__init__c                 C   s   |  ||||| j| jS r   )r   r   r   )r
   contextbuildersigargsr   r   r   __call__   s   zUfuncLowererBase.__call__N)__name__
__module____qualname____doc__r   r   r   r   r   r   r      s    r   c                   @   s   e Zd Zedd Zedd Zedd Zedd Zed	d
 Zedd Z	edd Z
edd Zedd Zedd Zedd Zedd Zdd Zd ddZdd ZdS )!	UfuncBasec                 C      | j jS r   )r   ninr
   r   r   r   r         zUfuncBase.ninc                 C   r   r   )r   noutr   r   r   r   r      r   zUfuncBase.noutc                 C   r   r   )r   nargsr   r   r   r   r      r   zUfuncBase.nargsc                 C   r   r   )r   ntypesr   r   r   r   r   !   r   zUfuncBase.ntypesc                 C   r   r   )r   r   r   r   r   r   r   %   r   zUfuncBase.typesc                 C   r   r   )r   identityr   r   r   r   r    )   r   zUfuncBase.identityc                 C   r   r   )r   	signaturer   r   r   r   r!   -   r   zUfuncBase.signaturec                 C   r   r   )r   
accumulater   r   r   r   r"   1   r   zUfuncBase.accumulatec                 C   r   r   )r   atr   r   r   r   r#   5   r   zUfuncBase.atc                 C   r   r   )r   outerr   r   r   r   r$   9   r   zUfuncBase.outerc                 C   r   r   )r   reducer   r   r   r   r%   =   r   zUfuncBase.reducec                 C   r   r   )r   reduceatr   r   r   r   r&   A   r   zUfuncBase.reduceatc                 C   s   t | jjdks
J d| _dS )zI
        Disable the compilation of new signatures at call time.
        r   TN)len_dispatcher	overloads_frozenr   r   r   r   disable_compileE   s   
zUfuncBase.disable_compileNc                    sh   |du r	 j jj}tj}tj}|f jj |f jj  }|f jj }|	 fdd||fD  dS )a4  
        Install an implementation function for a GUFunc/DUFunc object in the
        given target context.  If no target context is given, then
        _install_cg() installs into the target context of the
        dispatcher object (should be same default context used by
        jit() and njit()).
        Nc                    s   g | ]} j  |fqS r   )	_lower_me).0r   r   r   r   
<listcomp>]   s    z)UfuncBase._install_cg.<locals>.<listcomp>)
r(   targetdescrtarget_contextr   AnyArrayr   r   r   insert_func_defn)r
   	targetctx_any_arrsig0sig1r   r   r   _install_cgM   s   
zUfuncBase._install_cgc                 C   sl   | j rt| |}|du rdS t|j|j dt| }| jj	 D ]\}}| 
||r3||f  S q#dS )a  
        Given a tuple of element-wise argument types, find a matching
        signature in the dispatcher.

        Return a 2-tuple containing the matching signature, and
        compilation result.  Will return two None's if no matching
        signature was found.
        N)NN)r*   r   ufunc_find_matching_looptupleinputsoutputsr'   r(   r)   itemsmatch_signature)r
   ewise_typesloopr   cresr   r   r   find_ewise_function_   s   	zUfuncBase.find_ewise_functionr   )r   r   r   propertyr   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r+   r9   rC   r   r   r   r   r      s8    












r   N)numba.npr   
numba.corer   r   r   r   r   r   r   <module>   s    