
    xKgk                        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jz                          yy)1    N)skip_unless_cc_53unittestCUDATestCaseskip_on_cudasim)numpy_support)cudafloat32float64int32	vectorizevoidint64c                 d    t        j                  d      }t        j                  | |         ||<   y N   )r   gridmathacosABis      e/home/alanp/www/video.onchill/myenv/lib/python3.12/site-packages/numba/cuda/tests/cudapy/test_math.py	math_acosr      $    		!A99QqT?AaD    c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   asinr   s      r   	math_asinr      r   r   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   atanr   s      r   	math_atanr"      r   r   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   acoshr   s      r   
math_acoshr%      %    		!A::adAaDr   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   asinhr   s      r   
math_asinhr)      r&   r   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   atanhr   s      r   
math_atanhr,   $   r&   r   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   cosr   s      r   math_cosr/   )   $    		!A88AaD>AaDr   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   sinr   s      r   math_sinr3   .   r0   r   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   tanr   s      r   math_tanr6   3   r0   r   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   coshr   s      r   	math_coshr9   8   r   r   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   sinhr   s      r   	math_sinhr<   =   r   r   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   tanhr   s      r   	math_tanhr?   B   r   r   c                 l    t        j                  d      }t        j                  | |   ||         ||<   y r   )r   r   r   atan2r   r   Cr   s       r   
math_atan2rD   G   +    		!A::adAaD!AaDr   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   expr   s      r   math_exprH   L   r0   r   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   erfr   s      r   math_erfrK   Q   r0   r   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   erfcr   s      r   	math_erfcrN   V   r   r   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   expm1r   s      r   
math_expm1rQ   [   r&   r   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   fabsr   s      r   	math_fabsrT   `   r   r   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   gammar   s      r   
math_gammarW   e   r&   r   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   lgammar   s      r   math_lgammarZ   j   s%    		!A;;qtAaDr   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   logr   s      r   math_logr]   o   r0   r   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   log2r   s      r   	math_log2r`   t   r   r   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   log10r   s      r   
math_log10rc   y   r&   r   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   log1pr   s      r   
math_log1prf   ~   r&   r   c                 l    t        j                  d      }t        j                  | |   ||         ||<   y r   )r   r   r   	remainderrB   s       r   math_remainderri      s+    		!A>>!A$!%AaDr   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   sqrtr   s      r   	math_sqrtrl      r   r   c                 l    t        j                  d      }t        j                  | |   ||         ||<   y r   )r   r   r   hypotrB   s       r   
math_hypotro      rE   r   c                 l    t        j                  d      }t        j                  | |   ||         ||<   y r   )r   r   r   powrB   s       r   math_powrr      s+    		!A88AaD!A$AaDr   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   ceilr   s      r   	math_ceilru      r   r   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   floorr   s      r   
math_floorrx      r&   r   c                 l    t        j                  d      }t        j                  | |   ||         ||<   y r   )r   r   r   copysignrB   s       r   math_copysignr{      s+    		!A==1qt$AaDr   c                 l    t        j                  d      }t        j                  | |   ||         ||<   y r   )r   r   r   fmodrB   s       r   	math_fmodr~      s+    		!A99QqT1Q4 AaDr   c                 p    t        j                  d      }t        j                  | |         \  ||<   ||<   y r   )r   r   r   modfrB   s       r   	math_modfr      s,    		!A1Q4JAaD!A$r   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   isnanr   s      r   
math_isnanr      r&   r   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   isinfr   s      r   
math_isinfr      r&   r   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   isfiniter   s      r   math_isfiniter      s%    		!A==1AaDr   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   degreesr   s      r   math_degreesr      %    		!A<<!AaDr   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   radiansr   s      r   math_radiansr      r   r   c                 d    t        j                  d      }t        j                  | |         ||<   y r   )r   r   r   truncr   s      r   
math_truncr      r&   r   c                 J    t        j                  d      }| |   ||   z  ||<   y r   r   r   rB   s       r   math_pow_binopr      s$    		!AQ41Q4<AaDr   c                 J    t        j                  d      }| |   ||   z  ||<   y r   r   rB   s       r   math_mod_binopr      s$    		!AQ4!A$;AaDr   c                      e Zd ZdFdZdFdZdFdZdGdZdGdZd Zd Z	d Z
d	 ZdFd
ZdFdZdHdZdHdZd ZdFdZdFdZdGdZdGd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.d, Z/d- Z0d. Z1d/ Z2 ed0      d1        Z3d2 Z4d3 Z5d4 Z6d5 Z7d6 Z8d7 Z9d8 Z:d9 Z; ed:      d;        Z<d< Z=d= Z>d> Z?d? Z@d@ ZAdA ZBdB ZCdC ZDdD ZEyE)ITestCudaMathc                 h    | j                  ||t        j                  t        j                  ||       y N)unary_templatenpfloat16selffuncnpfuncstartstops        r   unary_template_float16z#TestCudaMath.unary_template_float16   "    D&"**bjj%Nr   c                 h    | j                  ||t        j                  t        j                  ||       y r   r   r   r	   r   s        r   unary_template_float32z#TestCudaMath.unary_template_float32   r   r   c                 h    | j                  ||t        j                  t        j                  ||       y r   r   r   r
   r   s        r   unary_template_float64z#TestCudaMath.unary_template_float64   r   r   c                 h    | j                  ||t        j                  t        j                  ||       y r   )r   r   r   r
   r   s        r   unary_template_int64z!TestCudaMath.unary_template_int64   s"    D&"((BJJtLr   c                 h    | j                  ||t        j                  t        j                  ||       y r   )r   r   uint64r
   r   s        r   unary_template_uint64z"TestCudaMath.unary_template_uint64   s"    D&"))RZZMr   c                 
   d}t        j                  |||      j                  |      }t        j                  |      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                  j                   ||      |	|       y )N2   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    KKtU+227;MM!##I.**73CaC8**95cc:,'7+,T2ah1 bjj D

"DD


""6!9ad";r   c           
         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                  j                  | ||              |	d|j                  f   | |       t         j                  j                  | ||              y )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    XXg1HHb&"''3BFFBFFBFFK"$MM!288,4'#A#,cc
34T:aiA


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


%%a4r   c                 P    | j                  ||t        j                  t               y r   )r   r   r	   r   r   r   s      r   !unary_bool_special_values_float32z.TestCudaMath.unary_bool_special_values_float32      &&tVRZZIr   c                 P    | j                  ||t        j                  t               y r   )r   r   r
   r   s      r   !unary_bool_special_values_float64z.TestCudaMath.unary_bool_special_values_float64  r   r   c                 h    | j                  ||t        j                  t        j                  ||       y r   r   r   s        r   unary_bool_template_float32z(TestCudaMath.unary_bool_template_float32  r   r   c                 h    | j                  ||t        j                  t        j                  ||       y r   r   r   s        r   unary_bool_template_float64z(TestCudaMath.unary_bool_template_float64  r   r   c                 h    | j                  ||t        j                  t        j                  ||       y r   )r   r   r   r   s        r   unary_bool_template_int32z&TestCudaMath.unary_bool_template_int32  "    D&"((BHHeTJr   c                 h    | j                  ||t        j                  t        j                  ||       y r   )r   r   r   r   s        r   unary_bool_template_int64z&TestCudaMath.unary_bool_template_int64  r   r   c                 |   d}t        j                  |||      j                  |      }t        j                  |j                  t         j
                        }	|d d d   }
t
        d d d   } t        j                  |
|f      |      } |d|f   ||	       t         j                  j                   ||      |	       y )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    KKtU+227;HHQWWBHH-3Q3<1:.(H-.t4ah1


""6!9a0r   c                 h    | j                  ||t        j                  t        j                  ||       y r   )binary_templater   r	   r   s        r   binary_template_float32z$TestCudaMath.binary_template_float32'  "    T62::rzz5$Or   c                 h    | j                  ||t        j                  t        j                  ||       y r   )r   r   r
   r   s        r   binary_template_float64z$TestCudaMath.binary_template_float64*  r   r   c                 h    | j                  ||t        j                  t        j                  ||       y r   )r   r   r   r
   r   s        r   binary_template_int64z"TestCudaMath.binary_template_int64-  s"    T6288RZZMr   c                 h    | j                  ||t        j                  t        j                  ||       y r   )r   r   r   r
   r   s        r   binary_template_uint64z#TestCudaMath.binary_template_uint640  s"    T6299bjj%Nr   c                    d}t        j                  |||      j                  |      }t        j                  |      j                  |      }	t	        j
                  |      d d d   }
t	        j
                  |      d d d   } t        j                  |
|
|f      |      } |d|f   |||	       t         j                  j                   |||      |	       y )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    KKtU+227;MM!##I.**73CaC8**95cc:5'7G45d;ah1a 


""6!Q<3r   c                 0   | j                  t        t        j                         | j	                  t        t        j                         | j                  t        t        j                  dd       | j                  t        t        j                  dd       y Nr   r   r   )r   r   r   arccosr   r   r   r   s    r   test_math_acoszTestCudaMath.test_math_acos@  b    ##Iryy9##Iryy9 	!!)RYYaa!H""9biiqq"Ir   c                 0   | j                  t        t        j                         | j	                  t        t        j                         | j                  t        t        j                  dd       | j                  t        t        j                  dd       y r   )r   r   r   arcsinr   r   r   r   s    r   test_math_asinzTestCudaMath.test_math_asinK  r   r   c                 $   | j                  t        t        j                         | j	                  t        t        j                         | j                  t        t        j                         | j                  t        t        j                         y r   )r   r"   r   arctanr   r   r   r   s    r   test_math_atanzTestCudaMath.test_math_atanV  sR    ##Iryy9##Iryy9!!)RYY7""9bii8r   c                 <   | j                  t        t        j                  dd       | j	                  t        t        j                  dd       | j                  t        t        j                  dd       | j                  t        t        j                  dd       y )Nr      r   )r   r%   r   arccoshr   r   r   r   s    r   test_math_acoshzTestCudaMath.test_math_acosh_  sn    ##J

!!#L##J

!!#L!!*bjj!J"":rzz"Kr   c                 $   | j                  t        t        j                         | j	                  t        t        j                         | j                  t        t        j                         | j                  t        t        j                         y r   )r   r)   r   arcsinhr   r   r   r   s    r   test_math_asinhzTestCudaMath.test_math_asinhh  sR    ##J

;##J

;!!*bjj9"":rzz:r   c                 <   | j                  t        t        j                  dd       | j	                  t        t        j                  dd       | j                  t        t        j                  dd       | j                  t        t        j                  dd       y )Nr   g?r   )r   r,   r   arctanhr   r   r   r   s    r   test_math_atanhzTestCudaMath.test_math_atanhq  sn    ##J

!"#M##J

!"#M!!*bjj!K"":rzz"Lr   c                 $   | j                  t        t        j                         | j	                  t        t        j                         | j                  t        t        j                         | j                  t        t        j                         y r   )r   r/   r   r.   r   r   r   r   s    r   test_math_coszTestCudaMath.test_math_cosz  R    ##Hbff5##Hbff5!!(BFF3""8RVV4r   c                    | j                  t        t        j                         | j                  t        t        j
                         | j                  t        t        j                         | j                  t        t        j                  d       | j                  t        t        j                  d       | j                  t        t        j                  d       | j                  t        t        j                  d       | j                  t         t        j"                         | j                  t$        t        j&                         | j                  t(        t        j*                         y )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    ##Hbff5##Hbff5##Hbff5##HbffA#>##Irwwa#@##J#B##Irwwb#A##Irww7##Irww7##J9r   z(numpy does not support trunc for float16c                 L    | j                  t        t        j                         y r   )r   r   r   r   r   s    r   test_math_fp16_truncz!TestCudaMath.test_math_fp16_trunc  s     	##J9r   c                 $   | j                  t        t        j                         | j	                  t        t        j                         | j                  t        t        j                         | j                  t        t        j                         y r   )r   r3   r   r2   r   r   r   r   s    r   test_math_sinzTestCudaMath.test_math_sin  r  r   c                 $   | j                  t        t        j                         | j	                  t        t        j                         | j                  t        t        j                         | j                  t        t        j                         y r   )r   r6   r   r5   r   r   r   r   s    r   test_math_tanzTestCudaMath.test_math_tan  r  r   c                 $   | j                  t        t        j                         | j	                  t        t        j                         | j                  t        t        j                         | j                  t        t        j                         y r   )r   r9   r   r8   r   r   r   r   s    r   test_math_coshzTestCudaMath.test_math_cosh  R    ##Irww7##Irww7!!)RWW5""9bgg6r   c                 $   | j                  t        t        j                         | j	                  t        t        j                         | j                  t        t        j                         | j                  t        t        j                         y r   )r   r<   r   r;   r   r   r   r   s    r   test_math_sinhzTestCudaMath.test_math_sinh  r  r   c                 $   | j                  t        t        j                         | j	                  t        t        j                         | j                  t        t        j                         | j                  t        t        j                         y r   )r   r?   r   r>   r   r   r   r   s    r   test_math_tanhzTestCudaMath.test_math_tanh  r  r   c                 $   | j                  t        t        j                         | j	                  t        t        j                         | j                  t        t        j                         | j                  t        t        j                         y r   )r   rD   r   arctan2r   r   r   r   s    r   test_math_atan2zTestCudaMath.test_math_atan2  sR    $$Z<$$Z<"":rzz:##J

;r   c                     t         d        }| j                  t        |       | j                  t        |       | j	                  t        |       | j                  t        |       y )Nc                 ,    t        j                  |       S r   )r   rJ   xs    r   ufuncz)TestCudaMath.test_math_erf.<locals>.ufunc  s    88A;r   )r   r   rK   r   r   r   r   r(  s     r   test_math_erfzTestCudaMath.test_math_erf  sT    		 
	##He4##He4!!(E2""8U3r   c                     t         d        }| j                  t        |       | j                  t        |       | j	                  t        |       | j                  t        |       y )Nc                 ,    t        j                  |       S r   )r   rM   r&  s    r   r(  z*TestCudaMath.test_math_erfc.<locals>.ufunc  s    99Q<r   )r   r   rN   r   r   r   r)  s     r   test_math_erfczTestCudaMath.test_math_erfc  sT    		  
	 ##Iu5##Iu5!!)U3""9e4r   c                 $   | j                  t        t        j                         | j	                  t        t        j                         | j                  t        t        j                         | j                  t        t        j                         y r   )r   rH   r   rG   r   r   r   r   s    r   test_math_expzTestCudaMath.test_math_exp  r  r   c                 $   | j                  t        t        j                         | j	                  t        t        j                         | j                  t        t        j                         | j                  t        t        j                         y r   )r   rQ   r   rP   r   r   r   r   s    r   test_math_expm1zTestCudaMath.test_math_expm1  R    ##J9##J9!!*bhh7"":rxx8r   c                 4   | j                  t        t        j                  d       | j	                  t        t        j                  d       | j                  t        t        j                  d       | j                  t        t        j                  d       y Nr  r  )r   rT   r   rS   r   r   r   r   s    r   test_math_fabszTestCudaMath.test_math_fabs  sf    ##Irwwb#A##Irwwb#A!!)RWWB!?""9bggR"@r   c                     t         d        }| j                  t        |d       | j                  t        |d       | j	                  t        |d       | j                  t        |d       y )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  sh    		! 
	!##JS#A##JS#A!!*e1!="":uA">r   c                     t         d        }| j                  t        |d       | j                  t        |d       | j	                  t        |d       | j                  t        |d       y )Nc                 ,    t        j                  |       S r   )r   rY   r&  s    r   r(  z,TestCudaMath.test_math_lgamma.<locals>.ufunc  s    ;;q>!r   r8  r  r   )r   r   rZ   r   r   r   r)  s     r   test_math_lgammazTestCudaMath.test_math_lgamma
  sh    		" 
	"##Kc#B##Kc#B!!+uA!>"";Q"?r   c                 4   | j                  t        t        j                  d       | j	                  t        t        j                  d       | j                  t        t        j                  d       | j                  t        t        j                  d       y Nr   r  )r   r]   r   r\   r   r   r   r   s    r   test_math_logzTestCudaMath.test_math_log  sf    ##HbffA#>##HbffA#>!!(BFF!!<""8RVV1"=r   c                 4   | j                  t        t        j                  d       | j	                  t        t        j                  d       | j                  t        t        j                  d       | j                  t        t        j                  d       y r>  )r   r`   r   r_   r   r   r   r   s    r   test_math_log2zTestCudaMath.test_math_log2  sf    ##Irwwa#@##Irwwa#@!!)RWWA!>""9bggQ"?r   c                 4   | j                  t        t        j                  d       | j	                  t        t        j                  d       | j                  t        t        j                  d       | j                  t        t        j                  d       y r>  )r   rc   r   rb   r   r   r   r   s    r   test_math_log10zTestCudaMath.test_math_log10(  sf    ##J#B##J#B!!*bhha!@"":rxxq"Ar   c                 $   | j                  t        t        j                         | j	                  t        t        j                         | j                  t        t        j                         | j                  t        t        j                         y r   )r   rf   r   re   r   r   r   r   s    r   test_math_log1pzTestCudaMath.test_math_log1p1  r2  r   c                 4   | j                  t        t        j                  d       | j	                  t        t        j                  d       | j                  t        t        j                  d       | j                  t        t        j                  d       y )Ngdy=r  r   )r   ri   r   rh   r   r   r   r   s    r   test_math_remainderz TestCudaMath.test_math_remainder:  sf    $$^R\\$O$$^R\\$O"">2<<q"I##NBLL#Jr   z3math.remainder(0, 0) raises a ValueError on CUDASimc                 $   t        j                  t        t        d d d   t        t                    d        }t        j                  dt
        j                        } |d   |dd       | j                  t        j                  |d                y )Nr   c                 6    t        j                  ||      | d<   y )Nr   )r   rh   )rr'  ys      r   test_0_0z6TestCudaMath.test_math_remainder_0_0.<locals>.test_0_0B  s    >>!Q'AaDr   )r   r   r   )	r   r   r   r
   r   r   zeros
assertTruer   )r   rL  rJ  s      r   test_math_remainder_0_0z$TestCudaMath.test_math_remainder_0_0@  sl    	$wss|UE2	3	( 
4	(HHQ

#q!Q1'r   c                 $   | j                  t        t        j                         | j	                  t        t        j                         | j                  t        t        j                         | j                  t        t        j                         y r   )r   rl   r   rk   r   r   r   r   s    r   test_math_sqrtzTestCudaMath.test_math_sqrtL  r  r   c                 $   | j                  t        t        j                         | j	                  t        t        j                         | j                  t        t        j                         | j                  t        t        j                         y r   )r   ro   r   rn   r   r   r   r   s    r   test_math_hypotzTestCudaMath.test_math_hypotU  sR    $$Z:$$Z:"":rxx8##J9r   c                    d}t        j                  dd|      j                  |      }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                  j!                  t        j"                  ||      j                  |      |d       y )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^  s   KK2u%,,W5IIe288,MM!**73CaC88'51:w78Bah1a 
 }}Qs1vAhhqtQqT*DG 


""288Aq>#8#8#A14"Pr   c                    | j                  t        t        j                         | j	                  t        t        j                         | j                  t        j                         | j                  t        j                         y r   )r   rr   r   rY  r   r[  r	   r
   r   s    r   test_math_powzTestCudaMath.test_math_powo  sN    $$Xrxx8$$Xrxx8

+

+r   c                     | j                  t        t        j                         | j	                  t        t        j                         y r   )r   r   r   rY  r   r   s    r   test_math_pow_binopz TestCudaMath.test_math_pow_binopx  s*    $$^RXX>$$^RXX>r   c                 $   | j                  t        t        j                         | j	                  t        t        j                         | j                  t        t        j                         | j                  t        t        j                         y r   )r   ru   r   rt   r   r   r   r   s    r   test_math_ceilzTestCudaMath.test_math_ceil  r  r   c                 $   | j                  t        t        j                         | j	                  t        t        j                         | j                  t        t        j                         | j                  t        t        j                         y r   )r   rx   r   rw   r   r   r   r   s    r   test_math_floorzTestCudaMath.test_math_floor  r2  r   c                 L    | j                  t        t        j                         y r   )r   r   r   r   r   s    r   test_math_trunczTestCudaMath.test_math_trunc  s    ##J9r   z%trunc only supported on NumPy float64c                     | j                  t        t        j                         | j	                  t        t        j                         | j                  t        t        j                         y r   )r   r   r   r   r   r   r   s    r   test_math_trunc_non_float64z(TestCudaMath.test_math_trunc_non_float64  s>    ##J9!!*bhh7"":rxx8r   c                     | j                  t        t        j                  d       | j	                  t        t        j                  d       y r4  )r   r{   r   rz   r   r   s    r   test_math_copysignzTestCudaMath.test_math_copysign  s4    $$]BKKr$J$$]BKKr$Jr   c                      fd} fd}d} j                  d      5   |t        j                  dd|      t        j                  t        d d         d d d         j                  d      5   |t        j                  t        j
                  t        j
                   g      t        j                  t        d d         d d d         j                  d	      5   |t        j                  t        d d         d d d         j                  d
      5   |t        j                  dd|      t        j                  t        d d         d d d         j                  d      5   |t        j                  t        j
                  t        j
                   g      t        j                  t        d d         d d d         j                  d      5   |t        j                  t        d d         d d d        y # 1 sw Y   xY w# 1 sw Y   ExY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   vxY w# 1 sw Y   y xY w)Nc                    t        j                  t         j                  g|       }t        j                  |      }t        j                  |      } t	        j
                  |||f      t              } |dt        |      f   |||       j                  t        j                  |             j                  t        j                  |             y )Nr   r   )
r   r   r   
zeros_liker   r   r   rX  rN  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9DHHgw89)DEE!SV)Q1%OOBHHQK(OOBHHQK(r   c                    | j                  |      } t        j                  |       }t        j                  |       } t        j                  |||f      t
              } |dt        |       f   | ||       t        j                  |       \  }}j                  t        j                  ||             j                  t        j                  ||             y r   )
r   r   rl  r   r   r   rX  r   rN  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9DHHgw89)DEE!SV)Q1%771:DAqOOBNN1Q/0OOBNN1Q/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   rm  rr  r   s   `   r   test_math_modfzTestCudaMath.test_math_modf  s   	)	1 \\89!"++aU";2::*1!*6 : \\78!"((BFFRVVG+<"=RZZ*1!*6 9 \\/0BJJ
C 1 \\89!"++aU";2::*1!*6 : \\78!"((BFFRVVG+<"=RZZ*1!*6 9 \\/0BJJ
C 10! :9 98 10 :9 98 10sI   6G7.AH H6H"AH* H67HHHH'*H36H?c                     | j                  t        t        j                  d       | j	                  t        t        j                  d       y r>  )r   r~   r   r}   r   r   s    r   test_math_fmodzTestCudaMath.test_math_fmod  s4    $$Yq$A$$Yq$Ar   c                     | j                  t        t        j                  d       | j	                  t        t        j                  d       y r>  )r   r   r   r}   r   r   s    r   test_math_mod_binopz TestCudaMath.test_math_mod_binop  s4    $$^RWWA$F$$^RWWA$Fr   c                    | j                  t        t        j                         | j	                  t        t        j                         | j                  t        t        j                         | j                  t        t        j                         | j                  t        t        j                         | j                  t        t        j                         y r   )	r   r   r   r   r   r   r   r   r   r   s    r   test_math_isnanzTestCudaMath.test_math_isnan  z    ((RXX>((RXX>&&z288<&&z288<..z288D..z288Dr   c                    | j                  t        t        j                         | j	                  t        t        j                         | j                  t        t        j                         | j                  t        t        j                         | j                  t        t        j                         | j                  t        t        j                         y r   )	r   r   r   r   r   r   r   r   r   r   s    r   test_math_isinfzTestCudaMath.test_math_isinf  r|  r   c                    | j                  t        t        j                         | j	                  t        t        j                         | j                  t        t        j                         | j                  t        t        j                         | j                  t        t        j                         | j                  t        t        j                         y r   )	r   r   r   r   r   r   r   r   r   r   s    r   test_math_isfinitezTestCudaMath.test_math_isfinite  sz    ((D((D&&}bkkB&&}bkkB..}bkkJ..}bkkJr   c                     | j                  t        t        j                         | j	                  t        t        j                         y r   )r   r   r   r   r   r   s    r   test_math_degreeszTestCudaMath.test_math_degrees  *    ((rzzB((rzzBr   c                     | j                  t        t        j                         | j	                  t        t        j                         y r   )r   r   r   r   r   r   s    r   test_math_radianszTestCudaMath.test_math_radians  r  r   N)r   r   )r   r   )r   1   )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-  r/  r1  r5  r9  r<  r?  rA  rC  rE  rG  rO  rQ  rS  r[  r]  r_  ra  rc  re  rg  ri  ru  rw  ry  r{  r~  r  r  r   r   r   r   r      s   OOOMN<*5JJOOKK1PPNO4JJ9L;M5 
: 
: ?@:  A:55777<4559A?@>@B9K JK( L(7:Q",?79: <=9 >9K'DXBGEEK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     s   1 1 # G G G 











"











&

"
 


%
!
!








vC< vCr zHMMO r   