diff --git a/Wrappers/Python/cil/optimisation/operators/Operator.py b/Wrappers/Python/cil/optimisation/operators/Operator.py index 29e7e30949..8590294823 100644 --- a/Wrappers/Python/cil/optimisation/operators/Operator.py +++ b/Wrappers/Python/cil/optimisation/operators/Operator.py @@ -245,7 +245,7 @@ def __init__(self, operator, scalar, **kwargs): :param operator: a Operator or LinearOperator :param scalar: a scalar multiplier - :type scalar: float''' + :type scalar: Number''' super(ScaledOperator, self).__init__(domain_geometry=operator.domain_geometry(), range_geometry=operator.range_geometry()) @@ -256,7 +256,9 @@ def __init__(self, operator, scalar, **kwargs): def direct(self, x, out=None): '''direct method''' if out is None: - return self.scalar * self.operator.direct(x, out=out) + tmp = self.operator.direct(x) + tmp *= self.scalar + return tmp else: self.operator.direct(x, out=out) out *= self.scalar @@ -264,7 +266,9 @@ def adjoint(self, x, out=None): '''adjoint method''' if self.operator.is_linear(): if out is None: - return self.scalar * self.operator.adjoint(x, out=out) + tmp = self.operator.adjoint(x) + tmp *= self.scalar + return tmp else: self.operator.adjoint(x, out=out) out *= self.scalar @@ -273,12 +277,7 @@ def adjoint(self, x, out=None): def norm(self, **kwargs): '''norm of the operator''' return numpy.abs(self.scalar) * self.operator.norm(**kwargs) - # def range_geometry(self): - # '''range of the operator''' - # return self.operator.range_geometry() - # def domain_geometry(self): - # '''domain of the operator''' - # return self.operator.domain_geometry() + def is_linear(self): '''returns whether the operator is linear