Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define minimal polynomial for any square matrix over any field #39697

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

darijgr
Copy link
Contributor

@darijgr darijgr commented Mar 14, 2025

This implements a function minpoly_lin on the Matrix class that computes the minimal polynomial of a square matrix over any field, notwithstanding the possible lack of polynomial factorization algorithms.

It is slow, which is why I am not overwriting the existing minpoly method. More should probably be done to expose this method as an algorithm for minpoly.

Fixes #39696.

📝 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.

⌛ Dependencies

@user202729
Copy link
Contributor

We could probably use https://flintlib.org/doc/gr_mat.html#c.gr_mat_minpoly_field instead. (but the first step is to convert arbitrary matrix to flint)

@maxale
Copy link
Contributor

maxale commented Mar 14, 2025

This looks a bit more straightforward:

        pow = self**0
        Mpows = matrix(F,n**2,1,pow.list())
        for k in range(1,n+1):
            pow *= self
            v = vector(pow.list())
            try:
                cs = Mpows.solve_right(v)
            except ValueError:
                Mpows = Mpows.augment(v)
                continue
            ....

@darijgr
Copy link
Contributor Author

darijgr commented Mar 14, 2025

user202729

Does flint know how to deal with arbitrary Sage fields? I thought this is not how packages worked...

@user202729
Copy link
Contributor

You can probably implement a generic wrapper with https://flintlib.org/doc/gr_implementing.html

Copy link

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

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.

A matrix has a minpoly even if factoring is uncomputable
3 participants