Transfer matrix and full Maxwell time domain analysis of nonlinear gratings