Ticket #3704 (closed defect: fixed)
[with patch, positive review] make diagonal_matrix accept much more general arguments
| Reported by: | jkantor | Owned by: | was |
|---|---|---|---|
| Priority: | major | Milestone: | sage-3.3 |
| Component: | linear algebra | Keywords: | |
| Cc: | Author(s): | ||
| Report Upstream: | Reviewer(s): | ||
| Merged in: | Work issues: |
Description
So I think this is a bug
sage: w=vector(RR,[1,2,3]) sage: d=diagonal_matrix(w) UnboundLocalError: local variable 'v' referenced before assignment
The following fails as well
sage: d=diagonal_matrix(RR,w)
the only thing that works is
sage: d=diagonal_matrix(RR,list(w))
A stupid but easy fix is to try to turn any argument to diagonal_matrix into a list before bailing out (its in matrix/constructor.py), but there should probably be logic actually expecting vectors and analyzing the parents?
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

