Commit c4d65780 authored by Jait Dixit's avatar Jait Dixit
Browse files

Merge branch 'master' into add_axes_to_rg_fft

parents 38c6be56 d9c94eb0
Pipeline #3214 skipped
...@@ -406,32 +406,26 @@ class distributed_data_object(object): ...@@ -406,32 +406,26 @@ class distributed_data_object(object):
""" """
remember_hermitianQ = self.hermitian remember_hermitianQ = self.hermitian
if inplace is True: local_data = self.get_local_data(copy=False)
temp = self try:
if dtype is not None and self.dtype != np.dtype(dtype): result_data = function(local_data)
about.warnings.cprint( except:
"WARNING: Inplace dtype conversion is not possible!") about.warnings.cprint(
"WARNING: Trying to use np.vectorize!")
result_data = np.vectorize(function)(local_data)
if inplace is True:
result_d2o = self
else: else:
temp = self.copy_empty(dtype=dtype) result_d2o = self.copy_empty(dtype=result_data.dtype)
if np.prod(self.local_shape) != 0: result_d2o.set_local_data(result_data, copy=False)
try:
temp.data[:] = function(self.data)
except:
about.warnings.cprint(
"WARNING: Trying to use np.vectorize!")
temp.data[:] = np.vectorize(function)(self.data)
else:
# Noting to do here. The value-empty array
# is also geometrically empty
pass
if function in (np.exp, np.log): if function in (np.exp, np.log):
temp.hermitian = remember_hermitianQ result_d2o.hermitian = remember_hermitianQ
else: else:
temp.hermitian = False result_d2o.hermitian = False
return temp return result_d2o
def apply_generator(self, generator, copy=False): def apply_generator(self, generator, copy=False):
""" Evaluates generator(local_shape) and stores the result locally. """ Evaluates generator(local_shape) and stores the result locally.
......
...@@ -87,6 +87,7 @@ class FFTW(FFT): ...@@ -87,6 +87,7 @@ class FFTW(FFT):
if 'pyfftw' not in gdi: if 'pyfftw' not in gdi:
raise ImportError("The module pyfftw is needed but not available.") raise ImportError("The module pyfftw is needed but not available.")
self.name = 'pyfftw'
# The plan_dict stores the plan_and_info objects which correspond # The plan_dict stores the plan_and_info objects which correspond
# to a certain set of (field_val, domain, codomain) sets. # to a certain set of (field_val, domain, codomain) sets.
self.plan_dict = {} self.plan_dict = {}
...@@ -402,6 +403,7 @@ class GFFT(FFT): ...@@ -402,6 +403,7 @@ class GFFT(FFT):
""" """
def __init__(self, fft_module_name): def __init__(self, fft_module_name):
self.name = fft_module_name
self.fft_machine = gdi.get(fft_module_name) self.fft_machine = gdi.get(fft_module_name)
if self.fft_machine is None: if self.fft_machine is None:
raise ImportError( raise ImportError(
......
...@@ -258,6 +258,7 @@ class rg_space(point_space): ...@@ -258,6 +258,7 @@ class rg_space(point_space):
distances=self.distances, distances=self.distances,
harmonic=self.harmonic, harmonic=self.harmonic,
datamodel=self.datamodel, datamodel=self.datamodel,
fft_module=self.fft_machine.name,
comm=self.comm) comm=self.comm)
def get_shape(self): def get_shape(self):
...@@ -482,6 +483,7 @@ class rg_space(point_space): ...@@ -482,6 +483,7 @@ class rg_space(point_space):
distances = 1 / (np.array(self.paradict['shape']) * distances = 1 / (np.array(self.paradict['shape']) *
np.array(self.distances)) np.array(self.distances))
datamodel = self.datamodel datamodel = self.datamodel
fft_module = self.fft_machine.name
comm = self.comm comm = self.comm
complexity = {0: 1, 1: 0, 2: 2}[self.paradict['complexity']] complexity = {0: 1, 1: 0, 2: 2}[self.paradict['complexity']]
harmonic = bool(not self.harmonic) harmonic = bool(not self.harmonic)
...@@ -492,6 +494,7 @@ class rg_space(point_space): ...@@ -492,6 +494,7 @@ class rg_space(point_space):
distances=distances, distances=distances,
harmonic=harmonic, harmonic=harmonic,
datamodel=datamodel, datamodel=datamodel,
fft_module=fft_module,
comm=comm) comm=comm)
return new_space return new_space
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment