Repository navigation
Add complex gges! - #53
Open
pablosanjose wants to merge 1 commit into
Open
pablosanjose wants to merge 1 commit into
pablosanjose wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Great package, we've used it in Quantica.jl to save a ton of allocations. There are a couple of functionalities we were missing, however. The first is generalized Schur decomposition of complex pencils. This PR adds complex support (
zgges/cgges) toGeneralizedSchurWsandLAPACK.gges!(ws, ...). (The second functionality we need in Quantica will come in a subsequent PR).The main thing to focus on is that
GeneralizedSchurWs{T, RT}has now two parameters (in line with other complex workspaces in the package likeGeneralizedEigenWs{T, MT, RT}).Tis the eltype (that can now be complex), andRTis alwaysreal(T).I've used Claude Code to help me, but I've thoroughly reviewed any change it proposed.
Changes
ggesloop now runs over(gges, elty, relty)for all four element types, followingggevineigen.jl. Acmplxbranch selects the complexccall. The real code path is unchanged apart from indentation.αrinGeneralizedSchurWs{T,RT}holds α andαi::Vector{RT}serves as the realrwork(length 8n), as inGeneralizedEigenWs.GeneralizedSchurWs{Float64}remains valid in annotations and dispatch of course. The only visible change for real matrices is the printed type, so the doctest was updated.selectis not supported for complex matrices yet (the callback signature differs), and passing it throws anArgumentErrorif the matrices are complex.gges!returns(A, B, ws.αr, ws.β, ws.vsl, ws.vsr)and allocates nothing after warm-up.Tests
A
"Complex, square"testset inGeneralizedSchurWs(ComplexF64andComplexF32) compares the results againstLAPACK.gges!. It also covers theWorkspace/factorize!path, theselecterror, and resizing /WorkspaceSizeError. The full suite passes locally on Julia 1.10 and 1.13.