Commit a2caa9d2 by Martin Reinecke

### tuning

parent 7d2c751e
Pipeline #18183 passed with stage
in 6 minutes and 13 seconds
 ... @@ -43,6 +43,27 @@ class RGRGTransformation(Transformation): ... @@ -43,6 +43,27 @@ class RGRGTransformation(Transformation): def unitary(self): def unitary(self): return True return True @staticmethod def _fill_upper_half(tmp, res, axes): lastaxis = axes[-1] nlast = res.shape[lastaxis] ntmplast = tmp.shape[lastaxis] nrem = nlast - ntmplast slice1 = [slice(None)]*res.ndim slice2 = list(slice1) for i in axes: slice1[i] = slice(1, None) slice2[i] = slice(None, 0, -1) slice1[lastaxis] = slice(ntmplast, None) slice2[lastaxis] = slice(nrem, 0, -1) res[slice1] = tmp[slice2].real-tmp[slice2].imag for i in range(len(axes)-1): ax = axes[i] dim1 = [slice(None)]*res.ndim dim1[ax]=slice(0,1) axes2 = axes[:i] + axes[i+1:] RGRGTransformation._fill_upper_half(tmp[dim1], res[dim1], axes2) @staticmethod @staticmethod def _hartley(a, axes=None): def _hartley(a, axes=None): # Check if the axes provided are valid given the shape # Check if the axes provided are valid given the shape ... @@ -64,13 +85,7 @@ class RGRGTransformation(Transformation): ... @@ -64,13 +85,7 @@ class RGRGTransformation(Transformation): slice1 = [slice(None)]*a.ndim slice1 = [slice(None)]*a.ndim slice1[lastaxis] = slice(0, ntmplast) slice1[lastaxis] = slice(0, ntmplast) res[slice1] = tmp.real+tmp.imag res[slice1] = tmp.real+tmp.imag tmp = np.roll(tmp, -1, axes) RGRGTransformation._fill_upper_half (tmp, res, axes) slice1[lastaxis] = slice(ntmplast, None) slice2 = [slice(None)]*a.ndim for i in axes: slice2[i] = slice(None, None, -1) slice2[lastaxis] = slice(nrem-1, None, -1) res[slice1] = tmp[slice2].real-tmp[slice2].imag return res return res def transform(self, val, axes=None): def transform(self, val, axes=None): ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!