Пример #1
0
 def _assert_positive_definite(self):
   # This operator has the action  Ax = F^H D F x,
   # where D is the diagonal matrix with self.spectrum on the diag.  Therefore,
   # <x, Ax> = <Fx, DFx>,
   # Since F is bijective, the condition for positive definite is the same as
   # for a diagonal matrix, i.e. real part of spectrum is positive.
   message = (
       "Not positive definite:  Real part of spectrum was not all positive.")
   return check_ops.assert_positive(
       math_ops.real(self.spectrum), message=message)
Пример #2
0
    def _assert_positive_definite(self):
        if np.issubdtype(self.dtype, np.complexfloating):
            message = (
                "Diagonal operator had diagonal entries with non-positive real part, "
                "thus was not positive definite.")
        else:
            message = (
                "Real diagonal operator had non-positive diagonal entries, "
                "thus was not positive definite.")

        return check_ops.assert_positive(math_ops.real(self._diag),
                                         message=message)
Пример #3
0
 def _assert_positive_definite(self):
   """Default implementation of _assert_positive_definite."""
   logging.warn(
       "Using (possibly slow) default implementation of "
       "assert_positive_definite."
       "  Requires conversion to a dense matrix and O(N^3) operations.")
   # If the operator is self-adjoint, then checking that
   # Cholesky decomposition succeeds + results in positive diag is necessary
   # and sufficient.
   if self.is_self_adjoint:
     return check_ops.assert_positive(
         _linalg.diag_part(linalg_ops.cholesky(self.to_dense())),
         message="Matrix was not positive definite.")
   # We have no generic check for positive definite.
   raise NotImplementedError("assert_positive_definite is not implemented.")
 def _assert_positive_definite(self):
     return check_ops.assert_positive(
         math_ops.real(self.multiplier),
         message="LinearOperator was not positive definite.")
 def _assert_non_singular(self):
     return check_ops.assert_positive(math_ops.abs(self.multiplier),
                                      message="LinearOperator was singular")