Repository navigation
Model.store_cls construction seam, Store.to_sparse(reason) for mixed merges (#1045) - #1056
Merged
Merged
Conversation
…for mixed merges (#1045)
FabianHofmann
force-pushed
the
store/3-construction-seam
branch
from
October 23, 2026 09:12
3545b55 to
8add12a
Compare
FabianHofmann
marked this pull request as ready for review
October 23, 2026 09:12
Merging this PR will not alter performance
Comparing Footnotes
|
…sence Restores the peak memory of to_linexpr on dense models to master: no broadcast, no always-present const array, no absorb_absence pass.
… construction A constant op producing NaN (0*inf, 0/0, inf-inf) at a live cell raises ValueError on both stores instead of reading it as absence; sparse /0 emits no numpy warnings. _set_data absorbs absence so a dataset with terms under a NaN const or a vars assignment cannot revive a cell.
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.
Note
The following content was generated by AI.
Stacked on #1052 (step 2b); base switches to
masteronce #1052 is merged. Step 3 of #1019.Closes #1045.
Changes proposed in this Pull Request
Model.store_cls(DenseStoreorCSRStore) is the single construction seam.Variable.to_linexpr,groupby(...).sum()and@/dotbuild on it through the store classmethodsfrom_labels,from_grouperand the newfrom_matmul; the netcdf reader builds each linear expression through it, so a named expression of a sparse model reads back sparse unless it carries coordinates the sparse grid cannot hold, in which case it stays dense.Variable.to_linexprloses its private_denseparameter. Quadratic products,rollingandcumsumbuild the dense expression explicitly throughDenseStore.from_labels, without a notice.Store.to_sparse(reason)returnsCSRStore | Reason: a dense store with coordinates the grid cannot hold refuses withcoordinates the Grid cannot hold: <names>instead of dropping them. A mixed merge converts its dense operands through it and emits oneDense backing sparsified: merge with a sparse operandnotice underwarn_on_densify, only once the sparse merge succeeds; a refusal makes the whole merge dense with the named reason. A dense-only merge stays dense also in a sparse model.@on a dense operand with such coordinates now keeps them on the dense path instead of dropping them.DenseStore.from_grouperchanged dask laziness and aux-coordinate handling.to_linexprreturns the model's store class; netcdf round trip on both backends with and without a 2-D coordinate; matmul keeping a 2-D coordinate;Store.to_sparserefusal and notice.Checklist
AGENTS.md).doc.doc/release_notes.rstof the upcoming release is included.