def apply_exp_ixp(dst, src, p): # TODO: add sparse field support (x.internal_coordinates(), x.coordinates()) x = src.mview_coordinates() # create phase field phase = gpt.complex(src.grid) phase.checkerboard(src.checkerboard()) phase[x] = cgpt.coordinates_momentum_phase(x, p, src.grid.precision) dst @= phase * src
def apply_exp_ixp(dst, src, p, origin, cache): cache_key = f"{src.grid}_{src.checkerboard().__name__}_{origin}_{p}" if cache_key not in cache: x = gpt.coordinates(src) phase = gpt.complex(src.grid) phase.checkerboard(src.checkerboard()) x_relative = x if origin is not None: x_relative = relative_coordinates(x, origin, src.grid.fdimensions) phase[x] = cgpt.coordinates_momentum_phase(x_relative, p, src.grid.precision) cache[cache_key] = phase dst @= cache[cache_key] * src