def _log_abs_determinant(self):
        # Recall
        #   det(L + UDV^H) = det(D^{-1} + V^H L^{-1} U) det(D) det(L)
        #                  = det(C) det(D) det(L)
        log_abs_det_d = self.diag_operator.log_abs_determinant()
        log_abs_det_l = self.base_operator.log_abs_determinant()

        if self._use_cholesky:
            chol_cap_diag = _linalg.diag_part(self._chol_capacitance)
            log_abs_det_c = 2 * math_ops.reduce_sum(
                math_ops.log(chol_cap_diag), axis=[-1])
        else:
            det_c = linalg_ops.matrix_determinant(self._capacitance)
            log_abs_det_c = math_ops.log(math_ops.abs(det_c))
            if np.issubdtype(self.dtype, np.complexfloating):
                log_abs_det_c = _ops.cast(log_abs_det_c, dtype=self.dtype)

        return log_abs_det_c + log_abs_det_d + log_abs_det_l
Пример #2
0
 def _log_abs_determinant(self):
     logging.warn(
         "Using (possibly slow) default implementation of determinant."
         "  Requires conversion to a dense matrix and O(N^3) operations.")
     if self._can_use_cholesky():
         diag = _linalg.diag_part(linalg_ops.cholesky(self.to_dense()))
         return 2 * math_ops.reduce_sum(math_ops.log(diag), axis=[-1])
     _, log_abs_det = linalg.slogdet(self.to_dense())
     return log_abs_det
Пример #3
0
 def _log_abs_determinant(self):
     axis = [-(i + 1) for i in range(self.block_depth)]
     lad = math_ops.reduce_sum(math_ops.log(self._abs_spectrum), axis=axis)
     return _ops.cast(lad, self.dtype)
 def _log_abs_determinant(self):
     log_det = math_ops.reduce_sum(math_ops.log(math_ops.abs(self._diag)),
                                   axis=[-1])
     if np.issubdtype(self.dtype, np.complexfloating):
         log_det = _ops.cast(log_det, dtype=self.dtype)
     return log_det
 def _log_abs_determinant(self):
     return math_ops.reduce_sum(math_ops.log(math_ops.abs(
         self._get_diag())),
                                axis=[-1])
 def _log_abs_determinant(self):
     return self._num_rows_cast_to_real_dtype * math_ops.log(
         math_ops.abs(self.multiplier))