Sampling inequalities for infinitely smooth functions, with applications to interpolation and machine learning