ENH: Add itk::Math LDLT symmetric solve/inverse and vnl_cholesky engine GTest#6565
Open
hjmjohnson wants to merge 3 commits into
Open
ENH: Add itk::Math LDLT symmetric solve/inverse and vnl_cholesky engine GTest#6565hjmjohnson wants to merge 3 commits into
hjmjohnson wants to merge 3 commits into
Conversation
Contributor
adbab66 to
4edeea4
Compare
Add itk::Math::SolveSymmetric and itk::Math::InverseSymmetric for symmetric (indefinite) linear systems and symmetric-matrix inversion, backed by Eigen's LDLT (Bunch-Kaufman) factorization. Overloads accept itk::Array2D/itk::Array and map the contiguous block through Eigen::Map with no copy; a matrix-RHS overload solves A X = B with a single factorization. ITK_MATH_HAS_SOLVE_SYMMETRIC advertises the capability so consumers can feature-test the header. itkMathLDLTGTest checks SPD and indefinite systems, the matrix-RHS solve and the symmetric inverse against a vnl reference.
4edeea4 to
29277be
Compare
Adapt vxl core/vnl/algo/tests/test_cholesky.cxx into an ITK GoogleTest so the coverage runs in ITK CI and guards the native Cholesky engine that replaced the netlib LINPACK path (98f7498). Beyond the scavenged cases (inverse vs direct inverse, two-sided identity in both modes, known-solution solve), adds determinant, triangular-factor, rank-deficiency/rcond, and an equivalence check against the Eigen-backed itk::Math::SolveSymmetricPositiveDefinite. The suite defines ITK_LEGACY_TEST and compiles out under ITK_FUTURE_LEGACY_REMOVE, matching the vnl_cholesky deprecation guard. Follows the itkVnlSVDEngineGTest precedent (PR InsightSoftwareConsortium#6546). Tracking: InsightSoftwareConsortium#6403.
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.
Adds
itk::Math::SolveSymmetricanditk::Math::InverseSymmetric, backed by Eigen's LDLT (Bunch-Kaufman) factorization, for symmetric (indefinite) linear systems and symmetric-matrix inversion. Also scavenges vxltest_cholesky.cxxintoitkVnlCholeskyEngineGTestso the native Cholesky engine (98f7498) is covered in ITK CI, following theitkVnlSVDEngineGTestprecedent (#6546). Split out of #6564.API and rationale
SolveSymmetric(A, b)solvesA x = bfor symmetricA; a matrix-RHS overload solvesA X = Bwith a single factorization.InverseSymmetric(A)returns the symmetric inverse; it throws for singular input (LDLT pivot-diagonal check) rather than silently returning a pseudo-inverse.itk::Array2D/itk::Arrayand map the contiguous block throughEigen::Mapwith no copy.ITK_MATH_HAS_SOLVE_SYMMETRIClets consumers feature-test the header (#if __has_include(<itkMathLDLT.h>)).Test coverage and legacy-state behavior
itkMathLDLTGTest: SPD and indefinite systems, matrix-RHS solve, symmetric inverse, singular-input rejection, vnl-oracle cross-checks (float and double).itkVnlCholeskyEngineGTest(scavenged from vxltest_cholesky.cxx): inverse vs direct inverse, two-sided identity in default andestimate_conditionmodes, known-solution solve, determinant vs analytic, triangular-factor reconstruction, rank-deficiency/rcond, equivalence vsitk::Math::SolveSymmetricPositiveDefinite.ITK_LEGACY_TESTfor their vnl oracles and compile those out underITK_FUTURE_LEGACY_REMOVE, matching the vnl_cholesky deprecation guard already on main.ITK_LEGACY_REMOVE20/20 (0 deprecation warnings),ITK_FUTURE_LEGACY_REMOVE12/12 (deprecated-engine suites compiled out).