ENH: Deprecate the vnl_svd family for the Eigen-backed itk::Math::SVD#6564
ENH: Deprecate the vnl_svd family for the Eigen-backed itk::Math::SVD#6564hjmjohnson wants to merge 4 commits into
Conversation
|
Scope update (superseded): the |
6707e4c to
76036f9
Compare
76036f9 to
619512b
Compare
619512b to
520c2f2
Compare
|
| Filename | Overview |
|---|---|
| Modules/Core/Common/include/itkMathSVD.h | Extends Eigen-backed SVD result helpers, fixed rectangular overloads, and explicit instantiation declarations. |
| Modules/Core/Common/src/itkMathSVD.cxx | Adds explicit SVD template instantiation definitions to reduce consumer compile cost. |
| Modules/Core/Common/include/itkMatrix.h | Migrates GetInverse to Math::SVD while keeping guarded transitional VNL includes. |
| Modules/Core/Transform/include/itkTransform.hxx | Migrates inverse Jacobian pseudo-inverse computation to Math::SVD with square and rectangular handling. |
| Modules/Filtering/DiffusionTensorImage/include/itkDiffusionTensor3DReconstructionImageFilter.hxx | Migrates pseudo-inverse to Math::SVD but leaves an unguarded deprecated vnl_svd include that breaks ITK_FUTURE_LEGACY_REMOVE builds. |
| Modules/Registration/Common/test/RegistrationITKv3/ImageRegistration9.cxx | Migrates SVD usage but leaves a stale unguarded vnl_svd include that breaks future legacy removal builds. |
| Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/CMakeLists.txt | Build-gates deprecated VNL SVD and matrix-inverse sources and filters template instantiations under ITK_FUTURE_LEGACY_REMOVE. |
| Modules/ThirdParty/VNL/src/vxl/v3p/netlib/CMakeLists.txt | Gates LINPACK svdc sources out of future-legacy builds after deprecating their remaining consumers. |
| Modules/IO/NIFTI/src/itkNiftiImageIO.cxx | Migrates affine-condition and inverse calculations from VNL inverse to Math::SVD. |
| Modules/Numerics/Statistics/include/itkGaussianMembershipFunction.hxx | Uses Math::SVD for covariance pseudo-inverse while preserving signed determinant validation. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Consumers needing SVD or inverse] --> B[itk::Math::SVD]
B --> C{Matrix shape}
C -->|fixed square| D[SquareSVDEigen / JacobiSVD]
C -->|runtime square| E[DynamicSquareSVDEigen]
C -->|rectangular| F[RectangularSVDEigen / thin U,V]
D --> G[PseudoInverse / Solve / Rank / Recompose]
E --> G
F --> G
H[vnl_svd family headers] --> I{ITK_FUTURE_LEGACY_REMOVE}
I -->|true| J[#error / sources gated out]
I -->|false| K[deprecated transitional availability]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[Consumers needing SVD or inverse] --> B[itk::Math::SVD]
B --> C{Matrix shape}
C -->|fixed square| D[SquareSVDEigen / JacobiSVD]
C -->|runtime square| E[DynamicSquareSVDEigen]
C -->|rectangular| F[RectangularSVDEigen / thin U,V]
D --> G[PseudoInverse / Solve / Rank / Recompose]
E --> G
F --> G
H[vnl_svd family headers] --> I{ITK_FUTURE_LEGACY_REMOVE}
I -->|true| J[#error / sources gated out]
I -->|false| K[deprecated transitional availability]
Reviews (1): Last reviewed commit: "ENH: Deprecate the vnl_svd family and bu..." | Re-trigger Greptile
Extend the Eigen-backed itk::Math::SVD helpers so every vnl_svd / vnl_matrix_inverse call site in ITK has a direct replacement: pseudo-inverse, solve, rank, recompose, null vector, and the WellCondition and DeterminantMagnitude predicates. Route the eigenvector sign convention through itkEigenDecompositionSignConvention so results are backend-stable.
Exercise the extended itk::Math::SVD surface (pseudo-inverse, solve, rank, WellCondition, DeterminantMagnitude) and cross-check it against the vnl_svd result on well- and ill-conditioned inputs.
…h::SVD Replace direct vnl_svd, vnl_svd_fixed and vnl_matrix_inverse use across the transforms, diffusion-tensor reconstruction, image moments, label-map filters, membership functions, Mahalanobis metrics, the Quasi-Newton optimizer, NIfTI and MINC IO and the classifier estimators with the Eigen-backed itk::Math::SVD API, including itk::Matrix::GetInverse. Where a widely included header (itkTransform, itkMatrix, the affine transforms) previously pulled a vnl_svd* header transitively, keep that include reachable under #if !defined(ITK_LEGACY_REMOVE) && !defined(ITK_FUTURE_LEGACY_REMOVE) so downstream code that relied on the transitive include still compiles during the deprecation window.
Add the three-state deprecation guard to vnl_svd, vnl_svd_fixed, vnl_svd_economy, vnl_matrix_inverse and vnl_solve_qp, pointing callers at the Eigen-backed itk::Math::SVD: silent by default, a #warning under ITK_LEGACY_REMOVE and a hard #error under ITK_FUTURE_LEGACY_REMOVE. Build-gate the vnl_svd family and the LINPACK svdc netlib sources out of the ITK_FUTURE_LEGACY_REMOVE build so the dead engine no longer compiles once the APIs are gone, and move the vnl algo tests off the deprecated spellings.
520c2f2 to
7c01e6f
Compare
Deprecates the
vnl_svdfamily (vnl_svd,vnl_svd_fixed,vnl_svd_economy,vnl_matrix_inverse) in favor of the Eigen-backeditk::Math::SVD, migrates every in-tree consumer, and build-gates the LINPACKsvdcengine out ofITK_FUTURE_LEGACY_REMOVE. Theitk::Math::SolveSymmetric/InverseSymmetric(LDLT) work that previously lived here is split out to #6565 so the two review independently.Commit structure (4 thematic commits)
itk::Math::SVD— pseudo-inverse, solve, rank, recompose, null-vector,WellCondition,DeterminantMagnitude; eigenvector sign routed throughitkEigenDecompositionSignConventionfor backend-stable results.vnl_svdon well- and ill-conditioned inputs.itk::Matrix::GetInverse). Widely-included headers keep the transitivevnl_svd*include reachable under#if !defined(ITK_LEGACY_REMOVE) && !defined(ITK_FUTURE_LEGACY_REMOVE)so downstream code that relied on it still compiles during the deprecation window.vnl_svdfamily with the three-state guard (silent default /#warningunderITK_LEGACY_REMOVE/#errorunderITK_FUTURE_LEGACY_REMOVE) and build-gate the LINPACKsvdcsources.Downstream validation (forest)
Built against this branch's tip in the ITK downstream forest: ITK, ANTs, BRAINSTools, c3d, SimpleITK all compile clean. The one real regression found — ANTs
antsAffineInitializerrelying on a transitivevnl_svd_fixed.hviaitkTransform.hxx— is fixed by the guarded transitive includes in commit 3. No consumer hit anyvnl_svd/vnl_matrix_inverse/itk::Math::SVDcompile error. (c3d and SimpleITK additionally needed their own upstream ITK6-migration PRs, unrelated to this change.)