The scattering of plane wave incident on multilayer structure, refractive index in each layer being a function of one lateral dimension in layers plane, is considered in symbolic vector- operator form. In this framework a S-matrix propagation algorithm is developed, which rigorously eliminates backscattering from solution procedure. In the case of grating layers with unique-period refractive indices the S-matrix propagation algorithm is implemented with Fourier-transform technique of numerical solution. Stability upon increasing truncation order, layers depths and number, and a high-precision holding of power conservation test within the S-matrix propagation are found. Convergence issue for Fourier-transform implementation in TM polarization is recapitulated and a new recipe of its using is suggested. The examples of optimal designs are considered.