Repository navigation
Check the matrix size in ldlt! and cholesky! of a CHOLMOD.Factor before refactorizing - #1122
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1122 +/- ##
=======================================
Coverage 94.73% 94.73%
=======================================
Files 16 16
Lines 10325 10330 +5
=======================================
+ Hits 9781 9786 +5
Misses 544 544 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…` before refactorizing `ldlt!(F, A)` converted an LLt factor to LDLt before CHOLMOD rejected a matrix of another size, so the failed call changed the kind of `F`. Both now throw a `DimensionMismatch` before touching the factor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ViralBShah
force-pushed
the
vs/cholmod-ldlt-validate-first
branch
from
October 26, 2026 14:58
0cbca18 to
be0757b
Compare
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.
ldlt!(F, A)on an LLtCHOLMOD.FactorconvertsFto a simplicial LDLt before CHOLMOD checks the size ofA, so a call with a matrix of the wrong size throws and still changes the kind ofF.Before
After
ldlt!callschange_factor!beforefactorize_p!, and only the latter reaches CHOLMOD's dimension check. A newcheck_refactor_sizecomparessize(A)withsize(F)under the factor's lock, before anything writes toF, in bothldlt!andcholesky!.cholesky!already leftFunchanged, and gets the check so that the two throw the same error. The eltype is already fixed by dispatch and the stype bycheck_hermitian_stype, and a non-square matrix fails that check, so size is the only precondition missing.Potential breakage: a size mismatch now throws
DimensionMismatchinstead ofCHOLMODException, from bothldlt!andcholesky!.🤖 Generated with Claude Code