Rigorous coupled-wave analysis of planar-grating diffraction | Synapse