Tangent space embedding

Different connectivity measures, including tangent space measure
All these functions are special cases of a general pattern:

    if mat.ndim != 2 or mat.shape[0] != mat.shape[-1]:
        raise ValueError('expected a square matrix')
    vals, vecs = linalg.eigh(mat)
    mat_exp = np.dot(vecs * f(vals), vecs.T)
    return mat_exp

You can factorize some code