def _logdet(A):
    vals = linalg.eigh(A)[0]
    # avoid negative (numerical errors) or zero (semi-definite matrix) values
    tol = vals.max() * vals.size * np.finfo(np.float64).eps
    vals = np.where(vals > tol, vals, tol)
    return np.sum(np.log(vals))
Compute the log det of a symmetric matrix.
dataset/ETHPy150Open mne-tools/mne-python/mne/cov.py/_logdet