Repository navigation
feat: support Fortran order in COO.flatten - #964
Merged
Merged
Conversation
Signed-off-by: 李永祺 <[email protected]>
6 of 10 tasks
Contributor
Author
|
CI triage for this PR: the Numba/Finch/MLIR test matrix, examples, notebooks, experimental tests, docs, and
This branch changes only AI assistance was used to prepare this CI comparison; I checked the linked GitHub Actions and Codecov check results. |
hameerabbasi
approved these changes
Oct 7, 2026
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.
COO.flatten(order="F")currently raisesNotImplementedError, preventing column-major flattening of multidimensional sparse arrays. This adds the transpose-then-flatten implementation suggested in #603; for example,[[0, 1, 2], [3, 4, 5]]now becomes[0, 3, 1, 4, 2, 5].What type of PR is this? (check all applicable)
Related issues
Closes #603.
Checklist
Please explain your changes below.
For
order="F", reverse the COO axes before using the existing C-order reshape. This operates on sparse coordinates and data, preserves the fill value, and keeps the existing behavior for the default order,"C", andNone. Document the supported orders and add a column-major doctest. The change is limited toCOO.flatten;reshapeand GCXS order support are unchanged.Regression coverage includes multidimensional, singleton, scalar and empty shapes; zero, nonzero and NaN fill values; arrays with no stored entries; narrow coordinate dtype promotion; and alternating C/F calls with caching enabled. A three-entry array with a logical size of 10^12 checks the resulting coordinates and values while rejecting dense conversion.
Validation on Python 3.12.14, NumPy 2.5.3, Numba 0.67.0 and SciPy 1.18.1:
AI assistance was used for implementation, tests, and drafting. The validation above was executed locally against this patch.