Formulation for stable and efficient implementation of the rigorous coupled-wave analysis of binary gratings | Synapse