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

nor more need for process_sample()

parent 9f9b0ed3
Pipeline #26507 passed with stage
in 5 minutes and 30 seconds
......@@ -114,9 +114,3 @@ class ChainOperator(LinearOperator):
for op in t_ops:
x = op.apply(x, mode)
return x
def draw_sample(self, dtype=np.float64):
sample = self._ops[-1].draw_sample(dtype)
for op in reversed(self._ops[:-1]):
sample = op.process_sample(sample)
return sample
......@@ -172,14 +172,6 @@ class DiagonalOperator(EndomorphicOperator):
res._ldiag = self._ldiag.conjugate()
return res
def process_sample(self, sample):
if np.issubdtype(self._ldiag.dtype, np.complexfloating):
raise ValueError("cannot draw sample from complex-valued operator")
res = Field.empty_like(sample)
res.local_data[()] = sample.local_data * np.sqrt(self._ldiag)
return res
def draw_sample(self, dtype=np.float64):
if (np.issubdtype(self._ldiag.dtype, np.complexfloating) or
(self._ldiag <= 0.).any()):
......
......@@ -95,11 +95,6 @@ class ScalingOperator(EndomorphicOperator):
return self.TIMES | self.ADJOINT_TIMES
return self._all_ops
def process_sample(self, sample):
if self._factor.imag != 0. or self._factor.real <= 0.:
raise ValueError("Operator not positive definite")
return sample * np.sqrt(self._factor)
def _sample_helper(self, fct, dtype):
if fct.imag != 0. or fct.real <= 0.:
raise ValueError("operator not positive definite")
......
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