Emit flat/to_polars directly from the CSR store
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 68/100
Direzione di ricerca
Start with LinearExpression.flat and to_polars in linopy/expressions.py, then read csr_to_term_arrays in linopy/csr.py and CSRConstraint.to_polars in linopy/constraints.py as the stated precedent. Trace Grid.indexer, strides, and indexes to assemble the coordinate columns. Done means CSR-backed expressions emit the compact canonical rows directly and flat shares that path without dense expansion.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
[!NOTE]
The following content was generated by AI.
Describe the feature you'd like to see
Emit flat and to_polars directly from the CSR store, without building the dense rectangle first. Child of #756.
LinearExpression.flat (linopy/expressions.py:2612) and to_polars (2693) both read self.data, expand to the padded coord_dims x _term rectangle, convert to a long frame and then mask the padding straight back out. For a CSR-backed expression that is a round trip through exactly the representation the long format is trying to reach.
This matters twice: it is the export boundary, and it is the natural way to inspect a sparse expression, so it currently doubles as a densification trap.
Implementation ideas
csr_to_term_arrays (linopy/csr.py:506-532) already produces the flat term arrays. The work is to assemble the coordinate columns from Grid (indexer, strides, indexes) and emit the polars frame directly, then have flat share that path.
CSRConstraint.to_polars (linopy/constraints.py:1271) is the existing precedent on the constraint side and should be the model for the expression side.
Note that a CSR-backed result is compact canonical form, so the emitted row count legitimately differs from the dense path where explicit zeros were pruned. See #925.
- Lingua principale
- Python
- Stelle
- 257
- Fork
- 87
- Merge medio
- 1g 8h
- PR unite (30g)
- 32
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di PyPSA/linopy
-
bug solver interface
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
-
performance sparse
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
-
documentation sparse
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
-
enhancement sparse
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
-
Make the sparse path observable and controllable (.is_sparse, densify warning, per-call sparse=) Apertaenhancement sparse
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
Tutte le issue di PyPSA/linopy
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
stephrobert/dsoxlab#238 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
sublimehq/package_control#1780 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
nwg-piotr/nwg-displays#145 ·