Commit 749e909e authored by Reimar Leike's avatar Reimar Leike Committed by Philipp Arras
Browse files

Fixed Realizer to follow consistent real/compelx behavior

parent f2c30d01
Pipeline #103101 failed with stages
in 55 seconds
...@@ -109,7 +109,13 @@ class Realizer(EndomorphicOperator): ...@@ -109,7 +109,13 @@ class Realizer(EndomorphicOperator):
def apply(self, x, mode): def apply(self, x, mode):
self._check_input(x, mode) self._check_input(x, mode)
return x.real if mode == self.TIMES:
if not np.issubdtype(x.dtype, np.complexfloating):
raise ValueError
return x.real
if x.dtype not in (np.float64, np.float32):
raise ValueError
return Field(x.domain, x.val.astype(np.complex128))
class Imaginizer(EndomorphicOperator): class Imaginizer(EndomorphicOperator):
......
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