Commit cbdbca99 authored by Martin Reinecke's avatar Martin Reinecke

re-add some code in commented form

parent f23c4d72
Pipeline #15143 passed with stage
in 6 minutes and 24 seconds
......@@ -617,6 +617,42 @@ class Field(Loggable, Versionable, object):
h *= np.sqrt(2)
a *= np.sqrt(2)
# The code below should not be needed in practice, since it would
# only ever be called when hermitianizing a purely real field.
# However it might be of educational use and keep us from forgetting
# how these things are done ...
# if not issubclass(val.dtype.type, np.complexfloating):
# # in principle one must not correct the variance for the fixed
# # points of the hermitianization. However, for a complex field
# # the input field loses half of its power at its fixed points
# # in the `hermitian` part. Hence, here a factor of sqrt(2) is
# # also necessary!
# # => The hermitianization can be done on a space level since
# # either nothing must be done (LMSpace) or ALL points need a
# # factor of sqrt(2)
# # => use the preserve_gaussian_variance flag in the
# # hermitian_decomposition method above.
#
# # This code is for educational purposes:
# fixed_points = [domain[i].hermitian_fixed_points()
# for i in spaces]
# fixed_points = [[fp] if fp is None else fp
# for fp in fixed_points]
#
# for product_point in itertools.product(*fixed_points):
# slice_object = np.array((slice(None), )*len(val.shape),
# dtype=np.object)
# for i, sp in enumerate(spaces):
# point_component = product_point[i]
# if point_component is None:
# point_component = slice(None)
# slice_object[list(domain_axes[sp])] = point_component
#
# slice_object = tuple(slice_object)
# h[slice_object] /= np.sqrt(2)
# a[slice_object] /= np.sqrt(2)
return (h, a)
def _spec_to_rescaler(self, spec, result_list, power_space_index):
......
......@@ -100,6 +100,27 @@ class RGSpace(Space):
self._distances = self._parse_distances(distances)
self._zerocenter = self._parse_zerocenter(zerocenter)
# This code is unused but may be useful to keep around if it is ever needed
# again in the future ...
# def hermitian_fixed_points(self):
# dimensions = len(self.shape)
# mid_index = np.array(self.shape)//2
# ndlist = [1]*dimensions
# for k in range(dimensions):
# if self.shape[k] % 2 == 0:
# ndlist[k] = 2
# ndlist = tuple(ndlist)
# fixed_points = []
# for index in np.ndindex(ndlist):
# for k in range(dimensions):
# if self.shape[k] % 2 != 0 and self.zerocenter[k]:
# index = list(index)
# index[k] = 1
# index = tuple(index)
# fixed_points += [tuple(index * mid_index)]
# return fixed_points
def hermitianize_inverter(self, x, axes):
# calculate the number of dimensions the input array has
dimensions = len(x.shape)
......
Markdown is supported
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