Commit 590406ac authored by Martin Reinecke's avatar Martin Reinecke
Browse files

improve tests for positive definiteness

parent 40746352
Pipeline #28595 passed with stages
in 3 minutes and 22 seconds
......@@ -178,8 +178,7 @@ class DiagonalOperator(EndomorphicOperator):
return res
def draw_sample(self, from_inverse=False, dtype=np.float64):
if (np.issubdtype(self._ldiag.dtype, np.complexfloating) or
(self._ldiag <= 0.).any()):
if np.issubdtype(self._ldiag.dtype, np.complexfloating):
raise ValueError("operator not positive definite")
res = Field.from_random(random_type="normal", domain=self._domain,
dtype=dtype)
......
......@@ -98,7 +98,9 @@ class ScalingOperator(EndomorphicOperator):
def draw_sample(self, from_inverse=False, dtype=np.float64):
fct = self._factor
if fct.imag != 0. or fct.real <= 0.:
if fct.imag != 0. or fct.real < 0.:
raise ValueError("operator not positive definite")
if fct.real == 0. and from_inverse:
raise ValueError("operator not positive definite")
fct = 1./np.sqrt(fct) if from_inverse else np.sqrt(fct)
return Field.from_random(
......
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