SciML / SciML/SparseWithDenseRowColMatrices.jl

QR `refactor!` rebuilds the bordered matrix every call (~114 KB) instead of updating values in place — fix the advertised hot path

Open
#7 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
0
Forks
1
Avg merge
14m
Merged PRs (30d)
6

Description

WHAT: The csr_refactor! kernel is allocation-free, but the refactor! wrapper (src/qr.jl:151-160) rebuilds the entire bordered matrix on every call. Measured breakdown (n=200, r=3): _augmented_matrix rebuild of [S Usp; Vsp negI] = 96,072 B, CSC→CSR conversion = 18,272 B, kernel = 0 B, total = 114,200 B/call. The refactor!(F, A) form measures ~320 KB/call in the infra audit. WHY IT MATTERS: This is the Newton/time-stepping hot path the package advertises as its throughput story; the docstring (src/qr.jl:147-149) already concedes it is 'not yet fully zero-allocation', and the README (line 82) overstates allocation-freeness for the refactor!(F, A) form a Newton loop naturally uses. FIX: Mirror the LU augmented path (src/augmented.jl:134-141): build the bordered CSC/CSR once at construction and store it; on refactor! overwrite only the nonzero value slices from the new S/U/V (the negI block and selector-U ones are constant; only S and V values change since the pattern is fixed for given (n,r) and S pattern), then call csr_refactor! on the same CSR buffer. Requires a value-only writer into the stored CSR. As part of the same change, qualify README line 82 to say allocation-freeness applies to the cheap refactor!(F, nzval) form, not refactor!(F, A). EFFORT: M.


Priority: high. Filed from an automated next-steps audit of the QR/lstsq work (see PR #6).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the refactor! wrapper in src/qr.jl:147-160 and compare the stored augmented path in src/augmented.jl:134-141. Keep the bordered CSC/CSR buffers across calls, update the changing value slices, and qualify README line 82 for the nzval form. Done means the stated n=200, r=3 hot-path allocation breakdown no longer includes rebuilding or conversion.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.