
    J/Phk                        d dl Zd dlmZmZmZmZ d dlmZ d dl	m
Z
mZmZmZmZmZmZ d dlZd Zd Zd Zd Zd	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Z d Z!d Z"d Z#d Z$d Z%d Z&d Z'd Z(d Z)d Z*d Z+d Z,d  Z-d! Z.d" Z/d# Z0d$ Z1d% Z2d& Z3d' Z4d( Z5d) Z6d* Z7d+ Z8d, Z9d- Z: G d. d/e          Z;e<d0k    r ej=                     dS dS )1    N)skip_unless_cc_53unittestCUDATestCaseskip_on_cudasim)numpy_support)cudafloat32float64int32	vectorizevoidint64c                 h    t          j        d          }t          j        | |                   ||<   d S N   )r   gridmathacosABis      a/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/numba/cuda/tests/cudapy/test_math.py	math_acosr      (    	!A9QqT??AaDDD    c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   asinr   s      r   	math_asinr      r   r   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   atanr   s      r   	math_atanr"      r   r   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   acoshr   s      r   
math_acoshr%      *    	!A:adAaDDDr   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   asinhr   s      r   
math_asinhr)      r&   r   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   atanhr   s      r   
math_atanhr,   $   r&   r   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   cosr   s      r   math_cosr/   )   (    	!A8AaD>>AaDDDr   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   sinr   s      r   math_sinr3   .   r0   r   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   tanr   s      r   math_tanr6   3   r0   r   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   coshr   s      r   	math_coshr9   8   r   r   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   sinhr   s      r   	math_sinhr<   =   r   r   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   tanhr   s      r   	math_tanhr?   B   r   r   c                 v    t          j        d          }t          j        | |         ||                   ||<   d S r   )r   r   r   atan2r   r   Cr   s       r   
math_atan2rD   G   0    	!A:adAaD!!AaDDDr   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   expr   s      r   math_exprH   L   r0   r   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   erfr   s      r   math_erfrK   Q   r0   r   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   erfcr   s      r   	math_erfcrN   V   r   r   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   expm1r   s      r   
math_expm1rQ   [   r&   r   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   fabsr   s      r   	math_fabsrT   `   r   r   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   gammar   s      r   
math_gammarW   e   r&   r   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   lgammar   s      r   math_lgammarZ   j   s*    	!A;qtAaDDDr   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   logr   s      r   math_logr]   o   r0   r   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   log2r   s      r   	math_log2r`   t   r   r   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   log10r   s      r   
math_log10rc   y   r&   r   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   log1pr   s      r   
math_log1prf   ~   r&   r   c                 v    t          j        d          }t          j        | |         ||                   ||<   d S r   )r   r   r   	remainderrB   s       r   math_remainderri      s0    	!A>!A$!%%AaDDDr   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   sqrtr   s      r   	math_sqrtrl      r   r   c                 v    t          j        d          }t          j        | |         ||                   ||<   d S r   )r   r   r   hypotrB   s       r   
math_hypotro      rE   r   c                 v    t          j        d          }t          j        | |         ||                   ||<   d S r   )r   r   r   powrB   s       r   math_powrr      s0    	!A8AaD!A$AaDDDr   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   ceilr   s      r   	math_ceilru      r   r   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   floorr   s      r   
math_floorrx      r&   r   c                 v    t          j        d          }t          j        | |         ||                   ||<   d S r   )r   r   r   copysignrB   s       r   math_copysignr{      s0    	!A=1qt$$AaDDDr   c                 v    t          j        d          }t          j        | |         ||                   ||<   d S r   )r   r   r   fmodrB   s       r   	math_fmodr~      s0    	!A9QqT1Q4  AaDDDr   c                 t    t          j        d          }t          j        | |                   \  ||<   ||<   d S r   )r   r   r   modfrB   s       r   	math_modfr      s0    	!A1Q4JAaD!A$$$r   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   isnanr   s      r   
math_isnanr      r&   r   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   isinfr   s      r   
math_isinfr      r&   r   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   isfiniter   s      r   math_isfiniter      s*    	!A=1AaDDDr   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   degreesr   s      r   math_degreesr      *    	!A<!AaDDDr   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   radiansr   s      r   math_radiansr      r   r   c                 h    t          j        d          }t          j        | |                   ||<   d S r   )r   r   r   truncr   s      r   
math_truncr      r&   r   c                 V    t          j        d          }| |         ||         z  ||<   d S r   r   r   rB   s       r   math_pow_binopr      s(    	!AQ41Q4<AaDDDr   c                 V    t          j        d          }| |         ||         z  ||<   d S r   r   rB   s       r   math_mod_binopr      s(    	!AQ4!A$;AaDDDr   c                   4   e Zd ZdJdZdJdZdJdZdKdZdKdZd	 Zd
 Z	d Z
d ZdJdZdJdZdLdZdLdZd ZdJdZdJdZdKdZdKdZd Zd Zd Zd Zd Zd Zd Zd Zed             Z ed           ed!                         Z d" Z!d# Z"d$ Z#d% Z$d& Z%d' Z&d( Z'd) Z(d* Z)d+ Z*d, Z+d- Z,d. Z-d/ Z.d0 Z/d1 Z0d2 Z1d3 Z2 ed4          d5             Z3d6 Z4d7 Z5d8 Z6d9 Z7d: Z8d; Z9d< Z:d= Z; ed>          d?             Z<d@ Z=dA Z>dB Z?dC Z@dD ZAdE ZBdF ZCdG ZDdH ZEdIS )MTestCudaMathr   r   c                 b    |                      ||t          j        t          j        ||           d S N)unary_templatenpfloat16selffuncnpfuncstartstops        r   unary_template_float16z#TestCudaMath.unary_template_float16   *    D&"*bj%NNNNNr   c                 b    |                      ||t          j        t          j        ||           d S r   r   r   r	   r   s        r   unary_template_float32z#TestCudaMath.unary_template_float32   r   r   c                 b    |                      ||t          j        t          j        ||           d S r   r   r   r
   r   s        r   unary_template_float64z#TestCudaMath.unary_template_float64   r   r   2   c                 b    |                      ||t          j        t          j        ||           d S r   )r   r   r   r
   r   s        r   unary_template_int64z!TestCudaMath.unary_template_int64   s*    D&"(BJtLLLLLr   c                 b    |                      ||t          j        t          j        ||           d S r   )r   r   uint64r
   r   s        r   unary_template_uint64z"TestCudaMath.unary_template_uint64   s*    D&")RZMMMMMr   c                 *   d}t          j        |||                              |          }t          j        |                              |          }	t	          j        |          d d d         }
t	          j        |          d d d         } t          j        |
|f          |          } |d|f         ||	           |t           j        k    rd}n|t           j	        k    rd}nd}t           j
                             ||          |	|           d S )Nr   r   gvIh%<=ư>gMbP?rtol)r   linspaceastype
empty_liker   
from_dtyper   jitr
   r	   testingassert_allclose)r   r   r   npdtype	nprestyper   r   nelemr   r   arytyperestypecfuncr   s                 r   r   zTestCudaMath.unary_template   s   KtU++227;;M!##I..*733CCaC8*955ccc:,'7+,,T22ah1 bj  DD
""DDD

""66!99ad";;;;;r   c           
      r   t          j        |          }|j        dz  }t          j        d||j        dd|j        t           j        t           j        g|          }t          j        |t           j                  } t          j
        |d d d         t          d d d         f          |          }	 |	d|j        f         ||           t           j                            | ||                      |	d|j        f         | |           t           j                            | ||                      d S )N   g        g      ?g      ?dtyper   )r   finfotinyarraymaxinfnanr   r   r   r   sizer   assert_array_equal)
r   r   r   r   npmtypefidenormr   r   r   s
             r   unary_bool_special_valuesz&TestCudaMath.unary_bool_special_values   s   Xg1Hb&"'3BFBFBFK"$ $ $M!28,,,4'##A#,ccc
344T::aiA

%%a333ai!Q

%%a44444r   c                 T    |                      ||t          j        t                     d S r   )r   r   r	   r   r   r   s      r   !unary_bool_special_values_float32z.TestCudaMath.unary_bool_special_values_float32  $    &&tVRZIIIIIr   c                 T    |                      ||t          j        t                     d S r   )r   r   r
   r   s      r   !unary_bool_special_values_float64z.TestCudaMath.unary_bool_special_values_float64  r   r   c                 b    |                      ||t          j        t          j        ||           d S r   r   r   s        r   unary_bool_template_float32z(TestCudaMath.unary_bool_template_float32  r   r   c                 b    |                      ||t          j        t          j        ||           d S r   r   r   s        r   unary_bool_template_float64z(TestCudaMath.unary_bool_template_float64  r   r   1   c                 b    |                      ||t          j        t          j        ||           d S r   )r   r   r   r   s        r   unary_bool_template_int32z&TestCudaMath.unary_bool_template_int32  *    D&"(BHeTJJJJJr   c                 b    |                      ||t          j        t          j        ||           d S r   )r   r   r   r   s        r   unary_bool_template_int64z&TestCudaMath.unary_bool_template_int64  r   r   c                    d}t          j        |||                              |          }t          j        |j        t           j                  }	|d d d         }
t
          d d d         } t          j        |
|f          |          } |d|f         ||	           t           j        	                     ||          |	           d S )Nr   r   r   )
r   r   r   emptyshaper   r   r   r   r   )r   r   r   r   r   r   r   r   r   r   iarytypeoarytyper   s                r   unary_bool_templatez TestCudaMath.unary_bool_template  s    KtU++227;;HQWBH---33Q3<1:.(H-..t44ah1

""66!99a00000r   c                 b    |                      ||t          j        t          j        ||           d S r   )binary_templater   r	   r   s        r   binary_template_float32z$TestCudaMath.binary_template_float32'  *    T62:rz5$OOOOOr   c                 b    |                      ||t          j        t          j        ||           d S r   )r   r   r
   r   s        r   binary_template_float64z$TestCudaMath.binary_template_float64*  r   r   c                 b    |                      ||t          j        t          j        ||           d S r   )r   r   r   r
   r   s        r   binary_template_int64z"TestCudaMath.binary_template_int64-  s*    T628RZMMMMMr   c                 b    |                      ||t          j        t          j        ||           d S r   )r   r   r   r
   r   s        r   binary_template_uint64z#TestCudaMath.binary_template_uint640  s*    T629bj%NNNNNr   c                    d}t          j        |||                              |          }t          j        |                              |          }	t	          j        |          d d d         }
t	          j        |          d d d         } t          j        |
|
|f          |          } |d|f         |||	           t           j        	                     |||          |	           d S )Nr   r   )
r   r   r   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   r   r   s                r   r   zTestCudaMath.binary_template3  s    KtU++227;;M!##I..*733CCaC8*955ccc:5'7G455d;;ah1a   

""66!Q<<33333r   c                 :   |                      t          t          j                   |                     t          t          j                   |                     t          t          j        dd           |                     t          t          j        dd           d S Nr   r   r   )r   r   r   arccosr   r   r   r   s    r   test_math_acoszTestCudaMath.test_math_acos@  x    ##Iry999##Iry999 	!!)RYaa!HHH""9biqq"IIIIIr   c                 :   |                      t          t          j                   |                     t          t          j                   |                     t          t          j        dd           |                     t          t          j        dd           d S r   )r   r   r   arcsinr   r   r   r   s    r   test_math_asinzTestCudaMath.test_math_asinK  r   r   c                 .   |                      t          t          j                   |                     t          t          j                   |                     t          t          j                   |                     t          t          j                   d S r   )r   r"   r   arctanr   r   r   r   s    r   test_math_atanzTestCudaMath.test_math_atanV  sh    ##Iry999##Iry999!!)RY777""9bi88888r   c                 F   |                      t          t          j        dd           |                     t          t          j        dd           |                     t          t          j        dd           |                     t          t          j        dd           d S )Nr      r   )r   r%   r   arccoshr   r   r   r   s    r   test_math_acoshzTestCudaMath.test_math_acosh_  s    ##J
!!#LLL##J
!!#LLL!!*bj!JJJ"":rz"KKKKKr   c                 .   |                      t          t          j                   |                     t          t          j                   |                     t          t          j                   |                     t          t          j                   d S r   )r   r)   r   arcsinhr   r   r   r   s    r   test_math_asinhzTestCudaMath.test_math_asinhh  sh    ##J
;;;##J
;;;!!*bj999"":rz:::::r   c                 F   |                      t          t          j        dd           |                     t          t          j        dd           |                     t          t          j        dd           |                     t          t          j        dd           d S )Nr   g?r   )r   r,   r   arctanhr   r   r   r   s    r   test_math_atanhzTestCudaMath.test_math_atanhq  s    ##J
!"#MMM##J
!"#MMM!!*bj!KKK"":rz"LLLLLr   c                 .   |                      t          t          j                   |                     t          t          j                   |                     t          t          j                   |                     t          t          j                   d S r   )r   r/   r   r.   r   r   r   r   s    r   test_math_coszTestCudaMath.test_math_cosz  h    ##Hbf555##Hbf555!!(BF333""8RV44444r   c                    |                      t          t          j                   |                      t          t          j                   |                      t          t          j                   |                      t          t          j	        d           |                      t          t          j        d           |                      t          t          j        d           |                      t          t          j        d           |                      t           t          j                   |                      t$          t          j                   |                      t(          t          j                   d S )Nr   r   )r   r3   r   r2   r/   r.   rH   rG   r]   r\   r`   r_   rc   rb   rT   rS   rl   rk   ru   rt   rx   rw   r   s    r   test_math_fp16zTestCudaMath.test_math_fp16  s   ##Hbf555##Hbf555##Hbf555##HbfA#>>>##Irwa#@@@##J#BBB##Irwb#AAA##Irw777##Irw777##J99999r   z(numpy does not support trunc for float16c                 P    |                      t          t          j                   d S r   )r   r   r   r   r   s    r   test_math_fp16_truncz!TestCudaMath.test_math_fp16_trunc  s"     	##J99999r   c                 .   |                      t          t          j                   |                     t          t          j                   |                     t          t          j                   |                     t          t          j                   d S r   )r   r3   r   r2   r   r   r   r   s    r   test_math_sinzTestCudaMath.test_math_sin  r  r   c                 .   |                      t          t          j                   |                     t          t          j                   |                     t          t          j                   |                     t          t          j                   d S r   )r   r6   r   r5   r   r   r   r   s    r   test_math_tanzTestCudaMath.test_math_tan  r  r   c                 .   |                      t          t          j                   |                     t          t          j                   |                     t          t          j                   |                     t          t          j                   d S r   )r   r9   r   r8   r   r   r   r   s    r   test_math_coshzTestCudaMath.test_math_cosh  h    ##Irw777##Irw777!!)RW555""9bg66666r   c                 .   |                      t          t          j                   |                     t          t          j                   |                     t          t          j                   |                     t          t          j                   d S r   )r   r<   r   r;   r   r   r   r   s    r   test_math_sinhzTestCudaMath.test_math_sinh  r  r   c                 .   |                      t          t          j                   |                     t          t          j                   |                     t          t          j                   |                     t          t          j                   d S r   )r   r?   r   r>   r   r   r   r   s    r   test_math_tanhzTestCudaMath.test_math_tanh  r  r   c                 .   |                      t          t          j                   |                     t          t          j                   |                     t          t          j                   |                     t          t          j                   d S r   )r   rD   r   arctan2r   r   r   r   s    r   test_math_atan2zTestCudaMath.test_math_atan2  sh    $$Z<<<$$Z<<<"":rz:::##J
;;;;;r   c                     t           d             }|                     t          |           |                     t          |           |                     t          |           |                     t          |           d S )Nc                 *    t          j        |           S r   )r   rJ   xs    r   ufuncz)TestCudaMath.test_math_erf.<locals>.ufunc  s    8A;;r   )r   r   rK   r   r   r   r   r)  s     r   test_math_erfzTestCudaMath.test_math_erf  sy    		 	 
	##He444##He444!!(E222""8U33333r   c                     t           d             }|                     t          |           |                     t          |           |                     t          |           |                     t          |           d S )Nc                 *    t          j        |           S r   )r   rM   r'  s    r   r)  z*TestCudaMath.test_math_erfc.<locals>.ufunc  s    9Q<<r   )r   r   rN   r   r   r   r*  s     r   test_math_erfczTestCudaMath.test_math_erfc  sy    		  	  
	 ##Iu555##Iu555!!)U333""9e44444r   c                 .   |                      t          t          j                   |                     t          t          j                   |                     t          t          j                   |                     t          t          j                   d S r   )r   rH   r   rG   r   r   r   r   s    r   test_math_expzTestCudaMath.test_math_exp  r  r   c                 .   |                      t          t          j                   |                     t          t          j                   |                     t          t          j                   |                     t          t          j                   d S r   )r   rQ   r   rP   r   r   r   r   s    r   test_math_expm1zTestCudaMath.test_math_expm1  h    ##J999##J999!!*bh777"":rx88888r   c                 >   |                      t          t          j        d           |                     t          t          j        d           |                     t          t          j        d           |                     t          t          j        d           d S Nr  r  )r   rT   r   rS   r   r   r   r   s    r   test_math_fabszTestCudaMath.test_math_fabs  s|    ##Irwb#AAA##Irwb#AAA!!)RWB!???""9bgR"@@@@@r   c                    t           d             }|                     t          |d           |                     t          |d           |                     t          |d           |                     t          |d           d S )Nc                 *    t          j        |           S r   )r   rV   r'  s    r   r)  z+TestCudaMath.test_math_gamma.<locals>.ufunc  s    :a== r   皙?r  r   )r   r   rW   r   r   r   r*  s     r   test_math_gammazTestCudaMath.test_math_gamma  s    		! 	! 
	!##JS#AAA##JS#AAA!!*e1!==="":uA">>>>>r   c                    t           d             }|                     t          |d           |                     t          |d           |                     t          |d           |                     t          |d           d S )Nc                 *    t          j        |           S r   )r   rY   r'  s    r   r)  z,TestCudaMath.test_math_lgamma.<locals>.ufunc  s    ;q>>!r   r9  r  r   )r   r   rZ   r   r   r   r*  s     r   test_math_lgammazTestCudaMath.test_math_lgamma
  s    		" 	" 
	"##Kc#BBB##Kc#BBB!!+uA!>>>"";Q"?????r   c                 >   |                      t          t          j        d           |                     t          t          j        d           |                     t          t          j        d           |                     t          t          j        d           d S Nr   r  )r   r]   r   r\   r   r   r   r   s    r   test_math_logzTestCudaMath.test_math_log  s|    ##HbfA#>>>##HbfA#>>>!!(BF!!<<<""8RV1"=====r   c                 >   |                      t          t          j        d           |                     t          t          j        d           |                     t          t          j        d           |                     t          t          j        d           d S r?  )r   r`   r   r_   r   r   r   r   s    r   test_math_log2zTestCudaMath.test_math_log2  s|    ##Irwa#@@@##Irwa#@@@!!)RWA!>>>""9bgQ"?????r   c                 >   |                      t          t          j        d           |                     t          t          j        d           |                     t          t          j        d           |                     t          t          j        d           d S r?  )r   rc   r   rb   r   r   r   r   s    r   test_math_log10zTestCudaMath.test_math_log10(  s|    ##J#BBB##J#BBB!!*bha!@@@"":rxq"AAAAAr   c                 .   |                      t          t          j                   |                     t          t          j                   |                     t          t          j                   |                     t          t          j                   d S r   )r   rf   r   re   r   r   r   r   s    r   test_math_log1pzTestCudaMath.test_math_log1p1  r3  r   c                 >   |                      t          t          j        d           |                     t          t          j        d           |                     t          t          j        d           |                     t          t          j        d           d S )Ngdy=r  r   )r   ri   r   rh   r   r   r   r   s    r   test_math_remainderz TestCudaMath.test_math_remainder:  s|    $$^R\$OOO$$^R\$OOO"">2<q"III##NBL#JJJJJr   z3math.remainder(0, 0) raises a ValueError on CUDASimc                 L   t          j        t          t          d d d         t          t                              d             }t          j        dt
          j                  } |d         |dd           |                     t          j        |d                              d S )Nr   c                 6    t          j        ||          | d<   d S )Nr   )r   rh   )rr(  ys      r   test_0_0z6TestCudaMath.test_math_remainder_0_0.<locals>.test_0_0B  s    >!Q''AaDDDr   )r   r   r   )	r   r   r   r
   r   r   zeros
assertTruer   )r   rM  rK  s      r   test_math_remainder_0_0z$TestCudaMath.test_math_remainder_0_0@  s    	$wsss|UE22	3	3	( 	( 
4	3	(HQ
##q!Q1'''''r   c                 .   |                      t          t          j                   |                     t          t          j                   |                     t          t          j                   |                     t          t          j                   d S r   )r   rl   r   rk   r   r   r   r   s    r   test_math_sqrtzTestCudaMath.test_math_sqrtL  r  r   c                 .   |                      t          t          j                   |                     t          t          j                   |                     t          t          j                   |                     t          t          j                   d S r   )r   ro   r   rn   r   r   r   r   s    r   test_math_hypotzTestCudaMath.test_math_hypotU  sh    $$Z:::$$Z:::"":rx888##J99999r   c                    d}t          j        dd|                              |          }t          j        |t           j                  }t          j        |          }t          j        |          d d d         } t          j	        |t          d d d         |f          t                    } |d|f         |||           t          j        |          }t          t          |                    D ]&}	t          j        ||	         ||	                   ||	<   't           j                            t          j        ||                              |          |d           d S )Nr   r      r   r   r   r   )r   r   r   aranger   r   r   r   r   r   rr   rangelenr   rq   r   r   power)
r   r   r   r   r   rC   r   r   Crefr   s
             r   pow_template_int32zTestCudaMath.pow_template_int32^  s4   K2u%%,,W55Ie28,,,M!*733CCaC88'51:w788BBah1a   
 }Qs1vv 	+ 	+AhqtQqT**DGG

""28Aq>>#8#8#A#A14"PPPPPr   c                    |                      t          t          j                   |                     t          t          j                   |                     t          j                   |                     t          j                   d S r   )r   rr   r   rZ  r   r\  r	   r
   r   s    r   test_math_powzTestCudaMath.test_math_powo  sd    $$Xrx888$$Xrx888
+++
+++++r   c                     |                      t          t          j                   |                     t          t          j                   d S r   )r   r   r   rZ  r   r   s    r   test_math_pow_binopz TestCudaMath.test_math_pow_binopx  s8    $$^RX>>>$$^RX>>>>>r   c                 .   |                      t          t          j                   |                     t          t          j                   |                     t          t          j                   |                     t          t          j                   d S r   )r   ru   r   rt   r   r   r   r   s    r   test_math_ceilzTestCudaMath.test_math_ceil  r  r   c                 .   |                      t          t          j                   |                     t          t          j                   |                     t          t          j                   |                     t          t          j                   d S r   )r   rx   r   rw   r   r   r   r   s    r   test_math_floorzTestCudaMath.test_math_floor  r3  r   c                 P    |                      t          t          j                   d S r   )r   r   r   r   r   s    r   test_math_trunczTestCudaMath.test_math_trunc  s     ##J99999r   z%trunc only supported on NumPy float64c                     |                      t          t          j                   |                     t          t          j                   |                     t          t          j                   d S r   )r   r   r   r   r   r   r   s    r   test_math_trunc_non_float64z(TestCudaMath.test_math_trunc_non_float64  sP    ##J999!!*bh777"":rx88888r   c                     |                      t          t          j        d           |                     t          t          j        d           d S r5  )r   r{   r   rz   r   r   s    r   test_math_copysignzTestCudaMath.test_math_copysign  sB    $$]BKr$JJJ$$]BKr$JJJJJr   c                      fd} fd}d}                      d          5   |t          j        dd|          t          j        t          d d                     d d d            n# 1 swxY w Y                         d          5   |t          j        t          j        t          j         g          t          j        t          d d                     d d d            n# 1 swxY w Y                         d	          5   |t          j        t          d d                     d d d            n# 1 swxY w Y                         d
          5   |t          j        dd|          t          j        t          d d                     d d d            n# 1 swxY w Y                         d          5   |t          j        t          j        t          j         g          t          j        t          d d                     d d d            n# 1 swxY w Y                         d          5   |t          j        t          d d                     d d d            d S # 1 swxY w Y   d S )Nc                    t          j        t           j        g|           }t          j        |          }t          j        |          } t	          j        |||f          t                    } |dt          |          f         |||                               t          j	        |                                         t          j	        |                     d S )Nr   r   )
r   r   r   
zeros_liker   r   r   rY  rO  r   )r   r   r   r   rC   r   r   s         r   modf_template_nanz6TestCudaMath.test_math_modf.<locals>.modf_template_nan  s    "&///Aa  Aa  A9DHgw899)DDEE!SVV)Q1%%%OOBHQKK(((OOBHQKK(((((r   c                    |                      |          } t          j        |           }t          j        |           } t          j        |||f          t
                    } |dt          |           f         | ||           t          j        |           \  }}                    t          j	        ||                                         t          j	        ||                     d S r   )
r   r   rm  r   r   r   rY  r   rO  array_equal)	r   r   r   r   rC   r   DEr   s	           r   modf_template_comparez:TestCudaMath.test_math_modf.<locals>.modf_template_compare  s    Aa  Aa  A9DHgw899)DDEE!SVV)Q1%%%71::DAqOOBN1Q//000OOBN1Q//00000r   r   zfloat32 modf on simple floatr   
   )r   r   zfloat32 modf on +- infinityzfloat32 modf on nanzfloat64 modf on simple floatzfloat64 modf on +- infinityzfloat64 modf on nan)subTestr   r   r	   r   r   r
   )r   rn  rs  r   s   `   r   test_math_modfzTestCudaMath.test_math_modf  s   	) 	) 	) 	) 	)	1 	1 	1 	1 	1 \\899 	6 	6!!"+aU";";2:*1!!!*6 6 6 6	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 \\788 	6 	6!!"(BFRVG+<"="=RZ*1!!!*6 6 6 6	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 \\/00 	D 	DBJ
CCCC	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D \\899 	6 	6!!"+aU";";2:*1!!!*6 6 6 6	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 \\788 	6 	6!!"(BFRVG+<"="=RZ*1!!!*6 6 6 6	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 \\/00 	D 	DBJ
CCCC	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	Dsm   :A))A-0A-	AC$$C(+C(%D55D9<D9:FF"F;AHHH6%I((I,/I,c                     |                      t          t          j        d           |                     t          t          j        d           d S r?  )r   r~   r   r}   r   r   s    r   test_math_fmodzTestCudaMath.test_math_fmod  sB    $$Yq$AAA$$Yq$AAAAAr   c                     |                      t          t          j        d           |                     t          t          j        d           d S r?  )r   r   r   r}   r   r   s    r   test_math_mod_binopz TestCudaMath.test_math_mod_binop  sB    $$^RWA$FFF$$^RWA$FFFFFr   c                    |                      t          t          j                   |                     t          t          j                   |                     t          t          j                   |                     t          t          j                   |                     t          t          j                   |                     t          t          j                   d S r   )	r   r   r   r   r   r   r   r   r   r   s    r   test_math_isnanzTestCudaMath.test_math_isnan      ((RX>>>((RX>>>&&z28<<<&&z28<<<..z28DDD..z28DDDDDr   c                    |                      t          t          j                   |                     t          t          j                   |                     t          t          j                   |                     t          t          j                   |                     t          t          j                   |                     t          t          j                   d S r   )	r   r   r   r   r   r   r   r   r   r   s    r   test_math_isinfzTestCudaMath.test_math_isinf  r}  r   c                    |                      t          t          j                   |                     t          t          j                   |                     t          t          j                   |                     t          t          j                   |                     t          t          j                   |                     t          t          j                   d S r   )	r   r   r   r   r   r   r   r   r   r   s    r   test_math_isfinitezTestCudaMath.test_math_isfinite  s    ((DDD((DDD&&}bkBBB&&}bkBBB..}bkJJJ..}bkJJJJJr   c                     |                      t          t          j                   |                     t          t          j                   d S r   )r   r   r   r   r   r   s    r   test_math_degreeszTestCudaMath.test_math_degrees  8    ((rzBBB((rzBBBBBr   c                     |                      t          t          j                   |                     t          t          j                   d S r   )r   r   r   r   r   r   s    r   test_math_radianszTestCudaMath.test_math_radians  r  r   N)r   r   )r   r   )r   r   )F__name__
__module____qualname__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  r!  r$  r+  r.  r0  r2  r6  r:  r=  r@  rB  rD  rF  rH  rP  rR  rT  r\  r^  r`  rb  rd  rf  rh  rj  rv  rx  rz  r|  r  r  r  r   r   r   r   r      s       O O O OO O O OO O O OM M M MN N N N< < <*5 5 5J J JJ J JO O O OO O O OK K K KK K K K1 1 1P P P PP P P PN N N NO O O O4 4 4J J JJ J J9 9 9L L L; ; ;M M M5 5 5 
: 
: 
: _?@@: :  A@:5 5 55 5 57 7 77 7 77 7 7< < <4 4 45 5 55 5 59 9 9A A A? ? ?@ @ @> > >@ @ @B B B9 9 9K K K _JKK( ( LK(7 7 7: : :Q Q Q", , ,? ? ?7 7 79 9 9: : : _<==9 9 >=9K K K'D 'D 'DXB B BG G GE E EE E EK K KC C CC C C C Cr   r   __main__)>numpyr   numba.cuda.testingr   r   r   r   numba.npr   numbar   r	   r
   r   r   r   r   r   r   r   r"   r%   r)   r,   r/   r3   r6   r9   r<   r?   rD   rH   rK   rN   rQ   rT   rW   rZ   r]   r`   rc   rf   ri   rl   ro   rr   ru   rx   r{   r~   r   r   r   r   r   r   r   r   r   r   r  mainr  r   r   <module>r     sh      1 1 1 1 1 1 1 1 1 1 1 1 # " " " " " G G G G G G G G G G G G G G G G G G   
  
  
  
  
  
  
  
  
  
  
  
" " "
  
  
  
  
  
  
  
  
  
  
  
& & &
  
" " "
     
  
  
% % %
! ! !
! ! !
  
  
  
  
  
  
  
  
vC vC vC vC vC< vC vC vCr zHMOOOOO r   