o
    	hA                  	   @   s   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 zd dlZW n eefy=   edZY nw dd Zdd	d
ddddZdd Zdd Zejddddd Ze
edejde ejjdd ZdS )    N)uuid4)check_version)MissingModulecupyc                  C   s   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 ]\}}}d| d}|jD ]
}||||f qLq>|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	signature r   U/var/www/vscode/kcb/lib/python3.10/site-packages/scipy/special/tests/test_xsf_cuda.pyget_test_cases   s&   










r   float32float64	complex64
complex128int32int64fdFDilc                 C   s   |  d\}}g }g }t|D ]\}}|t|  d|  qt|D ]\}}|t|  d|  q$d|}d|}||fS )N->z inz outz, )split	enumerater   	dtype_mapjoin)r   in_out	in_params
out_paramsr+   typecoder   r   r   
get_params3   s   

r7   c                 C   sV   |j |j|j|j|j|jd}| d\}}g }|D ]}||jd|| d q|S )Nr&   r-      )dtype)	r    r!   r"   r#   r$   r%   r.   r   zeros)r   xpr0   r2   _argsr6   r   r   r   get_sample_input@   s   	r>   moduleT)scopeautousec                  c   sR    t  } tjdd }| tjd< d V  |d ur|tjd< ntjd= t|  d S )NCUPY_CACHE_DIR)tempfilemkdtemposenvirongetshutilrmtree)temp_cache_diroriginal_cache_dirr   r   r   manage_cupy_cacheQ   s   
rL   z13.0.0zsignature,preamble,routinec           	   	   C   sP   dt  j }t| \}}tj|||||dt  dfd}|t| t }d S )Nxz--include-path=z
-std=c++17)r   options)r   hexr7   r   ElementwiseKernelr   _get_includer>   )	r   r   r   rL   namer4   r5   funcr<   r   r   r   test_compiles_in_cupyb   s   	rT   )rE   pytestscipy.specialspecialr   rH   rC   uuidr   scipy.special._testutilsr   r   r   ImportErrorAttributeErrorr   r0   r7   r>   fixturerL   markparametrizexslowrT   r   r   r   r   <module>   s:    

