Opened 7 years ago
Closed 7 years ago
#14314 closed defect (fixed)
Matrices _matrix_() method is inconsistent with expected arguments
Reported by: | tscrim | Owned by: | tscrim |
---|---|---|---|
Priority: | major | Milestone: | sage-5.9 |
Component: | linear algebra | Keywords: | |
Cc: | Merged in: | sage-5.9.beta3 | |
Authors: | Travis Scrimshaw | Reviewers: | Andrey Novoseltsev |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
sage: m = matrix({(0,0):4,(5,3):2}) sage: matrix(m) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-24-c5a0911a1542> in <module>() ----> 1 matrix(m) /home/travis/sage-5.8.beta1/local/lib/python2.7/site-packages/sage/matrix/constructor.pyc in _matrix_constructor(*args, **kwds) 526 return args[0]._matrix_(sparse=sparse) 527 except TypeError: --> 528 return args[0]._matrix_() 529 elif len(args) == 2: 530 if hasattr(args[0], '_matrix_'): TypeError: _matrix_() takes exactly one argument (0 given)
In both sparse and dense integer matrices (I didn't check for other kinds), the expected input is 1 argument of a new ring for the entries.
Attachments (1)
Change History (6)
Changed 7 years ago by
comment:1 Changed 7 years ago by
- Status changed from new to needs_review
comment:2 Changed 7 years ago by
- Reviewers set to Andrey Novoseltsev
- Status changed from needs_review to positive_review
comment:3 Changed 7 years ago by
Thank you for the review.
comment:4 Changed 7 years ago by
Thanks for the patch, I had this annoying issue on TODO for a while ;-)
comment:5 Changed 7 years ago by
- Merged in set to sage-5.9.beta3
- Resolution set to fixed
- Status changed from positive_review to closed
Note: See
TracTickets for help on using
tickets.
I gave
_matrix_()
a default argument ofNone
and if no argument is passed in, it just returns the original matrix.