#NEWLINE# def __init__( self , shape , in_dtype , out_dtype , batch = 1 , stream = None , mode = 1 , inembed = None , istride = 1 , idist = 0 , onembed = None , ostride = 1 , odist = 0 , auto_allocate = True ) : #NEWLINE# #INDENT# if np . isscalar ( shape ) : #NEWLINE# #INDENT# self . shape = ( shape , ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . shape = shape #NEWLINE# #UNINDENT# self . in_dtype = in_dtype #NEWLINE# self . out_dtype = out_dtype #NEWLINE# if ( batch <= 0 ) : #NEWLINE# #INDENT# raise ValueError ( 'batch size must be greater than 0' ) #NEWLINE# #UNINDENT# self . batch = batch #NEWLINE# if ( ( in_dtype == np . float32 ) and ( out_dtype == np . complex64 ) ) : #NEWLINE# #INDENT# self . fft_type = cufft . CUFFT_R2C #NEWLINE# self . fft_func = cufft . cufftExecR2C #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( in_dtype == np . complex64 ) and ( out_dtype == np . float32 ) ) : #NEWLINE# #INDENT# self . fft_type = cufft . CUFFT_C2R #NEWLINE# self . fft_func = cufft . cufftExecC2R #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( in_dtype == np . complex64 ) and ( out_dtype == np . complex64 ) ) : #NEWLINE# #INDENT# self . fft_type = cufft . CUFFT_C2C #NEWLINE# self . fft_func = cufft . cufftExecC2C #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( in_dtype == np . float64 ) and ( out_dtype == np . complex128 ) ) : #NEWLINE# #INDENT# self . fft_type = cufft . CUFFT_D2Z #NEWLINE# self . fft_func = cufft . cufftExecD2Z #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( in_dtype == np . complex128 ) and ( out_dtype == np . float64 ) ) : #NEWLINE# #INDENT# self . fft_type = cufft . CUFFT_Z2D #NEWLINE# self . fft_func = cufft . cufftExecZ2D #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( in_dtype == np . complex128 ) and ( out_dtype == np . complex128 ) ) : #NEWLINE# #INDENT# self . fft_type = cufft . CUFFT_Z2Z #NEWLINE# self . fft_func = cufft . cufftExecZ2Z #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( 'unsupported input/output type combination' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# capability = misc . get_compute_capability ( misc . get_current_device ( ) ) #NEWLINE# if ( ( capability < 1.3 ) and ( misc . isdoubletype ( in_dtype ) or misc . isdoubletype ( out_dtype ) ) ) : #NEWLINE# #INDENT# raise RuntimeError ( ( 'double precision requires compute capability >= 1.3 (you have %g)' % capability ) ) #NEWLINE# #UNINDENT# if ( inembed is not None ) : #NEWLINE# #INDENT# inembed = inembed . ctypes . data #NEWLINE# #UNINDENT# if ( onembed is not None ) : #NEWLINE# #INDENT# onembed = onembed . ctypes . data #NEWLINE# #UNINDENT# if ( len ( self . shape ) <= 0 ) : #NEWLINE# #INDENT# raise ValueError ( 'invalid transform size' ) #NEWLINE# #UNINDENT# n = np . asarray ( self . shape , np . int32 ) #NEWLINE# self . handle = cufft . cufftCreate ( ) #NEWLINE# cufft . cufftSetCompatibilityMode ( self . handle , mode ) #NEWLINE# cufft . cufftSetAutoAllocation ( self . handle , auto_allocate ) #NEWLINE# self . worksize = cufft . cufftMakePlanMany ( self . handle , len ( self . shape ) , n . ctypes . data , inembed , istride , idist , onembed , ostride , odist , self . fft_type , self . batch ) #NEWLINE# if ( stream != None ) : #NEWLINE# #INDENT# cufft . cufftSetStream ( self . handle , stream . handle )