o
    iA                  	   @   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betaZbinomZdigammaZexpnZhyp2f1Z_ufuncsZ	_lambertwZ	ellipkincZ	ellipeincZgdtribZsiciZshichitypesappend)Zcases_sourcecasesZufuncheaderroutinepreamble	signature r   [/home/kim/smarthome/.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   

r*   c                 C   sV   |j |j|j|j|j|jd}| d\}}g }|D ]}||jd|| d q|S )Nr   r       )Zdtype)	r   r   r   r   r   r   r!   r
   Zzeros)r   Zxpr#   r%   _argsr)   r   r   r   get_sample_input@   s   	r.   moduleT)scopeZ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 )NZCUPY_CACHE_DIR)tempfilemkdtemposenvirongetshutilrmtree)Ztemp_cache_dirZoriginal_cache_dirr   r   r   manage_cupy_cacheQ   s   
r8   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   hexr*   r   ZElementwiseKernelr   Z_get_includer.   )	r   r   r   r8   namer'   r(   funcr,   r   r   r   test_compiles_in_cupyb   s   	r>   )r3   ZpytestZscipy.specialZspecialr   r6   r1   uuidr   Zscipy.special._testutilsr   r   r   ImportErrorAttributeErrorr   r#   r*   r.   Zfixturer8   markZparametrizeZxslowr>   r   r   r   r   <module>   s:    

