Skip to content

Fix a bug in the eig pushfwd and enable more tests - #290

Merged
kshyatt merged 1 commit into
mainfrom
ksh/eig_fwd
Oct 1, 2026
Merged

kshyatt merged 1 commit into
mainfrom
ksh/eig_fwd

Conversation

@kshyatt

@kshyatt kshyatt commented Oct 1, 2026

Copy link
Copy Markdown
Member

The LAPACK general eigensolver forces the columns of V to have unit norm and my pushforward wasn't respecting this rule. Oops! Now the part of ΔV that would change the length of the tangent is removed, and we can enable a lot more tests :)

@kshyatt
kshyatt requested review from Jutho and lkdvos October 1, 2026 09:58
@kshyatt
kshyatt added this pull request to stack #291 October 1, 2026 10:14

@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.

hooray for more tests!

@kshyatt
kshyatt removed this pull request from stack #291 October 1, 2026 12:40
@kshyatt
kshyatt merged commit b02d71e into main Oct 1, 2026
44 of 47 checks passed
@kshyatt
kshyatt deleted the ksh/eig_fwd branch October 1, 2026 13:17
Comment thread src/pushforwards/eig.jl
Comment on lines 13 to 20
∂K .*= inv_safe.(transpose(diagview(D)) .- diagview(D), degeneracy_atol)
mul!(ΔV, V, ∂K)
ΔV .-= V .* real.(sum(conj.(V) .* ΔV; dims = 1))
if eltype(V) <: Complex # fix gauge for `gaugefix!` compatibility
_, I = findmax(abs, V; dims = 1)
infinitesimal_phases = imag.(ΔV[I] ./ V[I])
ΔV .-= im .* V .* infinitesimal_phases
end

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.

Suggested change
∂K .*= inv_safe.(transpose(diagview(D)) .- diagview(D), degeneracy_atol)
diagview(∂K) .-= real.(sum(conj.(V) .* ΔV; dims = 1))
if eltype(V) <: Complex # fix gauge for `gaugefix!` compatibility
_, I = findmax(abs, V; dims = 1)
diagview(∂K) .-= im .* imag.(ΔV[I] ./ V[I])
end
mul!(ΔV, V, ∂K)

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.

Github didn't want to turn this into a proper suggestion, but anyway.

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.

Probably because I was too quick on the draw and merged it already

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