
    e!hA                     x   d dl Z d dlZd dlmZ d dlZd dlZd dlmZ d dl	m
Z
 d dl	mZ 	 d dlZd Zddd	d
dddZd Zd Z ej&                  dd      d        Z e
ed      ej*                  j-                  d e             ej*                  j.                  d                      Zy# eef$ r  ed      ZY w xY w)    N)uuid4)check_version)MissingModulecupyc                     t         j                  ddft         j                  ddft         j                  ddft         j                  ddft         j
                  d	d
ft         j                  j                  ddft         j                  ddft         j                  ddft         j                  ddft         j                  ddft         j                  ddfg} g }| D ]1  \  }}}d| d}|j                  D ]  }|j                  |||f        3 |S )Nzcephes/beta.hz"out0 = xsf::cephes::beta(in0, in1)zbinom.hzout0 = xsf::binom(in0, in1)z	digamma.hzxsf::digamma(in0)zcephes/expn.hz"out0 = xsf::cephes::expn(in0, in1)zhyp2f1.hz&out0 = xsf::hyp2f1(in0, in1, in2, in3)z
lambertw.hz#out0 = xsf::lambertw(in0, in1, in2)zcephes/ellik.hz#out0 = xsf::cephes::ellik(in0, in1)zcephes/ellie.hz#out0 = xsf::cephes::ellie(in0, in1)zcdflib.hz!out0 = xsf::gdtrib(in0, in1, in2)zsici.hzxsf::sici(in0, &out0, &out1)zxsf::shichi(in0, &out0, &out1)z#include <xsf/>)scbetabinomdigammaexpnhyp2f1_ufuncs	_lambertw	ellipkinc	ellipeincgdtribsicishichitypesappend)cases_sourcecasesufuncheaderroutinepreamble	signatures          i/var/www/html/diagnosisapp-backend/venv/lib/python3.12/site-packages/scipy/special/tests/test_xsf_cuda.pyget_test_casesr       s   	/#GH	9;<	["56	/#GH	J HI			|-RS	')NO	')NO	J CD	(:;	H>?L E". 9vw#F81- 	9ILL)Xw78	99 L    float32float64	complex64
complex128int32int64fdFDilc                 >   | j                  d      \  }}g }g }t        |      D ]"  \  }}|j                  t        |    d|        $ t        |      D ]"  \  }}|j                  t        |    d|        $ dj	                  |      }dj	                  |      }||fS )N->z inz outz, )split	enumerater   	dtype_mapjoin)r   in_out	in_params
out_paramsr-   typecodes          r   
get_paramsr:   3   s    t$HCIJ ~ 98Ih/0A3789 ~ ;8Yx01aS9:;		)$I:&Jj  r!   c                    |j                   |j                  |j                  |j                  |j                  |j
                  d}| j                  d      \  }}g }|D ]'  }|j                  |j                  d||                ) |S )Nr(   r0      )dtype)	r"   r#   r$   r%   r&   r'   r1   r   zeros)r   xpr3   r5   _argsr9   s          r   get_sample_inputrB   @   s~    ZZZZ\\]]XXXXI __T"FCD <BHHQi&9H:;<Kr!   moduleT)scopeautousec               #     K   t        j                         } t        j                  j	                  dd       }| t        j                  d<   d  ||t        j                  d<   nt        j                  d= t        j                  |        y w)NCUPY_CACHE_DIR)tempfilemkdtemposenvirongetshutilrmtree)temp_cache_diroriginal_cache_dirs     r   manage_cupy_cacherQ   Q   sl      %%'N(8$?#1BJJ 	%'9

#$JJ'(
MM.!s   B	Bz13.0.0zsignature,preamble,routinec           
          dt               j                   }t        |       \  }}t        j                  |||||dt        j                          df      } |t        | t               }y )Nxz--include-path=z
-std=c++17)r   options)r   hexr:   r   ElementwiseKernelr	   _get_includerB   )	r   r   r   rQ   namer7   r8   funcr@   s	            r   test_compiles_in_cupyrZ   b   so     uw{{mD&y1Iz!!"2??#4"56ED 	y$/0Ar!   )rJ   pytestscipy.specialspecialr	   rM   rH   uuidr   scipy.special._testutilsr   r   r   ImportErrorAttributeErrorr    r3   r:   rB   fixturerQ   markparametrizexslowrZ    r!   r   <module>rg      s    	      2 2!
0 
						
!" h-" ."  tX5~7GH1  I 1o 	^$ ! D!s   B' 'B98B9