Conversation
leburgel
force-pushed
the
lb/blocklanczos_restart_rsize
branch
from
September 30, 2026 18:30
35e4422 to
17acdcb
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #172 +/- ##
=======================================
Coverage 86.65% 86.65%
=======================================
Files 36 36
Lines 3918 3919 +1
=======================================
+ Hits 3395 3396 +1
Misses 523 523 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When looking into why my attempted warm-start of
BlockLanczosin #170 still required more applications than a cold start, I stumbled into some inconsistencies in the shrinking procedure compared to a regularLanczosrun.The BlockLanczos restart used the initial block size
bsto set how many vectors to keep and which rows ofUcouple to the residual. It should use the current residual block sizefact.R_size, which becomes smaller thanbswheneverblock_qr!drops vectors. This PR switches the shrink branch toR_size.The restarted factorization was already correct. The extra rows of
Udon't couple to the residual and don't change the kept subspace. Butkeepwas rounded down to a multiple ofbs. For example, withbs = 6andkrylovdim = 20, it stayed at 12, whereas Lanczos keeps 12 to 14 as vectors converge. With this change, a block that has shrunk toR_size = 1restarts the same way asLanczos. WhenR_size == bs, the first commit changes nothing; see the second commit below.The reproducer below starts from five exact eigenvectors plus a random vector, so
R_sizedrops to 1 after the first step:krylovdimLanczos(v)This matters most together with #170. Take a warm start from the output vectors of an earlier unconverged run at
krylovdim = 20: it needs 1173 matvecs with #170 alone and 749 with both PRs, compared with 886 for a cold start.Second commit: never keep fewer vectors than have converged.
Lanczoskeepsdiv(3 * krylovdim + 2 * converged, 5)vectors, which always satisfiesconverged <= keep < krylovdim. Rounding that down to a multiple ofR_sizecan take it belowconverged, and the restart then throws away Ritz vectors that had already converged. This needs a residual block that stays large while many vectors converge, which typically means degenerate eigenvalues, andkrylovdim - converged < 5(R_size - 1)/3. With the defaultkrylovdim = 100andR_size = 16, that only happens once more than 75 vectors have converged. In that case the restart now falls back to the unroundedLanczosvalue. Otherwise nothing changes, and the reproducer above gives identical numbers.Without the second commit, restart 111 has
converged = 28withR_size = 12, which giveskeep = 24, and the next restart counts only 24 converged.