def _to_diagonally_dominant_weighted(mat):
    """Make matrix weighted diagonally dominant using the Laplacian."""
    mat += np.diag(np.sum(np.abs(mat), axis=1) + 0.01)
    return mat
Make matrix weighted diagonally dominant using the Laplacian.