  The Liouville-Lanczos approach to linear-response time-dependent
density-functional theory is generalized so as to encompass electron
energy-loss and inelastic X-ray scattering spectroscopies in periodic solids.
The computation of virtual orbitals and the manipulation of large matrices are
avoided by adopting a representation of response orbitals borrowed from
(time-independent) density-functional perturbation theory and a suitable
Lanczos recursion scheme. The latter allows the bulk of the numerical work to
be performed at any given transferred momentum only once, for a whole extended
frequency range. The numerical complexity of the method is thus greatly
reduced, making the computation of the loss function over a wide frequency
range at any given transferred momentum only slightly more expensive than a
single standard ground-state calculation, and opening the way to computations
for systems of unprecedented size and complexity. Our method is validated on
the paradigmatic examples of bulk silicon and aluminum, for which both
experimental and theoretical results already exist in the literature.
