Skip to content

Conversation

@kshyatt
Copy link
Member

@kshyatt kshyatt commented Dec 16, 2025

Very similar reasoning as #116 . Have added AD rules for the new functions and hopefully covered them in tests.

@kshyatt kshyatt requested a review from Jutho December 16, 2025 09:00
@github-actions
Copy link

github-actions bot commented Dec 16, 2025

Your PR no longer requires formatting changes. Thank you for your contribution!

Comment on lines +67 to +70
s = 1 - sqrt(eps(real(T)))
trunc = truncerror(; atol = s * norm(@view(D₀[r:end]), 1), p = 1)
D4, V4 = @constinferred eig_trunc_no_error(A; alg, trunc)
@test length(diagview(D4)) == r
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit confused by this logic. You want an error that is slightly smaller than the norm of D₀[r:end], which means D₀[r] still needs to be kept. I would find it more intuitive to say that you want a truncation error that is allowed to be slightly bigger than D₀[r+1:end]. But maybe that is just me 🙂 .

Copy link
Member

@Jutho Jutho Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically, my reasoning would be: I want D₀[r+1:end] to be truncated, so I admit an error atol = norm(D₀[r+1:end]). But then I multiply this with a factor slightly bigger than 1 to account for finite precision errors.

That seems one less mental step than saying, I want an error that is slightly smaller than norm(D₀[r:end]), so actually, I do still want to keep D₀[r] and only start to truncate from r+1 onwards.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I see what you mean. But I suppose this is the "already existing" test so maybe we should open an issue about this to deal with it separately?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, now that I get the logic, it is also fine with me as is. Not sure why I didn't stumble on this before.

@codecov
Copy link

codecov bot commented Dec 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
...gebraKitMooncakeExt/MatrixAlgebraKitMooncakeExt.jl 99.12% <100.00%> (+0.06%) ⬆️
src/MatrixAlgebraKit.jl 100.00% <ø> (ø)
src/implementations/eig.jl 99.11% <100.00%> (+0.03%) ⬆️
src/implementations/eigh.jl 94.44% <100.00%> (+0.15%) ⬆️
src/interface/eig.jl 85.71% <100.00%> (ø)
src/interface/eigh.jl 80.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kshyatt kshyatt merged commit 9da39a2 into main Dec 16, 2025
10 checks passed
@kshyatt kshyatt deleted the ksh/eigs_trunc branch December 16, 2025 12:48
@lkdvos lkdvos mentioned this pull request Dec 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants