Formulation and comparison of two recursive matrix algorithms for modeling layered diffraction gratings | Synapse