Commit 47fe571f authored by Philipp Arras's avatar Philipp Arras
Browse files

Cleanup

parent a5b955e5
Pipeline #31644 failed with stages
in 3 minutes and 19 seconds
......@@ -20,6 +20,7 @@ from .model import Model
class Constant(Model):
# TODO Remove position
def __init__(self, position, constant):
super(Constant, self).__init__(position)
self._constant = constant
......
......@@ -16,10 +16,11 @@
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# and financially supported by the Studienstiftung des deutschen Volkes.
from ..field import Field
from ..multi import MultiField
from ..operators.selection_operator import SelectionOperator
from ..operators.diagonal_operator import DiagonalOperator
from ..sugar import makeOp
from ..utilities import NiftyMetaBase
from ..field import Field
class Model(NiftyMetaBase()):
......@@ -49,7 +50,7 @@ class Model(NiftyMetaBase()):
if isinstance(other, Model):
from .binary_helpers import Add
return Add.make(self, other)
if isinstance(other, Field):
if isinstance(other, (Field, MultiField)):
from .constant import Constant
return self.__add__(Constant(self.position, other))
raise TypeError
......@@ -64,8 +65,8 @@ class Model(NiftyMetaBase()):
if isinstance(other, Model):
from .binary_helpers import Mul
return Mul.make(self, other)
if isinstance(other, Field):
return DiagonalOperator(other)(self)
if isinstance(other, (Field, MultiField)):
return makeOp(other)(self)
raise NotImplementedError
def __rmul__(self, other):
......
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