Skip to content

Basic eig(h) forward rules#245

Merged
kshyatt merged 10 commits into
mainfrom
ksh/eig_fwd
Jun 11, 2026
Merged

Basic eig(h) forward rules#245
kshyatt merged 10 commits into
mainfrom
ksh/eig_fwd

Conversation

@kshyatt

@kshyatt kshyatt commented Jun 5, 2026

Copy link
Copy Markdown
Member

This doesn't yet handle the trunc cases at all, if anyone wants to take a swing please do feel free. I also had to turn off the forward mode test for complex numbers as there's a freedom in V that's hard to account for (see https://github.com/Jutho/KrylovKit.jl/blob/master/test/ad/eigsolve.jl).

@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

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

@kshyatt

kshyatt commented Jun 5, 2026

Copy link
Copy Markdown
Member Author

CUDA + Mooncake here probably needs #244

@codecov

codecov Bot commented Jun 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 67.18750% with 21 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ixAlgebraKitEnzymeExt/MatrixAlgebraKitEnzymeExt.jl 0.00% 21 Missing ⚠️
Files with missing lines Coverage Δ
...gebraKitMooncakeExt/MatrixAlgebraKitMooncakeExt.jl 67.07% <100.00%> (+1.01%) ⬆️
src/MatrixAlgebraKit.jl 100.00% <ø> (ø)
src/pushforwards/eig.jl 100.00% <100.00%> (ø)
src/pushforwards/eigh.jl 100.00% <100.00%> (ø)
...ixAlgebraKitEnzymeExt/MatrixAlgebraKitEnzymeExt.jl 0.00% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kshyatt

kshyatt commented Jun 8, 2026

Copy link
Copy Markdown
Member Author

This is getting hit with the eig related instability 😭

@kshyatt kshyatt requested review from Jutho and lkdvos June 8, 2026 12:46

@lkdvos lkdvos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Overall looks good! would you like me to add some optimization comments, or prefer me not to?

Comment thread ext/MatrixAlgebraKitEnzymeExt/MatrixAlgebraKitEnzymeExt.jl Outdated
@kshyatt

kshyatt commented Jun 8, 2026 via email

Copy link
Copy Markdown
Member Author

@lkdvos lkdvos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As a small question: do you know if the pushforwards are supposed to accumulate the results into the provided destinations, or simply writing them into it is enough?

I also noticed some slight inconsistencies in the variable names between the two pushforwards, it might be nice to make both somewhat follow the same scheme?

Comment thread src/pushforwards/eig.jl Outdated
Comment thread src/pushforwards/eig.jl Outdated
Comment thread src/pushforwards/eigh.jl Outdated
Comment thread src/pushforwards/eigh.jl Outdated
Comment thread src/pushforwards/eigh.jl Outdated
Comment thread src/pushforwards/eigh.jl Outdated
kshyatt and others added 2 commits June 10, 2026 09:39
Co-authored-by: Lukas Devos <ldevos98@gmail.com>

@lkdvos lkdvos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Left some more nitpicky things :)

Comment thread src/pushforwards/eig.jl Outdated
Comment thread src/pushforwards/eig.jl Outdated
Comment thread src/pushforwards/eigh.jl Outdated
Comment thread src/pushforwards/eigh.jl Outdated
kshyatt and others added 2 commits June 10, 2026 18:37
Co-authored-by: Lukas Devos <ldevos98@gmail.com>
Comment thread src/pushforwards/eigh.jl Outdated
Co-authored-by: Lukas Devos <ldevos98@gmail.com>
@kshyatt kshyatt enabled auto-merge (squash) June 10, 2026 17:35
Comment thread src/pushforwards/eig.jl Outdated
D, V = DV
ΔD, ΔV = ΔDV
iVΔAV = inv(V) * ΔA * V
ΔAV = mul!(ΔV, ΔA, V) # reusing ΔV memory

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ah yes this just doesn't work if ΔV is nothing as in eig_vals

@kshyatt kshyatt merged commit dd816f7 into main Jun 11, 2026
35 of 36 checks passed
@kshyatt kshyatt deleted the ksh/eig_fwd branch June 11, 2026 05:53
@Jutho

Jutho commented Jun 11, 2026

Copy link
Copy Markdown
Member

Oh I still wanted to go over this PR after Lukas was ready with his review.

@kshyatt

kshyatt commented Jun 11, 2026

Copy link
Copy Markdown
Member Author

Oh no, sorry! Perhaps leave comments and I can make a followup PR?

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