refac(sparse): rename CSRPayload to CSRExpression - #943
Conversation
"Payload" said data is carried, not what it is. The class holds an affine expression A @ x + c in CSR form, so name it CSRExpression, mirroring CSRConstraint. LinearExpression._payload becomes _csr, and _from_payload / CSRConstraint.from_payload become _from_csr / from_csr.
Merging this PR will regress 1 benchmark
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ❌ | test_to_lp[storage-n=250] |
30.8 MB | 37.5 MB | -17.8% |
| ⚡ | test_to_lp[masked-n=100] |
2.7 MB | 2.2 MB | +26.84% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing refac/rename-payload-etc (9c9550e) with master (dc861fe)
Footnotes
-
181 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
Build cost — v1 vs legacyv1 build peak & time relative to legacy, on this commit — not a comparison against master (that is CodSpeed).
Full table (time + peak, mean)📊 Interactive plots + CSV: download the semantics-report-v1-vs-legacy artifact from this run. Report-only · not a gate · refreshed on every push · obsolete once legacy is dropped. |
Closes #930.
Note
The following content was generated by AI.
Changes proposed in this Pull Request
CSRPayloadis renamed toCSRExpression. "Payload" only said that data iscarried, not what it is; the class holds an affine expression
A @ x + cin CSRform, so the new name states that, and it mirrors the existing
CSRConstraintin
constraints.py. The two-layer story is now explicit in the names: aCSRExpressiongets a sign and an rhs stapled on to become aCSRConstraint.The rename carries through to the members that referred to the old name:
LinearExpression._payload→LinearExpression._csrBaseExpression._from_payload→BaseExpression._from_csrCSRConstraint.from_payload→CSRConstraint.from_csrLocal names and docstrings were adjusted where the mechanical rename would have
read badly. In
constraints.pythe parameter formerly calledpayloadis nowexpr, becausecsr.csr[active]is hard to read whileexpr.csr[active]isnot. Prose that said "the payload grid" now says "the expression grid".
Three unrelated uses of the word "payload" were deliberately left alone: the JWT
and HTTP payloads in
linopy/remote/oetc.py, and the cuOpt warm-start note indoc/gpu-acceleration.rstwith its matching string intest_optimization.py.Those mean transmitted data, not this class.
The branch also adds an
ntermproperty toCSRExpression, soLinearExpression.ntermcan be answered from the CSR backing withoutmaterializing the dense rectangle.
No public API changes:
CSRPayloadwas never exported fromlinopy/__init__.py,so no release note is included.
Verification
ruff check .andruff formatclean.mypy linopyreports only the 28 pre-existingxpressattribute errors insolvers.py, which this branch does not touch.pytest test/test_sparse_groupby.py: 76 passed, 74 skipped.remote-OETC tests, and reproduce identically without this change (a local
environment problem, not a regression).
Checklist
AGENTS.md).doc.doc/release_notes.rstof the upcoming release is included.