ENH: Return rank 0 for empty matrices in matrix_rank by false200 · Pull Request #30422 · numpy/numpy

added 3 commits

December 12, 2025 01:46

@false200

Fix trailing whitespace causing lint failure and simplify the empty-matrix
rank assertion.

seberg

@false200

@false200

@false200

@false200

@false200

Added a newline at end of file to satisfy linter.
Ensures exactly one blank line at the end of numpy/linalg/tests/test_linalg.py

@seberg seberg changed the title BUG: Return rank 0 for empty matrices in matrix_rank ENH: Return rank 0 for empty matrices in matrix_rank

Dec 19, 2025

charris pushed a commit to charris/numpy that referenced this pull request

Apr 10, 2026
This PR fixes a bug in np.linalg.matrix_rank where empty matrices
(previously with 0 rows or 0 columns) would raise a ValueError due to
attempting a reduction operation on a zero-size array.

charris added a commit that referenced this pull request

Apr 10, 2026
ENH: Return rank 0 for empty matrices in matrix_rank (#30422)