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

Minpoly doesn't work for all matrices #7989

Closed
jasongrout opened this issue Jan 19, 2010 · 26 comments
Closed

Minpoly doesn't work for all matrices #7989

jasongrout opened this issue Jan 19, 2010 · 26 comments

Comments

@jasongrout
Copy link
Member

Right now, not all matrices can compute minpolys. This patch exposes these matrices.

CC: @kcrisman @rbeezer @mwhansen @hedtke @tscrim

Component: linear algebra

Author: Jason Grout, Frédéric Chapoton

Branch/Commit: 329d472

Reviewer: Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/7989

@jasongrout

This comment has been minimized.

@jasongrout
Copy link
Member Author

comment:2

Attachment: trac-7989-minpoly-test.patch.gz

Here are the bugs (doctests that fail) this patch exposes:

	sage -t  "4.3.1.rc0/devel/sage-main/sage/matrix/matrix1.pyx"
	sage -t  "4.3.1.rc0/devel/sage-main/sage/matrix/matrix_dense.pyx"
	sage -t  "4.3.1.rc0/devel/sage-main/sage/matrix/matrix_generic_dense.pyx"
	sage -t  "4.3.1.rc0/devel/sage-main/sage/matrix/matrix_integer_2x2.pyx"

@jasongrout
Copy link
Member Author

Author: Jason Grout

@hedtke
Copy link
Contributor

hedtke commented Jul 17, 2011

comment:5

Sorry, I don't understand the reason for this function. What is the idea behind it?

@williamstein
Copy link
Contributor

comment:6

This is a great patch. I can't believe this has got ignored for the last 1.5 years.

Regarding what needs to be fixed, the test failure you claim for matrix_integer_2x2 is:


deep:sage wstein$ sage -t matrix/matrix_integer_2x2.pyx
sage -t  "matrix/matrix_integer_2x2.pyx"                    
**********************************************************************
File "/Users/wstein/sage/install/sage-4.7.1.rc0/devel/sage-main/sage/matrix/matrix_integer_2x2.pyx", line 101:
    sage: TestSuite(m).run()
Expected nothing
Got:
    Failure in _test_minpoly:
    Traceback (most recent call last):
      File "/Users/wstein/sage/install/current/local/lib/python/site-packages/sage/misc/sage_unittest.py", line 275, in run
        test_method(tester = tester)
      File "matrix2.pyx", line 1302, in sage.matrix.matrix2.Matrix._test_minpoly (sage/matrix/matrix2.c:8933)
      File "polynomial_element.pyx", line 358, in sage.rings.polynomial.polynomial_element.Polynomial.subs (sage/rings/polynomial/polynomial_element.c:5624)
      File "polynomial_element.pyx", line 557, in sage.rings.polynomial.polynomial_element.Polynomial.__call__ (sage/rings/polynomial/polynomial_element.c:5819)
      File "polynomial_element.pyx", line 638, in sage.rings.polynomial.polynomial_element.Polynomial.__call__ (sage/rings/polynomial/polynomial_element.c:7244)
      File "element.pyx", line 1302, in sage.structure.element.RingElement.__add__ (sage/structure/element.c:11504)
      File "coerce.pyx", line 766, in sage.structure.coerce.CoercionModel_cache_maps.bin_op (sage/structure/coerce.c:7337)
    TypeError: unsupported operand parent(s) for '+': 'Space of 2x2 integer matrices' and 'Integer Ring'
    ------------------------------------------------------------
    The following tests failed: _test_minpoly
**********************************************************************
1 items had failures:
   1 of   6 in __main__.example_7
***Test Failed*** 1 failures.
For whitespace errors, see the file /Users/wstein/.sage//tmp/.doctest_matrix_integer_2x2.py
	 [4.6 s]

This is because substitution isn't even implemented for that class:

sage: MS = sage.matrix.matrix_integer_2x2.MatrixSpace_ZZ_2x2()
sage: a = MS([1,2,3,4])
sage: a.minpoly()
x^2 - 5*x - 2
sage: a.minpoly()(a)
---------------------------------------------------------------------------
TypeError     

Also, if one adds this for minpoly, it would make sense to also add _test_charpoly.

-- William

@hedtke
Copy link
Contributor

hedtke commented Jul 17, 2011

comment:7

OK. Works for me, too. Is it favored that we include a test that purposely fails?

@rbeezer
Copy link
Mannequin

rbeezer mannequin commented Jul 17, 2011

comment:8

Replying to @hedtke:

OK. Works for me, too. Is it favored that we include a test that purposely fails?

I think the idea is to include the test-suite checking and add the fixes needed to make the tests pass.

@jdemeyer jdemeyer modified the milestones: sage-5.11, sage-5.12 Aug 13, 2013
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@mezzarobba
Copy link
Member

comment:11

sage-6.2.beta4:

sage -t src/sage/matrix/matrix_generic_dense.pyx  # 1 doctest failed
sage -t src/sage/matrix/matrix_dense.pyx  # 1 doctest failed

@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@jdemeyer
Copy link

@fchapoton
Copy link
Contributor

New commits:

08701a4test that minpoly works

@fchapoton
Copy link
Contributor

Commit: 08701a4

@fchapoton
Copy link
Contributor

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 19, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

ce364f7only test minpoly for exact rings

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 19, 2022

Changed commit from 08701a4 to ce364f7

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 19, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

216d945use Gap for minpoly of Gap matrices

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 19, 2022

Changed commit from ce364f7 to 216d945

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 19, 2022

Changed commit from 216d945 to 9f476b4

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 19, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

9f476b4add doc, skip test

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 20, 2022

Changed commit from 9f476b4 to 329d472

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 20, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

329d472skip another test

@fchapoton
Copy link
Contributor

Changed author from Jason Grout to Jason Grout, Frédéric Chapoton

@fchapoton
Copy link
Contributor

comment:21

green patchbot, so please review

@tscrim
Copy link
Collaborator

tscrim commented May 23, 2022

comment:22

LGTM.

@tscrim

This comment has been minimized.

@tscrim
Copy link
Collaborator

tscrim commented May 23, 2022

Reviewer: Travis Scrimshaw

@vbraun
Copy link
Member

vbraun commented May 26, 2022

Changed branch from public/ticket/7989 to 329d472

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants