Commit 119da1a5 by Martin Reinecke

### simplifications

parent a2d0f803
Pipeline #22720 passed with stage
in 4 minutes and 49 seconds
 ... @@ -75,10 +75,6 @@ class DomainTuple(object): ... @@ -75,10 +75,6 @@ class DomainTuple(object): def __getitem__(self, i): def __getitem__(self, i): return self._dom[i] return self._dom[i] @property def domains(self): return self._dom @property @property def shape(self): def shape(self): return self._shape return self._shape ... @@ -108,7 +104,7 @@ class DomainTuple(object): ... @@ -108,7 +104,7 @@ class DomainTuple(object): return not self.__eq__(x) return not self.__eq__(x) def __str__(self): def __str__(self): res = "DomainTuple, len: " + str(len(self.domains)) res = "DomainTuple, len: " + str(len(self)) for i in self.domains: for i in self: res += "\n" + str(i) res += "\n" + str(i) return res return res
 ... @@ -81,9 +81,9 @@ class DiagonalOperator(EndomorphicOperator): ... @@ -81,9 +81,9 @@ class DiagonalOperator(EndomorphicOperator): else: else: self._spaces = cast_iseq_to_tuple(spaces) self._spaces = cast_iseq_to_tuple(spaces) nspc = len(self._spaces) nspc = len(self._spaces) if nspc != len(diagonal.domain.domains): if nspc != len(diagonal.domain): raise ValueError("spaces and domain must have the same length") raise ValueError("spaces and domain must have the same length") if nspc > len(self._domain.domains): if nspc > len(self._domain): raise ValueError("too many spaces") raise ValueError("too many spaces") if nspc > len(set(self._spaces)): if nspc > len(set(self._spaces)): raise ValueError("non-unique space indices") raise ValueError("non-unique space indices") ... @@ -92,7 +92,7 @@ class DiagonalOperator(EndomorphicOperator): ... @@ -92,7 +92,7 @@ class DiagonalOperator(EndomorphicOperator): for i, j in enumerate(self._spaces): for i, j in enumerate(self._spaces): if diagonal.domain[i] != self._domain[j]: if diagonal.domain[i] != self._domain[j]: raise ValueError("domain mismatch") raise ValueError("domain mismatch") if self._spaces == tuple(range(len(self._domain.domains))): if self._spaces == tuple(range(len(self._domain))): self._spaces = None # shortcut self._spaces = None # shortcut self._diagonal = diagonal.copy() self._diagonal = diagonal.copy() ... ...
 ... @@ -79,11 +79,11 @@ class FFTOperator(LinearOperator): ... @@ -79,11 +79,11 @@ class FFTOperator(LinearOperator): # Initialize domain and target # Initialize domain and target self._domain = DomainTuple.make(domain) self._domain = DomainTuple.make(domain) if space is None: if space is None: if len(self._domain.domains) != 1: if len(self._domain) != 1: raise ValueError("need a Field with exactly one domain") raise ValueError("need a Field with exactly one domain") space = 0 space = 0 space = int(space) space = int(space) if space < 0 or space >= len(self._domain.domains): if space < 0 or space >= len(self._domain): raise ValueError("space index out of range") raise ValueError("space index out of range") self._space = space self._space = space ... ...
 ... @@ -11,11 +11,11 @@ class FFTSmoothingOperator(EndomorphicOperator): ... @@ -11,11 +11,11 @@ class FFTSmoothingOperator(EndomorphicOperator): dom = DomainTuple.make(domain) dom = DomainTuple.make(domain) self._sigma = float(sigma) self._sigma = float(sigma) if space is None: if space is None: if len(dom.domains) != 1: if len(dom) != 1: raise ValueError("need a Field with exactly one domain") raise ValueError("need a Field with exactly one domain") space = 0 space = 0 space = int(space) space = int(space) if space < 0 or space >= len(dom.domains): if space < 0 or space >= len(dom): raise ValueError("space index out of range") raise ValueError("space index out of range") self._space = space self._space = space ... ...
 ... @@ -45,11 +45,11 @@ class LaplaceOperator(EndomorphicOperator): ... @@ -45,11 +45,11 @@ class LaplaceOperator(EndomorphicOperator): super(LaplaceOperator, self).__init__() super(LaplaceOperator, self).__init__() self._domain = DomainTuple.make(domain) self._domain = DomainTuple.make(domain) if space is None: if space is None: if len(self._domain.domains) != 1: if len(self._domain) != 1: raise ValueError("need a Field with exactly one domain") raise ValueError("need a Field with exactly one domain") space = 0 space = 0 space = int(space) space = int(space) if space < 0 or space >= len(self._domain.domains): if space < 0 or space >= len(self._domain): raise ValueError("space index out of range") raise ValueError("space index out of range") self._space = space self._space = space ... ...
 ... @@ -261,7 +261,7 @@ def create_composed_fft_operator(domain, codomain=None, all_to='other'): ... @@ -261,7 +261,7 @@ def create_composed_fft_operator(domain, codomain=None, all_to='other'): if codomain is None: if codomain is None: codomain = [None]*len(domain) codomain = [None]*len(domain) interdomain = list(domain.domains) interdomain = list(domain) for i, space in enumerate(domain): for i, space in enumerate(domain): if not isinstance(space, Space): if not isinstance(space, Space): continue continue ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!