Cache-Friendly, Low-Memory Lanczos Algorithm in Rust
lukefleed.xyz·4h·
Flag this post

The standard Lanczos method for computing matrix functions has a brutal memory requirement: storing an n×kn \times k basis matrix that grows with every iteration. For a 500.000500.000-variable problem needing 10001000 iterations, that’s roughly 4 GB just for the basis.

In this post, we will explore one of the most straightforward solutions to this problem: a two-pass variant of the Lanczos algorithm that only requires O(n)O(n) memory at the cost of doubling the number of matrix-vector products. The surprising part is that when implemented carefully, the two-pass version isn’t just memory-efficient—it can be faster for certain problems. We will dig into why.

Similar Posts

Loading similar posts...