Commit de0a55da authored by Martin Reinecke's avatar Martin Reinecke
Browse files

Merge branch 'null_operator' into 'NIFTy_5'

Null operator tweaks

See merge request ift/nifty-dev!49
parents 093f8b06 43ce93de
......@@ -20,6 +20,7 @@ from __future__ import absolute_import, division, print_function
from ..compat import *
from ..multi.multi_domain import MultiDomain
from ..field import Field
from .linear_operator import LinearOperator
......@@ -53,7 +54,8 @@ class SelectionOperator(LinearOperator):
def apply(self, x, mode):
self._check_input(x, mode)
if mode == self.TIMES:
return x[self._key]
f = x[self._key]
return Field.full(self.target, 0) if f is None else f
else:
from ..multi.multi_field import MultiField
return MultiField.from_dict({self._key: x}, self._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