Uh oh!
There was an error while loading. Please reload this page.
Add custom eigensolver (Block Krylov-Schur algorithm) - #1383
Add custom eigensolver (Block Krylov-Schur algorithm)#1383Suhas Jayaram Subramanya (suhasjs) wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The solver can panic due to non-block-aligned convergence locking interacting with minimal ncv settings, and this needs to be fixed before merging.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adds a new diskann_linalg::block_krylov_schur module implementing a restarted Block Krylov–Schur eigensolver for real symmetric operators, including built-in row-major operator adapters (dense symmetric, AᵀA, and AAᵀ). This expands diskann-linalg with an efficient top-k eigenpair routine suitable for large operators exposed via matrix–vector products.
Changes:
- Expose a new
block_krylov_schurpublic module fromdiskann-linalg. - Add the Block Krylov–Schur solver implementation, operator traits/adapters, parameter/result/error types, and extensive tests.
- Provide progress reporting and a helper to compute an upper bound on operator applications.
File summaries
| File | Description |
|---|---|
diskann-linalg/src/lib.rs | Re-exports the new block_krylov_schur module. |
diskann-linalg/src/block_krylov_schur.rs | Implements the eigensolver, built-in operators, and associated tests. |
Review details
Suppressed comments (1)
diskann-linalg/src/block_krylov_schur.rs:891
- After introducing a separate
convergedcounter (so the internal locked prefix can remain block-aligned), the result should report the exact converged pair count rather than the internals.conv(which is block-aligned and may under-report).
eigenvectors: out,
status,
converged: s.conv,
iterations: s.iters,
block_operator_applications: s.apps,
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## main #1383 +/- ##
==========================================
- Coverage 91.55% 91.44% -0.11%
==========================================
Files 521 522 +1 Lines 100302 101743 +1441 ==========================================
+ Hits 91828 93036 +1208 - Misses 8474 8707 +233
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Reference Issues/PRs
Multi-vector indexing support -- #1019
N/A
What does this implement/fix? Briefly explain your changes.
Implements a new custom eigensolver to compute top-k (eigenvalue, eigenvector) pairs (ordered desc by magnitude of eigenvalue). This solver is a
faer-based Rust port of the Block Krylov-Schur algorithm implemented in microsoft/ISLE. Restarted Block Krylov-Schur only needs access to a matrix-vector dot-product operator and can be orders of magnitude more efficient than simply calling ARPACK/LAPACK'sgesvdfor large sparse matrices.On benchmarks with real multi-vectors, this algorithm was an order of magnitude quicker than
faer'scompute_evd_realprimarily because it allows us to configure the 'convergence' threshold and does not require computing all (eigenvalue,eigenvector) pairs (early-exits if top-wantedpairs have converged).Changes are restricted to
diskann-linalgcrate. The new eigensolver is available underdiskann_linalg::block_krylov_schurmodule.Highlights:
SymmetricOperator: a trait to supply the matrix-vector product throughSymmetricOperator::apply. This PR provides three symmetric operator implementations for (a) anyf32matrix A of shape N x N, (b)AA^Tfor af32matrix with shapeM x N, and (c)A^T Afor shapeN x M.BlockKrylovSchurParamsholds inputs to the algorithm,BlockKrylovSchurResultthe outputs, andBlockKrylovSchurErroris crate-supplied error typeSolver<Operator>struct to manage state for algorithm, andblock_krylov_schur_eigenpairs_with_progressfunction to automatically create aSolverusing aSymmetricOperatorandBlockKrylovSchurParams, and extract out topwanted(eigenvalue, eigenvector) pairs into aBlockKrylovSchurResult(or propagateBlockKrylovSchurErrorif necessary).faereigenvalue decomposition), along with input validation errors and known algorithm failure modes.Any other comments?