def coherence(U,m): Phi = random_phi(m,U.shape[0]) PU = Phi.dot(U) d = distance.pdist(PU.T,'cosine') return abs(1-d)