Commit 46f15758 authored by Martin Reinecke's avatar Martin Reinecke

compactify

parent bfeb39ae
Pipeline #26499 passed with stage
in 5 minutes and 35 seconds
......@@ -98,19 +98,14 @@ class ScalingOperator(EndomorphicOperator):
raise ValueError("Operator not positive definite")
return sample * np.sqrt(self._factor)
def draw_sample(self, dtype=np.float64):
if self._factor.imag != 0. or self._factor.real <= 0.:
def _sample_helper(self, fct, dtype):
if fct.imag != 0. or fct.real <= 0.:
raise ValueError("operator not positive definite")
return Field.from_random(random_type="normal",
domain=self._domain,
std=np.sqrt(self._factor),
dtype=dtype)
return Field.from_random(
random_type="normal", domain=self._domain, std=fct, dtype=dtype)
def inverse_draw_sample(self, dtype=np.float64):
if self._factor.imag != 0. or self._factor.real <= 0.:
raise ValueError("operator not positive definite")
def draw_sample(self, dtype=np.float64):
return self._sample_helper(np.sqrt(self._factor), dtype)
return Field.from_random(random_type="normal",
domain=self._domain,
std=1./np.sqrt(self._factor),
dtype=dtype)
def inverse_draw_sample(self, dtype=np.float64):
return self._sample_helper(1./np.sqrt(self._factor), dtype)
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