Problem-matched basis functions for moment method analysis-an application to reflection gratings