o
    id                     @   sr  d dl Z d dlZd dlZd dlmZ d dlmZ d dlm	Z	 d dl
mZmZmZmZ d dlmZ dd Zd	d
 Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd  Zd!d" Zd#d$ Zd%d& Z d'd( Z!d)d* Z"d+d, Z#d-d. Z$d/d0 Z%d1d2 Z&d3d4 Z'd5d6 Z(d7d8 Z)d9d: Z*d;d< Z+d=d> Z,d?d@ Z-dAdB Z.dCdD Z/dEdF Z0dGdH Z1dIdJ Z2dKdL Z3dMdN Z4dOdP Z5dQdR Z6dSdT Z7dUdV Z8dWdX Z9dYdZ Z:d[d\ Z;d]d^ Z<d_d` Z=dadb Z>ddcddZ?ddedfZ@ddgdhZAdidj ZBdkdl ZCdmdn ZDdodp ZEdqdr ZFdsdt ZGdudv ZHdwdx ZIdydz ZJd{d| ZKd}d~ ZLdd ZMdd ZNdd ZOdd ZPdd ZQdd ZRdd ZSdd ZTdd ZUdd ZVeWdZXdd ZYdd ZZdd Z[dd Z\dd Z]dd Z^dd Z_dd Z`dd Zadd Zbdd Zcdd Zddd Zedd Zfdd Zgdd Zhdd Zidd Zjdd Zkdd Zldd Zmdd Zndd ZoddÄ Zpddń ZqddǄ ZrdS )    N)ir)Constantimpl_ret_untracked)typingtypeserrorscgutilsviewerc                 C   s   | j rdgS g S )z;
    Return the modifier flags for integer arithmetic.
    nsw)signed)rettype r   R/home/ubuntu/veenaModal/venv/lib/python3.10/site-packages/numba/np/math/numbers.py_int_arith_flags   s   r   c                 C   \   |\}}|j \}}| ||||j}| ||||j}	|j||	t|jd}
t| ||j|
S N)flags)argscastreturn_typeaddr   r   contextbuildersigr   vavbtatbabresr   r   r   int_add_impl      
r$   c                 C   r   r   )r   r   r   subr   r   r   r   r   r   int_sub_impl'   r%   r'   c                 C   r   r   )r   r   r   mulr   r   r   r   r   r   int_mul_impl0   r%   r)   c              
   C   s  |j |j ksJ | d}| d}t||}t||}||d|| |j|d|| d}	|j||	dd |||}
|	||}|d|
|||}|d||}|||}||N\}}| ||
| ||| W d	   n1 sw   Y  | |||
|| ||||| W d	   n1 sw   Y  W d	   n1 sw   Y  W d	   n1 sw   Y  ||||fS )
a@  
    Reference Objects/intobject.c
    xdivy = x / y;
    xmody = (long)(x - (unsigned long)xdivy * y);
    /* If the signs of x and y differ, and the remainder is non-0,
     * C89 doesn't define whether xdivy is now the floor or the
     * ceiling of the infinitely precise quotient.  We want the floor,
     * and we have it iff the remainder's sign matches y's.
     */
    if (xmody && ((y ^ xmody) < 0) /* i.e. and signs differ */) {
        xmody += y;
        --xdivy;
        assert(xmody && ((y ^ xmody) >= 0));
    }
    *p_xdivy = xdivy;
    *p_xmody = xmody;
    r      ==Tlikely<!=N)typer	   alloca_once_valueand_icmp_signedminvalif_thennot_sdivsremxorif_elsestorer&   r   load)r   r   tyxyZEROONEresdivresmodis_overflowxdivyxmodyy_xor_xmody_ltzxmody_istruecondif_different_signsif_same_signsr   r   r   int_divmod_signed9   s:   

rM   c                 C   s.   |j rt| ||||S ||||||fS )zD
    Integer divmod(x, y).  The caller must ensure that y != 0.
    )r   rM   udivurem)r   r   r>   r?   r@   r   r   r   
int_divmodr   s   rP   c              	   C   sf  |\}}|j \}}|j}	t|	tjr|	j}	| ||||	}
| ||||	}tj||
j	dd}tj||
j	dd}|j
t||dde\}}| | j||fs\||| ||| W d    n1 sfw   Y  | t| ||	|
|\}}||| ||| W d    n1 sw   Y  W d    ||fS W d    ||fS 1 sw   Y  ||fS )NquotnameremFr-   )r   r   
isinstancer   UniTupledtyper   r	   alloca_oncer1   r;   is_scalar_zeroerror_modelfp_zero_divisionr<   rP   )r   r   r   r   zerodiv_messager   r   r   r    r>   r!   r"   rQ   rT   if_zeroif_non_zeroqrr   r   r   _int_divmod_impl|   s>   


ra   c                 C   s0   t | |||d\}}t|||||fS )Nzinteger divmod by zero)ra   r	   
pack_arrayr=   r   r   r   r   rQ   rT   r   r   r   int_divmod_impl   s   
rd   c                 C   s   t | |||d\}}||S )Nzinteger division by zerora   r=   rc   r   r   r   int_floordiv_impl      

rf   c                 C   s   |\}}|j \}}| ||||j}| ||||j}	t||	 | j|d W d    n1 s3w   Y  |||	}
t| ||j|
S )Nzdivision by zero)	r   r   r   r	   r]   rZ   r[   fdivr   r   r   r   r   int_truediv_impl   s   
rj   c                 C   s   t | |||d\}}||S )Nzinteger modulo by zerore   rc   r   r   r   int_rem_impl   rg   rk   c                 C   s&   t |tjr| jjsd|jd > S dS )Nr,   r*   F)rU   r   IntegerrZ   raise_on_fp_zero_divisionbitwidth)r   r   r   r   r   _get_power_zerodiv_return   s
   ro   c                    sR   t |jd tj |jt|  fdd}| ||||}t| ||j|S )z@
    a ^ b, where a is an integer or real, and b an integer
    r   c                    s   d}| } |dk r0d}| }|dk rt  r/| dkr%r!S td| dkr/| dkr/dS nd}|}|dkr@t| t|S |dkrX|d@ rL|| 9 }|dL }| | 9 } |dksD|r^d| S |S )	Nr*   r   T&0 cannot be raised to a negative powerr,   F         ?)OverflowErrorZeroDivisionErrormathpowfloat)r!   r"   r`   invertexp
is_integertpzerodiv_returnr   r   	int_power   s4   z!int_power_impl.<locals>.int_power)rU   r   r   rl   r   ro   compile_internalr   )r   r   r   r   r~   r#   r   rz   r   int_power_impl   s   
r   c                    s  |j d j}t|tjstt|dkrt|dk }t|}|j}t|tj	t
| ||  |d |j d |}|j} fdd}	|d}
|}|dkrc|d@ rV|	|
|}
|dL }|	||}|dksM|rrnfdd}ndd }|  |t|||
f}
|
S )	zH
    a ^ b, where a is an integer or real, and b a constant integer
    r*   rq   r   c                    s   r  | |S  | |S N)r(   fmul)r!   r"   )r   r{   r   r   r(     s   zstatic_power_impl.<locals>.mulc                    s0   | dkr r S t d| dkr| dkrdS | S )Nr   rp   r*   r,   )rt   r!   )r}   r   r   invert_impl  s   z&static_power_impl.<locals>.invert_implc                 S   s   d|  S )Nrr   r   r   r   r   r   r   ,  s   )r   valuerU   numbersIntegralNotImplementedErrorabsr   r   rl   ro   r   r1   r   r   	signature)r   r   r   r   ry   rx   r|   valltyr(   r#   r!   r   r   )r   r{   r}   r   static_power_impl   s:   


r   c                 C   "   |j dg|R  }t| ||j|S Nr/   r4   r   r   r   r   r   r   r#   r   r   r   int_slt_impl5     r   c                 C   r   Nz<=r   r   r   r   r   int_sle_impl:  r   r   c                 C   r   N>r   r   r   r   r   int_sgt_impl?  r   r   c                 C   r   Nz>=r   r   r   r   r   int_sge_implD  r   r   c                 C   r   r   icmp_unsignedr   r   r   r   r   r   int_ult_implI  r   r   c                 C   r   r   r   r   r   r   r   int_ule_implN  r   r   c                 C   r   r   r   r   r   r   r   int_ugt_implS  r   r   c                 C   r   r   r   r   r   r   r   int_uge_implX  r   r   c                 C   r   Nr+   r   r   r   r   r   int_eq_impl]  r   r   c                 C   r   Nr0   r   r   r   r   r   int_ne_implb  r   r   c                        fdd}|S )Nc           
         s`   |\}}| d|t|jd}|  |t|jd}| ||}||||}	t| ||j|	S Nr/   r   r4   r   r1   r   selectr   r   
r   r   r   r   leftrightcmp_zerolt_zeroge_zeror#   opr   r   implh  s   
z%int_signed_unsigned_cmp.<locals>.implr   r   r   r   r   r   int_signed_unsigned_cmpg  s   r   c                    r   )Nc           
         s`   |\}}| d|t|jd}|  t|jd|}| ||}||||}	t| ||j|	S r   r   r   r   r   r   r   |  s   z%int_unsigned_signed_cmp.<locals>.implr   r   r   r   r   int_unsigned_signed_cmp{  s   r   c           	      C   sH   |\}t |jd }|d||}||}||||}t| ||j|S r   )r   r1   r4   negr   r   r   )	r   r   r   r   r?   rA   ltznegatedr#   r   r   r   int_abs_impl  s   
r   c                 C      |\}t | ||j|S r   r   r   r   r   r   r   r?   r   r   r   identity_impl     r   c                 C   r   r   r   r   r   r   r   uint_abs_impl  r   r   c           	      C   sR   |j \}}|\}}| ||||j}| ||||j}|||}t| ||j|S r   )r   r   r   shlr   	r   r   r   r   valtyamttyr   amtr#   r   r   r   int_shl_impl     
r   c           	      C   sh   |j \}}|\}}| ||||j}| ||||j}|jjr&|||}n|||}t| ||j|S r   )r   r   r   r   ashrlshrr   r   r   r   r   int_shr_impl  s   
r   c                 C   R   |j \}}|\}}| ||||j}| ||||j}	|||	}
t| ||j|
S r   )r   r   r   r3   r   r   r   r   r   atbtavbvcavcbcr#   r   r   r   int_and_impl  r   r   c                 C   r   r   )r   r   r   or_r   r   r   r   r   int_or_impl  r   r   c                 C   r   r   )r   r   r   r:   r   r   r   r   r   int_xor_impl  r   r   c                 C   s:   |j \}|\}||}| ||||j}t| ||j|S r   )r   r   r   r   r   r   r   r   r   typr   r#   r   r   r   int_negate_impl  s
   
r   c                 C   0   |j \}|\}| ||||j}t| ||j|S r   r   r   r   r   r   r   r   r   int_positive_impl     r   c                 C   sR   |j \}|\}||t|jtd|jj d}| ||||j}t| ||j|S )N1   )	r   r:   r   r1   intwidthr   r   r   r   r   r   r   int_invert_impl  s
   "r   c                 C   s  |\}t |jd}t |jd}t |jd}|d||}|d||}	t||j}
|d}|d}|d}|d	}|d
}|||| || |	||
 |
| W d   n1 sew   Y  || ||	|| W d   n1 sw   Y  || |	||
 |
| W d   n1 sw   Y  || |	||
 |
| W d   n1 sw   Y  || ||
}t| ||j|S )z
    np.sign(int)
    r*   r,   r   r+   r   z.zeroz.postestz.posz.negz.exitN)r   r1   r   r4   r	   rX   append_basic_blockcbranch
goto_blockr<   branchposition_at_endr=   r   r   )r   r   r   r   r?   POSNEGrA   r   cmp_pospresultbb_zero
bb_postestbb_posbb_negbb_exitr#   r   r   r   int_sign_impl  s>   






r   c                 C   s:   |j \}|\}| ||||j}||}t| ||j|S r   )r   r   r   r   r   r   r   r   r   bool_negate_impl  
   
r   c                 C   r   r   r   r   r   r   r   bool_unary_positive_impl  r   r   c                 C      |j | }t| ||j|S r   )faddr   r   r   r   r   r   real_add_implf     
r   c                 C   r   r   )fsubr   r   r   r   r   r   real_sub_implk  r   r   c                 C   r   r   )r   r   r   r   r   r   r   real_mul_implp  r   r   c                 C   sX   t ||d  | j|d W d    n1 sw   Y  |j| }t| ||j|S )Nr*   rh   )r	   r]   rZ   r[   ri   r   r   r   r   r   r   real_div_implu  s
   
r   c                 C   s   |j |j ksJ |j }|j}| d|j g}t|||t|f}t|||}|jrQd|_	t
|d}	|j\}
}}t| |	|
|\}}|	|| |	| t||}|||||f}|||fS )Nz.numba.python.remlinkonce_odrentry)r1   modulemanglerr   FunctionTypePointerTyper	   get_or_insert_functionis_declarationlinkage	IRBuilderr   r   real_divmod_func_bodyr<   retrX   callr=   )r   r   r?   r@   floattyr   fnamefntyfn	fnbuilderfxfypmoddivmodquotientr   r   r   real_divmod|  s    
r  c              
   C   s  t ||j}t ||j}t ||j}|||}|||||}||| ||| |d}	|d}
|d}|d||	}|d||	}|d||	}|j	|ddk\}}|8 |
d||}|| ||||| ||||| W d    n1 sw   Y  W d    n1 sw   Y  | |||
|	}||| W d    n1 sw   Y  W d    n1 sw   Y  ~~||}|d||	}||M tjtjd}|t|j }| tjt||}|||g}|||}|||}t|jd	}|d
||}||||}||| W d    n	1 s3w   Y  t ||$ |||}||| |||||}||| W d    n	1 sfw   Y  ||||fS )N        g       rr   r0   r/   Tr-   )rw   doubleg      ?r   )r	   rX   r1   fremri   r   r<   fcmp_unorderedfcmp_orderedr;   r   r6   r   r   r=   r   float32float64strget_functionru   floorr   r   r   ifnotr   )r   r   vxwxr  pdiv	pfloordivr  r  rA   NZEROrB   
mod_istruewx_ltzmod_ltzif_nonzero_modif_zero_modwx_ltz_ne_mod_ltz
div_istruerealtypemaprealtypefloorfnfloordivfloordivdifffloordivincrHALFpredr   r   r   r    sl   .


	

r  c              	   C   s4  |\}}t j||jdd}t j||jdd}|jt ||ddc\}	}
|	( | j|d|sG|||}|||}|	|| |	|| W d    n1 sQw   Y  |
 t
| |||\}}|	|| |	|| W d    n1 sxw   Y  W d    n1 sw   Y  t |||||fS )NrQ   rR   rT   Fr-   zmodulo by zero)r	   rX   r1   r;   rY   rZ   r[   ri   r  r<   r  rb   r=   )r   r   r   r   locr?   r@   rQ   rT   r]   r^   r_   r`   r   r   r   real_divmod_impl  s2   	r5  c              	   C   s   |\}}t ||j}|jt ||ddQ\}}	| | j|d|s0|||}
||
| W d    n1 s:w   Y  |	 t	| |||\}}
||
| W d    n1 s[w   Y  W d    n1 sjw   Y  t
| ||j||S )NFr-   r3  )r	   rX   r1   r;   rY   rZ   r[   r  r<   r  r   r   r=   )r   r   r   r   r4  r?   r@   r#   r]   r^   rT   _r   r   r   real_mod_impl  *   
r7  c              	   C   s   |\}}t ||j}|jt ||ddQ\}}	| | j|d|s0|||}
||
| W d    n1 s:w   Y  |	 t	| |||\}
}||
| W d    n1 s[w   Y  W d    n1 sjw   Y  t
| ||j||S )NFr-   rh   )r	   rX   r1   r;   rY   rZ   r[   ri   r<   r  r   r   r=   )r   r   r   r   r4  r?   r@   r#   r]   r^   rQ   r6  r   r   r   real_floordiv_impl+  r8  r9  c           
      C   s^   |\}}|j }| jr| tj|}|||}n|d|jg}	||	||f}t| ||j	|S )Nzllvm.pow)
r   implement_powi_as_math_callr  ru   rv   declare_intrinsicr1   r  r   r   )
r   r   r   r   r?   r@   r   impr#   r  r   r   r   real_power_impl>  s   r=  c                 C   r   r   r  r   r   r   r   r   r   real_lt_implJ  r   r?  c                 C   r   r   r>  r   r   r   r   real_le_implO  r   r@  c                 C   r   r   r>  r   r   r   r   real_gt_implT  r   rA  c                 C   r   r   r>  r   r   r   r   real_ge_implY  r   rB  c                 C   r   r   r>  r   r   r   r   real_eq_impl^  r   rC  c                 C   r   r   )r  r   r   r   r   r   r   real_ne_implc  r   rD  c                 C   s,   |j \}t||}| tj|}|||S r   )r   r   r   r  ru   fabs)r   r   r   r   r>   r   r   r   r   real_abs_implh  s   
rF  c                 C   s,   ddl m} |||d }t| ||j|S Nr   mathimpl)numba.cpythonrI  negate_realr   r   )r   r   r   r   rI  r#   r   r   r   real_negate_implo  s   rL  c                 C   r   r   r   r   r   r   r   real_positive_implu  r   rM  c                 C   s~  |\}t |jd}t |jd}t |jd}t||j}|d||}	|d||}
||	{\}}| ||| W d   n1 sEw   Y  |O ||
:\}}| ||| W d   n1 shw   Y  | ||| W d   n1 sw   Y  W d   n1 sw   Y  W d   n1 sw   Y  W d   n1 sw   Y  ||}t| ||j	|S )z
    np.sign(float)
    r*   r,   r   r   r/   N)
r   r1   r	   rX   r  r;   r<   r=   r   r   )r   r   r   r   r?   r   r   rA   r   is_posis_neggt_zeronot_gt_zeror   not_lt_zeror#   r   r   r   real_sign_impl|  s6   
rS  c                 C   $   | j |||d}|j}t| |||S Nr   )make_complexrealr   r   r   r   r   cplxr#   r   r   r   complex_real_impl     r[  c                 C   rT  rU  )rW  imagr   rY  r   r   r   complex_imag_impl  r\  r^  c                 C   sL   ddl m} | ||jd |d }|||j|_| }t| ||j|S rG  )	rJ  rI  rW  r   rK  r]  	_getvaluer   r   )r   r   r   r   rI  zr#   r   r   r   complex_conjugate_impl  s
   ra  c                 C   s   t | |||S r   r   )r   r   r   r   r   r   r   real_real_impl     rb  c                 C   s   t |j}t| |||S r   )r	   get_null_valuer1   r   )r   r   r   r   r#   r   r   r   real_imag_impl  s   re  c                 C   s   t | ||j|d S Nr   r   r   r   r   r   r   r   r   real_conjugate_impl  s   rh  c              	   C   s  |\}}|j d }|j}| j|||d}| j|||d}	| ||}
|j}| }|	 }|
 }| |d}| |d}|d|	j|}|d|	j|}|	||}|
|m\}}|! t| ||||f}| j|||d}|j|
_|j|
_W d    n1 sw   Y  |. tjdtjdi| }tt |jgd }t|||}|||||f W d    n1 sw   Y  W d    n1 sw   Y  ||}t| ||j|S )Nr   rV  r   r+   numba_cpowf
numba_cpow   )r   underlying_floatmake_helperr   _getpointerget_constantr  rX  r]  r3   r;   complex_mul_implr   	complex64
complex128r   r   VoidTyper1   r	   r  r  r=   r   r   )r   r   r   r   cacbr>   ftyr!   r"   cr   papbpcTWOrA   b_real_is_twob_imag_is_zerob_is_twothen	otherwiser#   cres	func_namer
  cpowr   r   r   complex_power_impl  sH   


r  c                 C      |\}}|j d }| j|||d}| j|||d}| ||}	|j}
|j}|j}|j}||
||	_||||	_|	 }t| ||j|S Nr   rV  )r   rW  rX  r]  r   r_  r   r   r   r   r   r   cxcyr>   r?   r@   r`  r!   r"   rw  dr#   r   r   r   complex_add_impl     
r  c                 C   r  r  )r   rW  rX  r]  r   r_  r   r   r  r   r   r   complex_sub_impl  r  r  c                 C   s   |\}}|j d }| j|||d}| j|||d}| ||}	|j}
|j}|j}|j}||
|}|||}||
|}|||}||||	_||||	_|	 }t| ||j	|S )z'
    (a+bi)(c+di)=(ac-bd)+i(ad+bc)
    r   rV  )
r   rW  rX  r]  r   r   r   r_  r   r   )r   r   r   r   r  r  r>   r?   r@   r`  r!   r"   rw  r  acbdadbcr#   r   r   r   rp  +  s"   
rp  nanc                 C   (   dd }|  ||||}t| ||j|S )Nc                 S   s   | j }| j}|j }|j}|s|stdt|t|kr>|s#tttS || }|||  }t|||  | |||  | S |sEtttS || }|| | }t| j | | j | | j| | j  | S )Nzcomplex division by zero)rX  r]  rt   r   complexNAN)r!   r"   arealaimagbrealbimagratiodenomr   r   r   complex_divE  s.   

z%complex_div_impl.<locals>.complex_divr   r   r   )r   r   r   r   r  r#   r   r   r   complex_div_implD  s   r  c           	      C   sn   ddl m} |j\}|\}| j|||d}| ||}|||j|_|||j|_| }t| ||j	|S )Nr   rH  rV  )
rJ  rI  r   rW  rK  rX  r]  r_  r   r   )	r   r   r   r   rI  r   r   cmplxr#   r   r   r   complex_negate_impld  s   r  c                 C   r   r   r   r   r   r   r   r   r   r   r   complex_positive_implp  r   r  c                 C   r   |\}}|j d }| j|||d}| j|||d}|d|j|j}	|d|j|j}
||	|
}t| ||j|S )Nr   rV  r+   )r   rW  r  rX  r]  r3   r   r   )r   r   r   r   r  r  r   r?   r@   reals_are_eqimags_are_eqr#   r   r   r   complex_eq_implu     
r  c                 C   r  )Nr   rV  r0   )r   rW  r  rX  r]  r   r   r   )r   r   r   r   r  r  r   r?   r@   reals_are_neimags_are_ner#   r   r   r   complex_ne_impl  r  r  c                 C   r  )z)
    abs(z) := hypot(z.real, z.imag)
    c                 S   s   t | j| jS r   )ru   hypotrX  r]  )r`  r   r   r   complex_abs  s   z%complex_abs_impl.<locals>.complex_absr  )r   r   r   r   r  r#   r   r   r   complex_abs_impl  s   r  c                 C   s   |d S )z;
    The no-op .item() method on booleans and numbers.
    r   r   rg  r   r   r   number_item_impl  s   r  c                 C   s:   |j \}|\}| ||||j}||}t| ||j|S r   )r   r   r   r7   r   )r   r   r   r   r   r   istruer#   r   r   r   number_not_impl  r   r  c                 C   s
   |\}|S r   r   r  r   r   r   bool_as_bool  s   r  c                 C      |\}| d|t|jdS )Nr0   r   )r   r   r1   r  r   r   r   int_as_bool     r  c                 C   r  )Nr0   r  )r  r   r1   r  r   r   r   float_as_bool  r  r  c                 C   s^   |j \}|\}| |||}|j|j}}t|jd}	|d||	}
|d||	}||
|S )Nr  r0   )r   rW  rX  r]  r   r1   r  r   )r   r   r   r   r   r   r  rX  r]  zeroreal_istrueimag_istruer   r   r   complex_as_bool  s   r  c                 C   s$   |  ||j|j}| |||j|S r   )get_constant_genericliteral_typeliteral_valuer   r   r   fromtytotyr   litr   r   r   literal_int_to_number  s   r  c                 C   sX   |j |j kr|S |j |j k r||| |S |jr#||| |S ||| |S r   )rn   truncget_value_typer   sextzextr   r   r  r  r   r   r   r   integer_to_integer  s   r  c                 C   s   | || |S r   )inttoptrr  r  r   r   r   integer_to_voidptr  s   r  c                 C   s.   |  |}|j|jk r|||S |||S r   )r  rn   fpextfptruncr   r   r  r  r   r   r   r   r   float_to_float  s   
r  c                 C   s(   |  |}|jr|||S |||S r   )r  r   sitofpuitofpr  r   r   r   integer_to_float     
r  c                 C   s(   |  |}|jr|||S |||S r   )r  r   fptosifptouir  r   r   r   float_to_integer  r  r  c                 C   s@   |  ||||j}| |jd}| ||}||_||_| S rf  )r   rl  ro  rW  rX  r]  r_  )r   r   r  r  r   rX  r]  r  r   r   r   non_complex_to_complex!  s   r  c           	      C   sX   |j }|j }| j|||d}| ||}| ||j|||_| ||j|||_| S rU  )rl  rW  r   rX  r]  r_  )	r   r   r  r  r   srctydsttysrcdstr   r   r   complex_to_complex+  s   r  c                 C   s   |  |||S r   )is_truer  r   r   r   any_to_boolean6  rc  r  c                 C   s$   | |td}| ||tj|S )N    )r  r   IntTyper   r   int32)r   r   r  r  r   asintr   r   r   boolean_to_any:  s   r  c                 C   s"   |  ||j|j}| ||j|S r   )r  r  r  r  r  r   r   r   literal_int_to_booleanA  s   r  c                 C   s4   |j }| |||j}| |||j}t||fS r   )rl  r  rX  r]  r   literal_struct)r   r   r>   pyvalrv  rX  r]  r   r   r   constant_complexM  s   r  c                 C   s&   t |tjr
t|}| |}||S r   )rU   npbool_boolr  )r   r   r>   r  r   r   r   r   constant_integerV  s   
r  c                 C   sL   t | tjtjfr"t |tjjr$| j|jjkrt	ddd }|S dS dS )z) Typing for the np scalar 'view' method. zOChanging the dtype of a 0d array is only supported if the itemsize is unchangedc                 S   s
   t | |S r   r
   )scalarviewtyr   r   r   r   m  s   
zscalar_view.<locals>.implN)
rU   r   Floatrl   abstract	DTypeSpecrn   rW   r   TypingError)r  r  r   r   r   r   scalar_viewd  s   r  r   )sru   r   numpyr  llvmliter   llvmlite.irr   numba.core.imputilsr   
numba.corer   r   r   r	   numba.cpython.unsafe.numbersr   r   r$   r'   r)   rM   rP   ra   rd   rf   rj   rk   ro   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r5  r7  r9  r=  r?  r@  rA  rB  rC  rD  rF  rL  rM  rS  r[  r^  ra  rb  re  rh  r  r  r  rp  rw   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r   r   r   <module>   s    			9

	/=							*Q
m

@) #

	
	