Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#10028 closed defect (fixed)

inconsistent error messages for inverting singular matrices

Reported by: dmharvey Owned by: jason, was
Priority: trivial Milestone: sage-4.6.2
Component: linear algebra Keywords:
Cc: Merged in: sage-4.6.2.alpha4
Authors: André Apitzsch Reviewers: Rob Beezer
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by rbeezer)

n = 2:

sage: Matrix([[1, 1], [1, 1]])^(-1)
...
ZeroDivisionError: 

apparently all other n:

sage: Matrix([[1, 1, 1], [1, 1, 1], [1, 1, 1]])^(-1)
...
ZeroDivisionError: input matrix must be nonsingular

Apply trac_10028_error_messages.patch

Attachments (1)

trac_10028_error_messages.patch (81.9 KB) - added by aapitzsch 9 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 9 years ago by aapitzsch

  • Milestone set to sage-4.6.2
  • Status changed from new to needs_review

comment:2 Changed 9 years ago by rbeezer

I just noticed these weak error messages the other day - it'd be great to have all the cases of non-invertible matrices give a common, and informative, message. Two suggestions:

(a) At the sage prompt run search_src("ZeroDivisionError") and I think you will find two or three more places in the matrix code that could also be improved.

(b) For Python 3 raising an error will require syntax like:

raise ZeroDivisionError("input matrix must be nonsingular") 

Might as well do it that way now.

Rob

Changed 9 years ago by aapitzsch

comment:3 Changed 9 years ago by aapitzsch

The new patch contains a lot of small changes (hopefully not too much), most of them are related to python3 syntax.

comment:4 Changed 9 years ago by rbeezer

  • Authors set to Andre Apitzsch
  • Description modified (diff)
  • Reviewers set to Rob Beezer
  • Status changed from needs_review to positive_review

Looks real good. Thanks for straightening this out. Passes all tests on 4.6.2.alpha2. Positive review.

comment:5 Changed 9 years ago by jdemeyer

  • Merged in set to sage-4.6.2.alpha4
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:6 Changed 9 years ago by jdemeyer

  • Authors changed from Andre Apitzsch to André Apitzsch
Note: See TracTickets for help on using tickets.