Repository navigation
Add tgsen! (ordschur!) and tgevc! (eigenvectors from Schur form) - #54
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.
This is the second functionality we were missing in Quantica.jl, following up on #53. After the generalized Schur decomposition of a complex pencil, we reorder it (
ordschur!) and then extract eigenvectors directly from the Schur form. This PR adds workspaces for both steps, for complex matrices:GeneralizedOrdSchurWsforLAPACK.tgsen!, andGeneralizedEigenvectorsWsfortgevc!. It is independent of #53, and the two merge cleanly in either order.The main thing to focus on is
tgevc!. Unliketgsen!,LinearAlgebra.LAPACKhas notgevc!, so this defines a new functionFastLapackInterface.tgevc!, which I did not export. Happy to change the name, export it, or split it into a separate PR if you prefer.I've done my best to follow the style and conventions in the rest of the package. If you feel you'd like tweaks just let me know.
I've again used Claude Code to help me, but I've thoroughly reviewed any change it proposed.
Changes
GeneralizedOrdSchurWs+LAPACK.tgsen!(ws, select, S, T, Q, Z)(ztgsen/ctgsen). Same arguments and return value asLinearAlgebra.LAPACK.tgsen!(select, S, T, Q, Z), just with the workspace first. It's the non-allocating version ofordschur!for aGeneralizedSchur. Condition numbers are not computed (ijob = 0), as in LinearAlgebra.GeneralizedEigenvectorsWs+FastLapackInterface.tgevc!(ws, side, howmny, select, S, P, VL, VR)(ztgevc/ctgevc). Returns(VL, VR, m).VL/VRare not resized, so they can be views.Workspace(lapack_function, A)constructor, adecompose!method, docstrings with doctests, and entries indocs/src.Tests
test/schur_test.jlgets a"Complex, square"testset for each workspace (ComplexF64andComplexF32).tgsen!is compared againstLAPACK.tgsen!. Fortgevc!we check eigenvector residuals against the original pencil,howmny = 'S'into a view, and theWorkspace/factorize!path, plus resizing /WorkspaceSizeErrorfor both. The full suite passes locally on Julia 1.10 and 1.13.