Skip to content

Fix logic error when computing rank deficient weak Popov forms with some options#41280

Merged
vbraun merged 2 commits intosagemath:developfrom
vneiger:fix_weakpopov_inc0vec_option
Dec 21, 2025
Merged

Fix logic error when computing rank deficient weak Popov forms with some options#41280
vbraun merged 2 commits intosagemath:developfrom
vneiger:fix_weakpopov_inc0vec_option

Conversation

@vneiger
Copy link
Copy Markdown
Contributor

@vneiger vneiger commented Dec 10, 2025

Fixes #41278

This concerns univariate polynomial matrices and the main interface for weak Popov forms (weak_popov_form) which mostly handles options (the main computation is deferred to _weak_popov_form which is unchanged by this PR).

In the rank deficient case, with some specific options (include_zero_vectors=False and ordered=True), the code contained some misplaced logic concerning zero rows that happened too late in the computations, leading to wrong results (see #41278).

This PR fixes this issue, adds a test for it, and also makes some minor enhancements in code style.

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

…bination of options include_zero_vectors=False and ordered=True
@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 10, 2025

Documentation preview for this PR (built with commit 531f057; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

Copy link
Copy Markdown
Member

@vincentmacri vincentmacri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you for the quick fix!

My only requested change is a small formatting fix, you can set this to positive review after making the change.

Comment thread src/sage/matrix/matrix_polynomial_dense.pyx Outdated
Co-authored-by: Vincent Macri <vincent.macri@ucalgary.ca>
vbraun pushed a commit to vbraun/sage that referenced this pull request Dec 20, 2025
sagemathgh-41280: Fix logic error when computing rank deficient weak Popov forms with some options
    
Fixes sagemath#41278

This concerns univariate polynomial matrices and the main interface for
weak Popov forms (`weak_popov_form`) which mostly handles options (the
main computation is deferred to `_weak_popov_form` which is unchanged by
this PR).

In the rank deficient case, with some specific options
(`include_zero_vectors=False` and `ordered=True`), the code contained
some misplaced logic concerning zero rows that happened too late in the
computations, leading to wrong results (see
[sagemath#41278](sagemath#41278)).

This PR fixes this issue, adds a test for it, and also makes some minor
enhancements in code style.

### 📝 Checklist

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.
    
URL: sagemath#41280
Reported by: Vincent Neiger
Reviewer(s): Vincent Macri, Vincent Neiger
@vbraun vbraun merged commit 3015401 into sagemath:develop Dec 21, 2025
20 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

weak_popov_form incorrectly returns zero matrix when using ordered=True and include_zero_vectors=False

3 participants