Preconditioning the p-FEM Mass Matrix: Theory, Implementation, and Applications