Stable implementation of the rigorous coupled-wave analysis for surface-relief gratings: enhanced transmittance matrix approach | Synapse