Repository navigation
Conversation
1a38822 to
ffa3c6a
Compare
Codecov Report❌ Patch coverage is
... and 6 files with indirect coverage changes 🚀 New features to boost your workflow:
|
| exceeds `cost_square` (forming G² and the new right-hand side): its spectrum [1 - γᵢ², 1] needs | ||
| about half the iterations. A column stops once its residual is below `atol` times the smallest | ||
| Ritz value of the slowest column, so that its error is below about `atol`. | ||
| """ |
There was a problem hiding this comment.
This is far from a "simple CG". It will take me quite some time to review it. I also don't particularly like the coding style, though I don't know to pinpoint that more precisely, or thus, what action could improve it 😄 . Maybe after I understand the code I will have some suggestions.
There was a problem hiding this comment.
This was more a placeholder for pointing out that CG is a good Stein solver for these specific cases. Other than requesting it to be "as close to the KrylovKit CG as possible", I didn't really check the actual implementation. I'm perfectly fine with replacing the entire solver, I just didn't have the expertise to write a good one myself.
36b10e5 to
965274f
Compare
Co-authored-by: Jutho <Jutho@users.noreply.github.com>
965274f to
d38116e
Compare
…) instead of degeneracy_atol Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
84a492e to
c9ffc28
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
For every kept column i,
svd_trunc_pullback!andeigh_trunc_pullback!solve (1 - wᵢ G) xᵢ = bᵢ with G Hermitian (SVD: G = P Pᴴ or Pᴴ P, whichever is smaller, and wᵢ = 1/σᵢ²; eigh: G = P and wᵢ = 1/λᵢ).mainsolves it by doubling, at O(n³) per squaring of G. This PR uses conjugate gradients on all columns at once, at O(n² k) per iteration for k kept columns, which pays off when k ≪ n (which is common in the context of CTMRG runs in PEPSKit.jl, which motivated this investigation).CG, batched over the columns.complement_rtoltimes the smallest Ritz value, so that its error is aboutcomplement_rtolrelative to its right-hand side.complement_rtol(defaulteps(T)^(3/4)) is a new keyword, as in Smith series tolerance of the truncated pullbacks scaling like ΔA #328, which fixes the same tolerance for doubling:mainstops atdegeneracy_atol, which is in the units of the singular values.maxiternow caps the conjugate-gradient iterations (default 10 times the dimension), with a warning if they do not converge.hermitian_stein_cg!, goes into a new filesrc/common/stein.jl, together withaccelerative_smith_iteration!, moved there unchanged (still used byeig_trunc_pullback!).Timed against main's solver (doubling, at main's tolerance) on the same equations, in one process with the calls interleaved, on 204 cases in real and complex arithmetic (script below,
BENCH_MINTOTAL=1), on a shared 80-thread workstation with 4 BLAS threads:degeneracy_atol, gave set medians within about 20% of these (2.43×, 3.16×, 1.67×, 1.65×, 0.93×, 0.89× in the order of the table).eig_trunc_pullback!keeps doubling. Its G = APᴴ is not Hermitian, so conjugate gradients do not apply, and for eigenvalues spread over a disk no Krylov method converges faster than the Neumann series itself.Benchmark script
Run with this branch developed; the numbers above used
BENCH_MINTOTAL=1(21 minutes).