o
    Ö­jA  ã                	   @   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   ú^/var/www/html/CropPilot/venv/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:    ÿú

