Skip to content

Initial package import#1

Merged
ChrisRackauckas merged 3 commits into
mainfrom
initial-package-import
May 29, 2026
Merged

Initial package import#1
ChrisRackauckas merged 3 commits into
mainfrom
initial-package-import

Conversation

@ChrisRackauckas-Claude
Copy link
Copy Markdown
Collaborator

Initial import of SparseWithDenseRowColMatrices.jl.

Please ignore until reviewed by @ChrisRackauckas — opened as a draft.

What it is

A square matrix A = S + U*V — a sparse bulk S plus a low-rank dense correction (dense rows and/or columns). Solved by Sherman–Morrison–Woodbury over a PureKLU.jl sparse LU, with an augmented bordered-system fallback when S is singular.

  • Factorizations: factorize/lu (Woodbury, auto-falls-back to augmented), \/ldiv!, adjoint/transpose.
  • Symbolic-reuse caching: refactor!/lu! (new S values, same pattern — Newton), and update_lowrank! (fixed S, changing low-rank correction — the SMW reuse case; ~785× faster than re-factoring the assembled matrix, which fills on the dense rows).
  • Detector: recommend_lowrank_peel(A) -> PeelRecommendation — cheap, pattern-only check of whether the method is worthwhile.
  • LinearSolve.jl extension: SparseWithDenseRowColFactorization() + defaultalg, mirroring KLUFactorization (symbolic cached in the LinearCache, reused across solves; singular A returns ReturnCode.Infeasible).
  • Generic eltypes: Float64/Complex, BigFloat, and ForwardDiff.Dual (autodiff through the solve), inherited from PureKLU.

Canonical use cases: bordered / saddle-point / KKT systems and BVP boundary-condition rows — sparse bulk + a low-rank dense border. (A pure single-spike arrowhead is better served by a specialized O(n) solver; documented.)

Verification

219 tests passing on Julia 1.10/1.11/1.12 (correctness vs dense references; allocations; generic eltypes; LinearSolve caching; arrow/bordered). Built with a multi-agent design + adversarial review pass.

Dependency caveat

Depends on the unregistered SciML/PureKLU.jl. Resolved via [sources] in Project.toml (Julia 1.11+) and a CI step that Pkg.develops it. The package cannot be registered in General until PureKLU is registered.

🤖 Generated with Claude Code

ChrisRackauckas and others added 3 commits May 29, 2026 16:22
SparseWithDenseRowColMatrices: a square matrix A = S + U*V (a sparse bulk S plus a
low-rank dense correction), solved by Sherman-Morrison-Woodbury over a PureKLU sparse LU,
with an augmented bordered-system fallback when S is singular. Provides symbolic-reuse
caching (factorize / refactor! / update_lowrank!), a cheap pattern-only appropriateness
detector (recommend_lowrank_peel), and a LinearSolve.jl extension mirroring KLUFactorization.

Tested against dense references on Julia 1.10/1.11/1.12 (219 tests).

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ChrisRackauckas ChrisRackauckas marked this pull request as ready for review May 29, 2026 20:28
@ChrisRackauckas ChrisRackauckas merged commit 76d1fbc into main May 29, 2026
5 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants