Opened 11 years ago

Closed 11 years ago

#10626 closed defect (fixed)

Route sparse integer matrices to a working Smith form

Reported by: rbeezer Owned by: jason, was
Priority: minor Milestone: sage-4.6.2
Component: linear algebra Keywords: Smith form
Cc: ddrake, jthurber Merged in: sage-4.6.2.alpha3
Authors: Rob Beezer Reviewers: David Loeffler
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges


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/ 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/ 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/ 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/ 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/ 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/ 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/ in sage.rings.integer.Integer.__init__ (sage/rings/integer.c:7312)()

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

Attachments (1)

trac_10626-smith-form-integer-sparse.patch (2.6 KB) - added by rbeezer 11 years ago.

Download all attachments as: .zip

Change History (4)

Changed 11 years ago by rbeezer

comment:1 Changed 11 years ago by rbeezer

  • Authors set to Rob Beezer
  • Cc ddrake jthurber added
  • Status changed from new to needs_review

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.

comment:2 Changed 11 years ago by davidloeffler

  • Keywords Smith form added
  • Reviewers set to David Loeffler
  • Status changed from needs_review to positive_review

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.

comment:3 Changed 11 years ago by jdemeyer

  • Merged in set to sage-4.6.2.alpha3
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.