Commit db6c8996 authored by Martin Reinecke's avatar Martin Reinecke

simplifications and comments

parent 8466e7fc
...@@ -6,9 +6,9 @@ from ..domain_tuple import DomainTuple ...@@ -6,9 +6,9 @@ from ..domain_tuple import DomainTuple
from .linear_operator import LinearOperator from .linear_operator import LinearOperator
# MR FIXME: this needs to be rewritten in a generic fashion
class DomainDistributor(LinearOperator): class DomainDistributor(LinearOperator):
def __init__(self, target, axis): def __init__(self, target, axis):
# TODO Replace this by a DiagonalOperator
if dobj.ntask > 1: if dobj.ntask > 1:
raise NotImplementedError('UpProj class does not support MPI.') raise NotImplementedError('UpProj class does not support MPI.')
assert len(target) == 2 assert len(target) == 2
......
...@@ -17,12 +17,10 @@ ...@@ -17,12 +17,10 @@
# and financially supported by the Studienstiftung des deutschen Volkes. # and financially supported by the Studienstiftung des deutschen Volkes.
from ..multi.multi_domain import MultiDomain from ..multi.multi_domain import MultiDomain
from ..multi.multi_field import MultiField
from .linear_operator import LinearOperator
class MultiAdaptor(LinearOperator): def MultiAdaptor(target):
"""Transforms a Field into a MultiField and vise versa when """Transforms a Field into a MultiField and vice versa when
using adjoint_times. using adjoint_times.
Parameters Parameters
...@@ -30,30 +28,8 @@ class MultiAdaptor(LinearOperator): ...@@ -30,30 +28,8 @@ class MultiAdaptor(LinearOperator):
target: MultiDomain target: MultiDomain
MultiDomain with only one entry (key). MultiDomain with only one entry (key).
""" """
if not isinstance(target, MultiDomain) or len(target) > 1:
def __init__(self, target): raise TypeError
super(MultiAdaptor, self).__init__() return SelectionOperator(target,target.keys()[0]).adjoint
if not isinstance(target, MultiDomain) or len(target) > 1: self._target = target
raise TypeError self._domain = list(target.values())[0]
self._target = target
self._domain = list(target.values())[0]
@property
def domain(self):
return self._domain
@property
def target(self):
return self._target
@property
def capability(self):
return self.TIMES | self.ADJOINT_TIMES
def apply(self, x, mode):
self._check_input(x, mode)
key = list(self.target.keys())[0]
if mode == self.TIMES:
return MultiField({key: x})
else:
return x[key]
...@@ -4,6 +4,7 @@ from .endomorphic_operator import EndomorphicOperator ...@@ -4,6 +4,7 @@ from .endomorphic_operator import EndomorphicOperator
from .. import dobj from .. import dobj
# MR FIXME: we should make sure that the domain is a harmonic RGSpace, correct?
class SymmetrizingOperator(EndomorphicOperator): class SymmetrizingOperator(EndomorphicOperator):
def __init__(self, domain): def __init__(self, domain):
self._domain = DomainTuple.make(domain) self._domain = DomainTuple.make(domain)
......
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