Repository navigation
Conversation
factor, factor! and refactor! take the keywords order, scaling, pivot_tolerance and zero_tolerance, and so do the LinearAlgebra spellings (lu/cholesky/qr/ldlt on AASparseMatrix, lu!/cholesky!/ldlt!). The options are stored on the AAFactorization once libSparse has applied them, so later calls reuse them. The defaults are libSparse's, as before. libSparse's in-place refactorization ignores the numeric options it is given and keeps those of the original factorization (a zero tolerance of 1e3 changes nothing). When the numeric options change, refactor! therefore computes a new numeric factorization from the existing symbolic one, through the public SparseFactor(SparseOpaqueSymbolicFactorization, SparseMatrix, SparseNumericFactorOptions) entry point, which this wraps. Options are validated: pivot_tolerance must be in [0, 0.5] (libSparse clamps it silently), zero_tolerance nonnegative. factor! on a computed factorization does nothing, so options passed to it throw; refactor! rejects order and SparseScalingHungarianScalingAndOrdering, which belong to the symbolic factorization. Assisted-by: Claude Code:claude-opus-5-5
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #231 +/- ##
==========================================
+ Coverage 91.73% 91.79% +0.05%
==========================================
Files 11 11
Lines 4697 4727 +30
==========================================
+ Hits 4309 4339 +30
Misses 388 388 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…options With a zero tolerance above every pivot, libSparse reports a different number of zero pivots on macOS 15 on Intel (60 for a 30x30 matrix, and (1, 18, 1) for a complex one) than on Apple silicon (all of them), so the tests check that there are zero pivots rather than how many. Also test that a refactorization with new options that fails throws and leaves the factorization as it was. Assisted-by: Claude Code:claude-opus-5-5
klamike
force-pushed
the
sparse-symmetric-inplace
branch
3 times, most recently
from
November 14, 2026 22:14
b25980f to
3bdb34b
Compare
refactor!refactor! through nonzeros and refactor!(f)
The workspace variants of SparseSolve are wrapped since JuliaLinearAlgebra#199, with a caller-owned buffer (solve_workspace_size). Assisted-by: Claude Code:claude-opus-5-5
klamike
force-pushed
the
sparse-symmetric-inplace
branch
from
November 15, 2026 20:58
3bdb34b to
86c824c
Compare
Assisted-by: Claude Code:claude-opus-5-5
factor, factor! and refactor! take check::Bool = true, as LinearAlgebra's factorizations do, and so do the LinearAlgebra spellings. With check = false, a failed numeric factorization is kept instead of thrown, issuccess(f) reports the outcome, and refactor! reuses its symbolic factorization once the values change. Solving with a failed factorization, or calling factor! on it with check = true, throws. Argument errors (including libSparse's parameter errors) throw regardless of check. Only Cholesky, unpivoted LDLT and QR detect failure; the pivoting LDLT and LU factorizations succeed on singular matrices, as documented. refactor! also used to throw on a failed refactorization while keeping the previous Ok status, although libSparse had already overwritten the numeric factors, so a caller that caught the error could solve with garbage; it now stores the failed status. lu!/cholesky!/ldlt! check the kind of a failed factorization too. Assisted-by: Claude Code:claude-opus-5-5
After a failed numeric factorization, libSparse's record of the numeric options is not valid (numeric_options read garbage), and an in-place refactorization does not restore it, although that refactorization uses the recorded options. refactor! now refactorizes in place only from a successful factorization; recovering from a failed one computes a new numeric factorization from the symbolic one, with the stored options. Also: - Drop the parameter-error branch after SparseFactor(symbolic, ...): libSparse reports parameter errors through the reportError callback, which throws, so it could not be reached. - Don't @ref LinearAlgebra.issuccess from docstrings: it is not in the manual, which failed the documentation build. Assisted-by: Claude Code:claude-opus-5-5
Assisted-by: Claude Code:claude-opus-5-5
Assisted-by: Claude Code:claude-opus-5-5
nonzeros(A::AASparseMatrix) returns the matrix's own value storage, and refactor!(f) without a matrix refactorizes from the current values of the matrix f holds. Assisted-by: Claude Code:claude-opus-5-5
klamike
force-pushed
the
sparse-symmetric-inplace
branch
from
November 15, 2026 21:19
86c824c to
a483aa8
Compare
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.
Stacked on #230 (
check = false), which is stacked on #228 (factorization options); merge them in that order. Until then, this PR's diff includes both. This PR's own change is the last commit.The one-triangle
Symmetric/Hermitianconstructor that was part of this PR is now its own PR, #232.nonzeros(A::AASparseMatrix)returns the matrix's own value storage, which can be updated in place. For a symmetric matrix stored as one triangle, the values are those of that triangle, in the order ofnonzeros(tril(S))(ortriu).refactor!(f), without a matrix, refactorizes from the current values of the matrixfholds: the one it was built from, or the last one passed torefactor!. It takes the same options asrefactor!(f, A).Tests
The new tests cover:
Symmetric/Hermitian, no structure detection inAASparseMatrix#232) and unsymmetric matrices, and thattranspose(A)shares them;refactor!(f), through LDLᵀ and LU, with options, and afterrefactor!(f, B);