Generalized eigenfunctions of layered elastic media and application to diffuse fields.