Repository navigation
BUG: Support std::complex in Matrix and VariableSizeMatrix GetInverse - #7060
Open
hjmjohnson wants to merge 1 commit into
Open
hjmjohnson wants to merge 1 commit into
hjmjohnson wants to merge 1 commit into
Conversation
This was referenced Oct 31, 2026
hjmjohnson
marked this pull request as ready for review
October 31, 2026 23:10
Contributor
[Medium impact] The PR appears safe to merge; both previous findings are addressed.
|
hjmjohnson
force-pushed
the
bug-7058-complex-getinverse
branch
2 times, most recently
from
October 31, 2026 23:26
183b7de to
d296c4f
Compare
itk::Matrix and itk::VariableSizeMatrix GetInverse called itk::bridge::Math::SVD, which applies operator< to the element type, so instantiating either for std::complex failed to compile. Python wrapping instantiates every member, which exposed it. Add itk::bridge::Math::PseudoInverse. Real types keep the existing SVD path. Complex types use Eigen's BDCSVD with the same rcond rule. No public signature changes. Add GoogleTests for both classes and the bridge function, with analytic expected values. Issue: InsightSoftwareConsortium#7058
hjmjohnson
force-pushed
the
bug-7058-complex-getinverse
branch
from
October 31, 2026 23:36
d296c4f to
56dec0d
Compare
Member
Author
|
@greptileai review |
hjmjohnson
added a commit
to hjmjohnson/ITK
that referenced
this pull request
Nov 1, 2026
hjmjohnson
added a commit
to hjmjohnson/ITK
that referenced
this pull request
Nov 1, 2026
hjmjohnson
added a commit
to hjmjohnson/ITK
that referenced
this pull request
Nov 2, 2026
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.
Make
GetInverseofitk::Matrixanditk::VariableSizeMatrixcompile forstd::complexthrough a complex-awareitk::bridge::Math::PseudoInverse. Fixes #7058; see also #7061.Root cause and change
Both
GetInversemethods calleditk::bridge::Math::SVD, which is real-only (it applies<to the element type).fc7ab6bb550anda2c58cc9bc4introduced that path onmainonly, in no release tag. SWIG instantiates every member, so wrapping IsotropicWavelets failed on three wrapper files.PseudoInversedispatches withif constexpr: real types keep the existing SVD path, complex types use an EigenBDCSVD(thin) with the same rcond rule, explicitly instantiated forfloatanddoubleinlibITKCommonlike the real engines. No public signature changes.Verification
itkBridgeMathSVDGTest.cxx(known matrix, Penrose conditions, 20x20 full rank on the BDCSVD path, 20x20 rank-1 with the analytic result, real parity), plusMatrix.GetInverseOfComplexMatrixandVariableSizeMatrix.GetInverseOfComplexMatrix. Expected values are analytic (inverse of [[1,i],[0,1]] is [[1,-i],[0,1]]).GetInverseprogram fails against the old headers and builds against the new ones.pre-commit run --all-filespasses.AI assistance