The rigorous coupled wave method and the rigorous modal method are fre
quently used to analyze lamellar, multilevel gratings. Both methods re
sult in a system of linear equations that has to be solved to obtain t
he transmitted and reflected amplitudes. An algorithm is presented to
increase the numerical stability in the evaluation of these amplitudes
. Numerical examples and comparisons with recently published results a
re given.