
    shk                        S SK rS SKJrJrJrJr  S SKJr  S SK	J
r
JrJrJrJrJrJr  S SKrS rS rS rS rS	 rS
 rS rS rS rS rS rS rS rS rS r S r!S r"S r#S r$S r%S r&S r'S r(S r)S r*S r+S r,S  r-S! r.S" r/S# r0S$ r1S% r2S& r3S' r4S( r5S) r6S* r7S+ r8S, r9S- r: " S. S/\5      r;\<S0:X  a  \Rz                  " 5         gg)1    N)skip_unless_cc_53unittestCUDATestCaseskip_on_cudasim)numpy_support)cudafloat32float64int32	vectorizevoidint64c                 d    [         R                  " S5      n[        R                  " X   5      X'   g N   )r   gridmathacosABis      u/Users/tiagomarins/Projetos/claudeai/copy_bank/venv/lib/python3.13/site-packages/numba/cuda/tests/cudapy/test_math.py	math_acosr           		!A99QT?AD    c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   asinr   s      r   	math_asinr      r   r   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   atanr   s      r   	math_atanr"      r   r   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   acoshr   s      r   
math_acoshr%      !    		!A::adADr   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   asinhr   s      r   
math_asinhr)      r&   r   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   atanhr   s      r   
math_atanhr,   $   r&   r   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   cosr   s      r   math_cosr/   )        		!A88AD>ADr   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   sinr   s      r   math_sinr3   .   r0   r   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   tanr   s      r   math_tanr6   3   r0   r   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   coshr   s      r   	math_coshr9   8   r   r   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   sinhr   s      r   	math_sinhr<   =   r   r   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   tanhr   s      r   	math_tanhr?   B   r   r   c                 j    [         R                  " S5      n[        R                  " X   X   5      X#'   g r   )r   r   r   atan2r   r   Cr   s       r   
math_atan2rD   G   %    		!A::adAD!ADr   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   expr   s      r   math_exprH   L   r0   r   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   erfr   s      r   math_erfrK   Q   r0   r   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   erfcr   s      r   	math_erfcrN   V   r   r   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   expm1r   s      r   
math_expm1rQ   [   r&   r   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   fabsr   s      r   	math_fabsrT   `   r   r   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   gammar   s      r   
math_gammarW   e   r&   r   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   lgammar   s      r   math_lgammarZ   j   s!    		!A;;qtADr   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   logr   s      r   math_logr]   o   r0   r   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   log2r   s      r   	math_log2r`   t   r   r   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   log10r   s      r   
math_log10rc   y   r&   r   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   log1pr   s      r   
math_log1prf   ~   r&   r   c                 j    [         R                  " S5      n[        R                  " X   X   5      X#'   g r   )r   r   r   	remainderrB   s       r   math_remainderri      s%    		!A>>!$%ADr   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   sqrtr   s      r   	math_sqrtrl      r   r   c                 j    [         R                  " S5      n[        R                  " X   X   5      X#'   g r   )r   r   r   hypotrB   s       r   
math_hypotro      rE   r   c                 j    [         R                  " S5      n[        R                  " X   X   5      X#'   g r   )r   r   r   powrB   s       r   math_powrr      s%    		!A88AD!$ADr   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   ceilr   s      r   	math_ceilru      r   r   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   floorr   s      r   
math_floorrx      r&   r   c                 j    [         R                  " S5      n[        R                  " X   X   5      X#'   g r   )r   r   r   copysignrB   s       r   math_copysignr{      s%    		!A==qt$ADr   c                 j    [         R                  " S5      n[        R                  " X   X   5      X#'   g r   )r   r   r   fmodrB   s       r   	math_fmodr~      s%    		!A99QT14 ADr   c                 n    [         R                  " S5      n[        R                  " X   5      u  X'   X#'   g r   )r   r   r   modfrB   s       r   	math_modfr      s&    		!A14JAD!$r   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   isnanr   s      r   
math_isnanr      r&   r   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   isinfr   s      r   
math_isinfr      r&   r   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   isfiniter   s      r   math_isfiniter      s!    		!A==ADr   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   degreesr   s      r   math_degreesr      !    		!A<<ADr   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   radiansr   s      r   math_radiansr      r   r   c                 d    [         R                  " S5      n[        R                  " X   5      X'   g r   )r   r   r   truncr   s      r   
math_truncr      r&   r   c                 F    [         R                  " S5      nX   X   -  X#'   g r   r   r   rB   s       r   math_pow_binopr      s    		!A414<ADr   c                 F    [         R                  " S5      nX   X   -  X#'   g r   r   rB   s       r   math_mod_binopr      s    		!A4!$;ADr   c                   $   \ rS rSrSHS jrSHS jrSHS jrSIS jrSIS jrS r	S r
S	 rS
 rSHS jrSHS jrSJS jrSJS jrS rSHS jrSHS jrSIS jrSIS jrS rS rS rS rS rS rS rS r\S 5       r\ " S5      \S 5       5       r!S r"S  r#S! r$S" r%S# r&S$ r'S% r(S& r)S' r*S( r+S) r,S* r-S+ r.S, r/S- r0S. r1S/ r2S0 r3\ " S15      S2 5       r4S3 r5S4 r6S5 r7S6 r8S7 r9S8 r:S9 r;S: r<\ " S;5      S< 5       r=S= r>S> r?S? r@S@ rASA rBSB rCSC rDSD rESE rFSFrGgG)KTestCudaMath   c                 d    U R                  X[        R                  [        R                  X45        g N)unary_templatenpfloat16selffuncnpfuncstartstops        r   unary_template_float16#TestCudaMath.unary_template_float16       D"**bjj%Nr   c                 d    U R                  X[        R                  [        R                  X45        g r   r   r   r	   r   s        r   unary_template_float32#TestCudaMath.unary_template_float32   r   r   c                 d    U R                  X[        R                  [        R                  X45        g r   r   r   r
   r   s        r   unary_template_float64#TestCudaMath.unary_template_float64   r   r   c                 d    U R                  X[        R                  [        R                  X45        g r   )r   r   r   r
   r   s        r   unary_template_int64!TestCudaMath.unary_template_int64   s    D"((BJJLr   c                 d    U R                  X[        R                  [        R                  X45        g r   )r   r   uint64r
   r   s        r   unary_template_uint64"TestCudaMath.unary_template_uint64   s    D"))RZZMr   c                 
   Sn[         R                  " XVU5      R                  U5      n[         R                  " U5      R                  U5      n	[        R
                  " U5      S S S2   n
[        R
                  " U5      S S S2   n[        R                  " X45      " U5      nUSU4   " X5        U[         R                  :X  a  SnOU[         R                  :X  a  SnOSn[         R                  R                  U" U5      XS9  g )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   TestCudaMath.unary_template   s    KKU+227;MM!##I.**73CaC8**95cc:'+,T2ah bjj D

"DD


""6!9a";r   c           
      ~   [         R                  " U5      nUR                  S-  n[         R                  " SXeR                  SSUR                  [         R
                  [         R                  /US9n[         R                  " U[         R                  S9n[        R                  " US S S2   [        S S S2   45      " U5      n	U	SUR                  4   " Xx5        [         R                  R                  X" U5      5        U	SUR                  4   " U* U5        [         R                  R                  X" U* 5      5        g )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_values&TestCudaMath.unary_bool_special_values   s    XXg1HHb&''3BFFBFFBFFK"$MM!288,'#A#,cc
34T:ai


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


%%a4r   c                 N    U R                  X[        R                  [        5        g r   )r   r   r	   r   r   r   s      r   !unary_bool_special_values_float32.TestCudaMath.unary_bool_special_values_float32      &&tRZZIr   c                 N    U R                  X[        R                  [        5        g r   )r   r   r
   r   s      r   !unary_bool_special_values_float64.TestCudaMath.unary_bool_special_values_float64  r   r   c                 d    U R                  X[        R                  [        R                  X45        g r   r   r   s        r   unary_bool_template_float32(TestCudaMath.unary_bool_template_float32  r   r   c                 d    U R                  X[        R                  [        R                  X45        g r   r   r   s        r   unary_bool_template_float64(TestCudaMath.unary_bool_template_float64  r   r   c                 d    U R                  X[        R                  [        R                  X45        g r   )r   r   r   r   s        r   unary_bool_template_int32&TestCudaMath.unary_bool_template_int32      D"((BHHeJr   c                 d    U R                  X[        R                  [        R                  X45        g r   )r   r   r   r   s        r   unary_bool_template_int64&TestCudaMath.unary_bool_template_int64  r   r   c                 v   Sn[         R                  " XVU5      R                  U5      n[         R                  " UR                  [         R
                  S9n	US S S2   n
[
        S S S2   n[        R                  " X45      " U5      nUSU4   " X5        [         R                  R                  U" U5      U	5        g )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_template TestCudaMath.unary_bool_template  s    KKU+227;HHQWWBHH-3Q3<1:(-.t4ah


""6!9a0r   c                 d    U R                  X[        R                  [        R                  X45        g r   )binary_templater   r	   r   s        r   binary_template_float32$TestCudaMath.binary_template_float32'      T2::rzz5Or   c                 d    U R                  X[        R                  [        R                  X45        g r   )r   r   r
   r   s        r   binary_template_float64$TestCudaMath.binary_template_float64*  r   r   c                 d    U R                  X[        R                  [        R                  X45        g r   )r   r   r   r
   r   s        r   binary_template_int64"TestCudaMath.binary_template_int64-  s    T288RZZMr   c                 d    U R                  X[        R                  [        R                  X45        g r   )r   r   r   r
   r   s        r   binary_template_uint64#TestCudaMath.binary_template_uint640  s    T299bjj%Nr   c                    Sn[         R                  " XVU5      R                  U5      n[         R                  " U5      R                  U5      n	[        R
                  " U5      S S S2   n
[        R
                  " U5      S S S2   n[        R                  " XU45      " U5      nUSU4   " XU	5        [         R                  R                  U" X5      U	5        g )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   TestCudaMath.binary_template3  s    KKU+227;MM!##I.**73CaC8**95cc:'G45d;aha 


""6!<3r   c                 $   U R                  [        [        R                  5        U R	                  [        [        R                  5        U R                  [        [        R                  SSS9  U R                  [        [        R                  SSS9  g Nr   r   r   )r   r   r   arccosr   r   r   r   s    r   test_math_acosTestCudaMath.test_math_acos@  b    ##Iryy9##Iryy9 	!!)RYYaa!H""9biiqq"Ir   c                 $   U R                  [        [        R                  5        U R	                  [        [        R                  5        U R                  [        [        R                  SSS9  U R                  [        [        R                  SSS9  g r  )r   r   r   arcsinr   r   r   r  s    r   test_math_asinTestCudaMath.test_math_asinK  r  r   c                 $   U R                  [        [        R                  5        U R	                  [        [        R                  5        U R                  [        [        R                  5        U R                  [        [        R                  5        g r   )r   r"   r   arctanr   r   r   r  s    r   test_math_atanTestCudaMath.test_math_atanV  sR    ##Iryy9##Iryy9!!)RYY7""9bii8r   c                 $   U R                  [        [        R                  SSS9  U R	                  [        [        R                  SSS9  U R                  [        [        R                  SSS9  U R                  [        [        R                  SSS9  g )Nr      r  )r   r%   r   arccoshr   r   r   r  s    r   test_math_acoshTestCudaMath.test_math_acosh_  sn    ##J

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

!!#L!!*bjj!J"":rzz"Kr   c                 $   U R                  [        [        R                  5        U R	                  [        [        R                  5        U R                  [        [        R                  5        U R                  [        [        R                  5        g r   )r   r)   r   arcsinhr   r   r   r  s    r   test_math_asinhTestCudaMath.test_math_asinhh  sR    ##J

;##J

;!!*bjj9"":rzz:r   c                 $   U R                  [        [        R                  SSS9  U R	                  [        [        R                  SSS9  U R                  [        [        R                  SSS9  U R                  [        [        R                  SSS9  g )Nr   g?r  )r   r,   r   arctanhr   r   r   r  s    r   test_math_atanhTestCudaMath.test_math_atanhq  sn    ##J

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

!"#M!!*bjj!K"":rzz"Lr   c                 $   U R                  [        [        R                  5        U R	                  [        [        R                  5        U R                  [        [        R                  5        U R                  [        [        R                  5        g r   )r   r/   r   r.   r   r   r   r  s    r   test_math_cosTestCudaMath.test_math_cosz  R    ##Hbff5##Hbff5!!(BFF3""8RVV4r   c                    U R                  [        [        R                  5        U R                  [        [        R
                  5        U R                  [        [        R                  5        U R                  [        [        R                  SS9  U R                  [        [        R                  SS9  U R                  [        [        R                  SS9  U R                  [        [        R                  SS9  U R                  [         [        R"                  5        U R                  [$        [        R&                  5        U R                  [(        [        R*                  5        g )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_fp16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    U R                  [        [        R                  5        g r   )r   r   r   r   r  s    r   test_math_fp16_trunc!TestCudaMath.test_math_fp16_trunc  s     	##J9r   c                 $   U R                  [        [        R                  5        U R	                  [        [        R                  5        U R                  [        [        R                  5        U R                  [        [        R                  5        g r   )r   r3   r   r2   r   r   r   r  s    r   test_math_sinTestCudaMath.test_math_sin  r*  r   c                 $   U R                  [        [        R                  5        U R	                  [        [        R                  5        U R                  [        [        R                  5        U R                  [        [        R                  5        g r   )r   r6   r   r5   r   r   r   r  s    r   test_math_tanTestCudaMath.test_math_tan  r*  r   c                 $   U R                  [        [        R                  5        U R	                  [        [        R                  5        U R                  [        [        R                  5        U R                  [        [        R                  5        g r   )r   r9   r   r8   r   r   r   r  s    r   test_math_coshTestCudaMath.test_math_cosh  R    ##Irww7##Irww7!!)RWW5""9bgg6r   c                 $   U R                  [        [        R                  5        U R	                  [        [        R                  5        U R                  [        [        R                  5        U R                  [        [        R                  5        g r   )r   r<   r   r;   r   r   r   r  s    r   test_math_sinhTestCudaMath.test_math_sinh  r<  r   c                 $   U R                  [        [        R                  5        U R	                  [        [        R                  5        U R                  [        [        R                  5        U R                  [        [        R                  5        g r   )r   r?   r   r>   r   r   r   r  s    r   test_math_tanhTestCudaMath.test_math_tanh  r<  r   c                 $   U R                  [        [        R                  5        U R	                  [        [        R                  5        U R                  [        [        R                  5        U R                  [        [        R                  5        g r   )r   rD   r   arctan2r   r  r  r  s    r   test_math_atan2TestCudaMath.test_math_atan2  sR    $$Z<$$Z<"":rzz:##J

;r   c                     [         S 5       nU R                  [        U5        U R                  [        U5        U R	                  [        U5        U R                  [        U5        g )Nc                 .    [         R                  " U 5      $ r   )r   rJ   xs    r   ufunc)TestCudaMath.test_math_erf.<locals>.ufunc  s    88A;r   )r   r   rK   r   r   r   r   rK  s     r   test_math_erfTestCudaMath.test_math_erf  sT    		 
	##He4##He4!!(E2""8U3r   c                     [         S 5       nU R                  [        U5        U R                  [        U5        U R	                  [        U5        U R                  [        U5        g )Nc                 .    [         R                  " U 5      $ r   )r   rM   rI  s    r   rK  *TestCudaMath.test_math_erfc.<locals>.ufunc  s    99Q<r   )r   r   rN   r   r   r   rM  s     r   test_math_erfcTestCudaMath.test_math_erfc  sT    		  
	 ##Iu5##Iu5!!)U3""9e4r   c                 $   U R                  [        [        R                  5        U R	                  [        [        R                  5        U R                  [        [        R                  5        U R                  [        [        R                  5        g r   )r   rH   r   rG   r   r   r   r  s    r   test_math_expTestCudaMath.test_math_exp  r*  r   c                 $   U R                  [        [        R                  5        U R	                  [        [        R                  5        U R                  [        [        R                  5        U R                  [        [        R                  5        g r   )r   rQ   r   rP   r   r   r   r  s    r   test_math_expm1TestCudaMath.test_math_expm1  R    ##J9##J9!!*bhh7"":rxx8r   c                    U R                  [        [        R                  SS9  U R	                  [        [        R                  SS9  U R                  [        [        R                  SS9  U R                  [        [        R                  SS9  g Nr-  r,  )r   rT   r   rS   r   r   r   r  s    r   test_math_fabsTestCudaMath.test_math_fabs  sf    ##Irwwb#A##Irwwb#A!!)RWWB!?""9bggR"@r   c                     [         S 5       nU R                  [        USS9  U R                  [        USS9  U R	                  [        USS9  U R                  [        USS9  g )Nc                 .    [         R                  " U 5      $ r   )r   rV   rI  s    r   rK  +TestCudaMath.test_math_gamma.<locals>.ufunc  s    ::a= r   皙?r,  r   )r   r   rW   r   r   r   rM  s     r   test_math_gammaTestCudaMath.test_math_gamma  sh    		! 
	!##JS#A##JS#A!!*e1!="":uA">r   c                     [         S 5       nU R                  [        USS9  U R                  [        USS9  U R	                  [        USS9  U R                  [        USS9  g )Nc                 .    [         R                  " U 5      $ r   )r   rY   rI  s    r   rK  ,TestCudaMath.test_math_lgamma.<locals>.ufunc  s    ;;q>!r   rc  r,  r   )r   r   rZ   r   r   r   rM  s     r   test_math_lgammaTestCudaMath.test_math_lgamma
  sh    		" 
	"##Kc#B##Kc#B!!+uA!>"";Q"?r   c                    U R                  [        [        R                  SS9  U R	                  [        [        R                  SS9  U R                  [        [        R                  SS9  U R                  [        [        R                  SS9  g Nr   r,  )r   r]   r   r\   r   r   r   r  s    r   test_math_logTestCudaMath.test_math_log  sf    ##HbffA#>##HbffA#>!!(BFF!!<""8RVV1"=r   c                    U R                  [        [        R                  SS9  U R	                  [        [        R                  SS9  U R                  [        [        R                  SS9  U R                  [        [        R                  SS9  g rl  )r   r`   r   r_   r   r   r   r  s    r   test_math_log2TestCudaMath.test_math_log2  sf    ##Irwwa#@##Irwwa#@!!)RWWA!>""9bggQ"?r   c                    U R                  [        [        R                  SS9  U R	                  [        [        R                  SS9  U R                  [        [        R                  SS9  U R                  [        [        R                  SS9  g rl  )r   rc   r   rb   r   r   r   r  s    r   test_math_log10TestCudaMath.test_math_log10(  sf    ##J#B##J#B!!*bhha!@"":rxxq"Ar   c                 $   U R                  [        [        R                  5        U R	                  [        [        R                  5        U R                  [        [        R                  5        U R                  [        [        R                  5        g r   )r   rf   r   re   r   r   r   r  s    r   test_math_log1pTestCudaMath.test_math_log1p1  r[  r   c                    U R                  [        [        R                  SS9  U R	                  [        [        R                  SS9  U R                  [        [        R                  SS9  U R                  [        [        R                  SS9  g )Ngdy=r,  r   )r   ri   r   rh   r   r  r  r  s    r   test_math_remainder TestCudaMath.test_math_remainder:  sf    $$^R\\$O$$^R\\$O"">2<<q"I##NBLL#Jr   z3math.remainder(0, 0) raises a ValueError on CUDASimc                 *   [         R                  " [        [        S S S2   [        [        5      5      S 5       n[
        R                  " S[
        R                  5      nUS   " USS5        U R                  [
        R                  " US   5      5        g )Nr   c                 6    [         R                  " X5      U S'   g )Nr   )r   rh   )rrJ  ys      r   test_0_06TestCudaMath.test_math_remainder_0_0.<locals>.test_0_0B  s    >>!'AaDr   )r   r   r   )	r   r   r   r
   r   r   zeros
assertTruer   )r   r  r}  s      r   test_math_remainder_0_0$TestCudaMath.test_math_remainder_0_0@  sj    	$wss|UE2	3	( 
4	(HHQ

#q!Q1'r   c                 $   U R                  [        [        R                  5        U R	                  [        [        R                  5        U R                  [        [        R                  5        U R                  [        [        R                  5        g r   )r   rl   r   rk   r   r   r   r  s    r   test_math_sqrtTestCudaMath.test_math_sqrtL  r<  r   c                 $   U R                  [        [        R                  5        U R	                  [        [        R                  5        U R                  [        [        R                  5        U R                  [        [        R                  5        g r   )r   ro   r   rn   r   r  r  r  s    r   test_math_hypotTestCudaMath.test_math_hypotU  sR    $$Z:$$Z:"":rxx8##J9r   c                    Sn[         R                  " SSU5      R                  U5      n[         R                  " U[         R                  S9n[         R
                  " U5      n[        R                  " U5      S S S2   n[        R                  " U[        S S S2   U45      " [        5      nUSU4   " X4U5        [         R
                  " U5      n[        [        U5      5       H   n	[        R                  " X9   XI   5      X'   M"     [         R                  R!                  [         R"                  " X45      R                  U5      USS9  g )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_int32TestCudaMath.pow_template_int32^  s    KK2u%,,W5IIe288,MM!**73CaC8'51:w78Baha 
 }}Qs1vAhhqtQT*DG 


""288A>#8#8#A14"Pr   c                    U R                  [        [        R                  5        U R	                  [        [        R                  5        U R                  [        R                  5        U R                  [        R                  5        g r   )r   rr   r   r  r   r  r	   r
   r  s    r   test_math_powTestCudaMath.test_math_powo  sN    $$Xrxx8$$Xrxx8

+

+r   c                     U R                  [        [        R                  5        U R	                  [        [        R                  5        g r   )r   r   r   r  r   r  s    r   test_math_pow_binop TestCudaMath.test_math_pow_binopx  s*    $$^RXX>$$^RXX>r   c                 $   U R                  [        [        R                  5        U R	                  [        [        R                  5        U R                  [        [        R                  5        U R                  [        [        R                  5        g r   )r   ru   r   rt   r   r   r   r  s    r   test_math_ceilTestCudaMath.test_math_ceil  r<  r   c                 $   U R                  [        [        R                  5        U R	                  [        [        R                  5        U R                  [        [        R                  5        U R                  [        [        R                  5        g r   )r   rx   r   rw   r   r   r   r  s    r   test_math_floorTestCudaMath.test_math_floor  r[  r   c                 L    U R                  [        [        R                  5        g r   )r   r   r   r   r  s    r   test_math_truncTestCudaMath.test_math_trunc  s    ##J9r   z%trunc only supported on NumPy float64c                     U R                  [        [        R                  5        U R	                  [        [        R                  5        U R                  [        [        R                  5        g r   )r   r   r   r   r   r   r  s    r   test_math_trunc_non_float64(TestCudaMath.test_math_trunc_non_float64  s>    ##J9!!*bhh7"":rxx8r   c                     U R                  [        [        R                  SS9  U R	                  [        [        R                  SS9  g r]  )r   r{   r   rz   r   r  s    r   test_math_copysignTestCudaMath.test_math_copysign  s4    $$]BKKr$J$$]BKKr$Jr   c                   ^  U 4S jnU 4S jnSnT R                  S5         U" [        R                  " SSU5      [        R                  [        S S  S9  S S S 5        T R                  S5         U" [        R                  " [        R
                  [        R
                  * /5      [        R                  [        S S  S9  S S S 5        T R                  S	5         U" [        R                  [        S S  S9  S S S 5        T R                  S
5         U" [        R                  " SSU5      [        R                  [        S S  S9  S S S 5        T R                  S5         U" [        R                  " [        R
                  [        R
                  * /5      [        R                  [        S S  S9  S S S 5        T R                  S5         U" [        R                  [        S S  S9  S S S 5        g ! , (       d  f       GN= f! , (       d  f       GNE= f! , (       d  f       GN!= f! , (       d  f       N= f! , (       d  f       N= f! , (       d  f       g = f)Nc                   > [         R                  " [         R                  /U S9n[         R                  " U5      n[         R                  " U5      n[        R
                  " XU45      " [        5      nUS[        U5      4   " X#U5        TR                  [         R                  " U5      5        TR                  [         R                  " U5      5        g )Nr   r   )
r   r   r   
zeros_liker   r   r   r  r  r   )r   r   r   r   rC   r   r   s         r   modf_template_nan6TestCudaMath.test_math_modf.<locals>.modf_template_nan  s    "&&/Aa Aa AHHg89)DE!SV)Q1%OOBHHQK(OOBHHQK(r   c                   > U R                  U5      n [        R                  " U 5      n[        R                  " U 5      n[        R                  " X"U45      " [
        5      nUS[        U 5      4   " XU5        [        R                  " U 5      u  pgTR                  [        R                  " X65      5        TR                  [        R                  " XG5      5        g r   )
r   r   r  r   r   r   r  r   r  array_equal)	r   r   r   r   rC   r   DEr   s	           r   modf_template_compare:TestCudaMath.test_math_modf.<locals>.modf_template_compare  s    Aa Aa AHHg89)DE!SV)Q1%771:DAOOBNN1/0OOBNN1/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   r  r  r   s   `   r   test_math_modf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   4G+.AG=H4H!AH2I+
G:=
H
H!
H/2
I 
Ic                     U R                  [        [        R                  SS9  U R	                  [        [        R                  SS9  g rl  )r   r~   r   r}   r   r  s    r   test_math_fmodTestCudaMath.test_math_fmod  s4    $$Yq$A$$Yq$Ar   c                     U R                  [        [        R                  SS9  U R	                  [        [        R                  SS9  g rl  )r   r   r   r}   r   r  s    r   test_math_mod_binop TestCudaMath.test_math_mod_binop  s4    $$^RWWA$F$$^RWWA$Fr   c                    U R                  [        [        R                  5        U R	                  [        [        R                  5        U R                  [        [        R                  5        U R                  [        [        R                  5        U R                  [        [        R                  5        U R                  [        [        R                  5        g r   )	r   r   r   r   r   r   r   r   r   r  s    r   test_math_isnanTestCudaMath.test_math_isnan  z    ((RXX>((RXX>&&z288<&&z288<..z288D..z288Dr   c                    U R                  [        [        R                  5        U R	                  [        [        R                  5        U R                  [        [        R                  5        U R                  [        [        R                  5        U R                  [        [        R                  5        U R                  [        [        R                  5        g r   )	r   r   r   r   r   r   r   r   r   r  s    r   test_math_isinfTestCudaMath.test_math_isinf  r  r   c                    U R                  [        [        R                  5        U R	                  [        [        R                  5        U R                  [        [        R                  5        U R                  [        [        R                  5        U R                  [        [        R                  5        U R                  [        [        R                  5        g r   )	r   r   r   r   r   r   r   r   r   r  s    r   test_math_isfiniteTestCudaMath.test_math_isfinite  sz    ((D((D&&}bkkB&&}bkkB..}bkkJ..}bkkJr   c                     U R                  [        [        R                  5        U R	                  [        [        R                  5        g r   )r   r   r   r   r   r  s    r   test_math_degreesTestCudaMath.test_math_degrees  *    ((rzzB((rzzBr   c                     U R                  [        [        R                  5        U R	                  [        [        R                  5        g r   )r   r   r   r   r   r  s    r   test_math_radiansTestCudaMath.test_math_radians  r  r    N)r   r   )r   r   )r   1   )H__name__
__module____qualname____firstlineno__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  r4  r7  r:  r>  rA  rE  rN  rS  rV  rY  r^  rd  ri  rm  rp  rs  rv  ry  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  __static_attributes__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MMO r   