functions to transform H into emb basis