Ejemplo n.º 1
0
 def _add(self, op1, op2, operator_name, hints):
   return linear_operator_diag.LinearOperatorDiag(
       diag=op1.diag_part() + op2.diag_part(),
       is_non_singular=hints.is_non_singular,
       is_self_adjoint=hints.is_self_adjoint,
       is_positive_definite=hints.is_positive_definite,
       name=operator_name)
def _cholesky_diag(diag_operator):
    return linear_operator_diag.LinearOperatorDiag(math_ops.sqrt(
        diag_operator.diag),
                                                   is_non_singular=True,
                                                   is_self_adjoint=True,
                                                   is_positive_definite=True,
                                                   is_square=True)
Ejemplo n.º 3
0
def _inverse_diag(diag_operator):
    return linear_operator_diag.LinearOperatorDiag(
        1. / diag_operator.diag,
        is_non_singular=diag_operator.is_non_singular,
        is_self_adjoint=diag_operator.is_self_adjoint,
        is_positive_definite=diag_operator.is_positive_definite,
        is_square=True)
Ejemplo n.º 4
0
def _matmul_linear_operator_diag(linop_a, linop_b):
  return linear_operator_diag.LinearOperatorDiag(
      diag=linop_a.diag * linop_b.diag,
      is_non_singular=registrations_util.combined_non_singular_hint(
          linop_a, linop_b),
      is_self_adjoint=registrations_util.combined_commuting_self_adjoint_hint(
          linop_a, linop_b),
      is_positive_definite=(
          registrations_util.combined_commuting_positive_definite_hint(
              linop_a, linop_b)),
      is_square=True)
def _adjoint_diag(diag_operator):
  diag = diag_operator.diag
  if np.issubdtype(diag.dtype, np.complexfloating):
    diag = math_ops.conj(diag)

  return linear_operator_diag.LinearOperatorDiag(
      diag=diag,
      is_non_singular=diag_operator.is_non_singular,
      is_self_adjoint=diag_operator.is_self_adjoint,
      is_positive_definite=diag_operator.is_positive_definite,
      is_square=True)
Ejemplo n.º 6
0
def _matmul_linear_operator_diag_scaled_identity_left(
    linop_scaled_identity, linop_diag):
  return linear_operator_diag.LinearOperatorDiag(
      diag=linop_diag.diag * linop_scaled_identity.multiplier,
      is_non_singular=registrations_util.combined_non_singular_hint(
          linop_diag, linop_scaled_identity),
      is_self_adjoint=registrations_util.combined_commuting_self_adjoint_hint(
          linop_diag, linop_scaled_identity),
      is_positive_definite=(
          registrations_util.combined_commuting_positive_definite_hint(
              linop_diag, linop_scaled_identity)),
      is_square=True)
Ejemplo n.º 7
0
 def _set_diag_operators(self, diag_update, is_diag_update_positive):
   """Set attributes self._diag_update and self._diag_operator."""
   if diag_update is not None:
     self._diag_operator = linear_operator_diag.LinearOperatorDiag(
         self._diag_update, is_positive_definite=is_diag_update_positive)
   else:
     if tensor_shape.dimension_value(tensor_shape.TensorShape(self.u.shape)[-1]) is not None:
       r = tensor_shape.dimension_value(tensor_shape.TensorShape(self.u.shape)[-1])
     else:
       r = array_ops.shape(self.u)[-1]
     self._diag_operator = linear_operator_identity.LinearOperatorIdentity(
         num_rows=r, dtype=self.dtype)