def spectral_projection(u, eigenpairs):
 coeff = []
 evect = eigenpairs[1]
 for ev in evect:
  c = sum([(evv * uv) for (evv, uv) in zip(ev, u)])
  coeff.append(c)
 return coeff

def spectral_projection ( u , eigenpairs ) : coeff = [ ] evect = eigenpairs [ 1 ] for ev in evect : c = sum ( [ ( evv * uv ) for ( evv , uv ) in zip ( ev , u ) ] ) coeff . append ( c ) return coeff
returns the coefficients of each eigenvector in a projection of the vector u onto the normalized eigenvectors which are contained in eigenpairs .