  In this work we introduce a memory-efficient method for computing the action
of a Hermitian matrix function on a vector. Our method consists of a rational
Lanczos algorithm combined with a basis compression procedure based on rational
Krylov subspaces that only involve small matrices. The cost of the compression
procedure is negligible with respect to the cost of the Lanczos algorithm. This
enables us to avoid storing the whole Krylov basis, leading to substantial
reductions in memory requirements. This method is particularly effective when
the rational Lanczos algorithm needs a significant number of iterations to
converge and each iteration involves a low computational effort. This scenario
often occurs when polynomial Lanczos, as well as extended and shift-and-invert
Lanczos are employed. Theoretical results prove that, for a wide variety of
functions, the proposed algorithm differs from rational Lanczos by an error
term that is usually negligible. The algorithm is compared with other
low-memory Krylov methods from the literature on a variety of test problems,
showing competitive performance.
