#NEWLINE# def exp1( z_gpu ) : #NEWLINE# #INDENT# '\n    Exponential integral with `n = 1` of complex arguments.\n\n    Parameters\n    ----------\n    z_gpu : GPUArray\n        Input matrix of shape `(m, n)`.\n        \n    Returns\n    -------\n    e_gpu : GPUArray\n        GPUarrays containing the exponential integrals of\n        the entries of `z_gpu`.\n\n    Examples\n    --------\n    >>> import pycuda.gpuarray as gpuarray\n    >>> import pycuda.autoinit\n    >>> import numpy as np\n    >>> import scipy.special\n    >>> import special\n    >>> z = np.asarray(np.random.rand(4, 4)+1j*np.random.rand(4, 4), np.complex64)\n    >>> z_gpu = gpuarray.to_gpu(z)\n    >>> e_gpu = exp1(z_gpu)\n    >>> e_sp = scipy.special.exp1(z)\n    >>> np.allclose(e_sp, e_gpu.get())\n    True\n    ' #NEWLINE# if ( z_gpu . dtype == np . complex64 ) : #NEWLINE# #INDENT# args = 'pycuda::complex<float> *z, pycuda::complex<float> *e' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( z_gpu . dtype == np . complex128 ) : #NEWLINE# #INDENT# args = 'pycuda::complex<double> *z, pycuda::complex<double> *e' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( 'unsupported type' ) #NEWLINE# #UNINDENT# #UNINDENT# op = 'e[i] = exp1(z[i])' #NEWLINE# try : #NEWLINE# #INDENT# func = exp1 . cache [ z_gpu . dtype ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# func = elementwise . ElementwiseKernel ( args , op , options = [ '-I' , install_headers ] , preamble = '#include "cuSpecialFuncs.h"' ) #NEWLINE# exp1 . cache [ z_gpu . dtype ] = func #NEWLINE# #UNINDENT# e_gpu = gpuarray . empty_like ( z_gpu ) #NEWLINE# func ( z_gpu , e_gpu ) #NEWLINE# return op