Abstract
A description of an algorithm for a rather general modal grating calculation is presented. Arbitrary profiles, depth, and permittivity are allowed. Gratings built up from sub-gratings are allowed, as are coatings on the sidewalls of lines, and arbitrary complex structure. Conical angles and good conductors are supported.