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

Route sparse integer matrices to a working Smith form #10626

Closed
rbeezer mannequin opened this issue Jan 13, 2011 · 6 comments
Closed

Route sparse integer matrices to a working Smith form #10626

rbeezer mannequin opened this issue Jan 13, 2011 · 6 comments

Comments

@rbeezer
Copy link
Mannequin

rbeezer mannequin commented Jan 13, 2011

Sparse integer matrices get sent to the generic Smith form routine, where they fail (see #10625). They should instead get dense-ified
and routed to the integer-only version. This solves some failures on #10604.

sage: A = matrix(2, range(4), sparse=True)
sage: A.smith_form()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/home/sage/sage-4.6.1.alpha2/devel/sage-main/<ipython console> in <module>()

/home/sage/sage-4.6.1.alpha2/local/lib/python2.6/site-packages/sage/matrix/matrix2.so in sage.matrix.matrix2.Matrix.smith_form (sage/matrix/matrix2.c:37477)()

/home/sage/sage-4.6.1.alpha2/local/lib/python2.6/site-packages/sage/matrix/matrix2.so in sage.matrix.matrix2._smith_onestep (sage/matrix/matrix2.c:42366)()

/home/sage/sage-4.6.1.alpha2/local/lib/python2.6/site-packages/sage/matrix/matrix2.so in sage.matrix.matrix2._smith_onestep (sage/matrix/matrix2.c:42181)()

/home/sage/sage-4.6.1.alpha2/local/lib/python2.6/site-packages/sage/matrix/matrix2.so in sage.matrix.matrix2._generic_clear_column (sage/matrix/matrix2.c:41049)()

/home/sage/sage-4.6.1.alpha2/local/lib/python2.6/site-packages/sage/rings/integer.so in sage.rings.integer.Integer.inverse_mod (sage/rings/integer.c:28740)()

/home/sage/sage-4.6.1.alpha2/local/lib/python2.6/site-packages/sage/rings/integer.so in sage.rings.integer.as_Integer (sage/rings/integer.c:6052)()

/home/sage/sage-4.6.1.alpha2/local/lib/python2.6/site-packages/sage/rings/integer.so in sage.rings.integer.Integer.__init__ (sage/rings/integer.c:7312)()

TypeError: unable to coerce <class 'sage.rings.ideal.Ideal_pid'> to an integer

CC: @dandrake @sagetrac-jthurber

Component: linear algebra

Keywords: Smith form

Author: Rob Beezer

Reviewer: David Loeffler

Merged: sage-4.6.2.alpha3

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

@rbeezer rbeezer mannequin added this to the sage-4.6.2 milestone Jan 13, 2011
@rbeezer rbeezer mannequin assigned jasongrout and williamstein Jan 13, 2011
@rbeezer
Copy link
Mannequin Author

rbeezer mannequin commented Jan 13, 2011

Author: Rob Beezer

@rbeezer
Copy link
Mannequin Author

rbeezer mannequin commented Jan 13, 2011

comment:1

Attachment: trac_10626-smith-form-integer-sparse.patch.gz

Patch mirrors docstring for dense matrices and just ships off a dense version of the matrix to that code. matrix/matrix_integer_sparse.pyx is not included into the documentation, so I've added that chore to my list.

@rbeezer rbeezer mannequin added the s: needs review label Jan 13, 2011
@loefflerd
Copy link
Mannequin

loefflerd mannequin commented Jan 16, 2011

comment:2

I've just uploaded a patch at #10625, which makes the examples here work. That said, densifying a matrix and calculating Smith form of that using integer-specific routines is going to be much faster than calling a slow generic routine; so this patch should still be applied. Applies fine to 4.6.2.alpha0 and all doctests pass, so positive review.

@loefflerd
Copy link
Mannequin

loefflerd mannequin commented Jan 16, 2011

Reviewer: David Loeffler

@loefflerd
Copy link
Mannequin

loefflerd mannequin commented Jan 16, 2011

Changed keywords from none to Smith form

@jdemeyer
Copy link

Merged: sage-4.6.2.alpha3

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

3 participants