Commit 3f5eaece authored by Martin Reinecke's avatar Martin Reinecke
Browse files

remove the transformation cache

parent 20edb351
Pipeline #16681 passed with stage
in 12 minutes
......@@ -29,8 +29,7 @@ from transformations import RGRGTransformation,\
LMGLTransformation,\
LMHPTransformation,\
GLLMTransformation,\
HPLMTransformation,\
TransformationCache
HPLMTransformation
class FFTOperator(LinearOperator):
......@@ -135,11 +134,11 @@ class FFTOperator(LinearOperator):
backward_class = self.transformation_dictionary[
(self.target[0].__class__, self.domain[0].__class__)]
self._forward_transformation = TransformationCache.create(
forward_class, self.domain[0], self.target[0], module=module)
self._forward_transformation = forward_class(
self.domain[0], self.target[0], module=module)
self._backward_transformation = TransformationCache.create(
backward_class, self.target[0], self.domain[0], module=module)
self._backward_transformation = backward_class(
self.target[0], self.domain[0], module=module)
# Store the dtype information
self.domain_dtype = \
......
......@@ -21,5 +21,3 @@ from gllmtransformation import GLLMTransformation
from hplmtransformation import HPLMTransformation
from lmgltransformation import LMGLTransformation
from lmhptransformation import LMHPTransformation
from transformation_cache import TransformationCache
\ No newline at end of file
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright(C) 2013-2017 Max-Planck-Society
#
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# and financially supported by the Studienstiftung des deutschen Volkes.
class _TransformationCache(object):
def __init__(self):
self.cache = {}
def create(self, transformation_class, domain, codomain, module):
key = (domain, codomain, module)
if key not in self.cache:
self.cache[key] = transformation_class(domain, codomain, module)
return self.cache[key]
TransformationCache = _TransformationCache()
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