Commit 9ad27dfe authored by Gordian Edenhofer's avatar Gordian Edenhofer
Browse files

scaling_operator.py: Lazy-import `full`

parent 9e8af84e
Pipeline #70454 passed with stages
in 15 minutes and 40 seconds
......@@ -18,9 +18,6 @@
import numpy as np
from .endomorphic_operator import EndomorphicOperator
from ..field import Field
from ..multi_domain import MultiDomain
from ..multi_field import MultiField
class ScalingOperator(EndomorphicOperator):
......@@ -62,15 +59,14 @@ class ScalingOperator(EndomorphicOperator):
self._capability = self._all_ops
def apply(self, x, mode):
from ..sugar import full
self._check_input(x, mode)
fct = self._factor
if fct == 1.:
return x
if fct == 0.:
# Avoid a circular import by replicating `..sugar.full`
if isinstance(x.domain, (dict, MultiDomain)):
return MultiField.full(x.domain, 0.)
return Field.full(x.domain, 0.)
return full(x.domain, 0.)
MODES_WITH_ADJOINT = self.ADJOINT_TIMES | self.ADJOINT_INVERSE_TIMES
MODES_WITH_INVERSE = self.INVERSE_TIMES | self.ADJOINT_INVERSE_TIMES
......
Supports Markdown
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