Opened 8 years ago

Closed 8 years ago

#14049 closed defect (fixed)

Matrix slices don't deal with zero rows or columns well

Reported by: jason Owned by: jason, was
Priority: major Milestone: sage-5.7
Component: linear algebra Keywords:
Cc: jhpalmieri, rbeezer Merged in: sage-5.7.beta3
Authors: Jason Grout Reviewers: Karl-Dieter Crisman
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:


As reported on ask.sagemath:, matrix slices don't correctly handle empty matrices. This patch corrects the faulty optimization.

Attachments (1)

trac_14049-matrixslice-zero.patch (1.3 KB) - added by jason 8 years ago.

Download all attachments as: .zip

Change History (7)

Changed 8 years ago by jason

comment:1 Changed 8 years ago by jason

  • Cc jhpalmieri rbeezer added
  • Status changed from new to needs_review

comment:2 Changed 8 years ago by kcrisman

  • Reviewers set to Karl-Dieter Crisman
  • Status changed from needs_review to positive_review

This looks good, passes tests etc. - yes, talk about premature optimization!

My dumb question is whether we should, in fact, have such nonsensical matrices. In particular

sage: m = identity_matrix(QQ, 4)[4:,:] 
sage: m

Should we instead have something that shows we have four columns? But of course that wouldn't be about this ticket.

comment:3 Changed 8 years ago by jason

We should certainly have zero-row and zero-column matrices. That's an explicitly and deliberately supported feature in Sage.

comment:4 Changed 8 years ago by jhpalmieri

I think kcrisman's question is whether a 0x4 matrix should be displayed differently, somehow, than a 0x0 matrix. I'm not sure what the answer is, and it's low priority, but it's an interesting question.

comment:5 Changed 8 years ago by kcrisman

I suppose I was asking both questions, but I'll take the experts' answers on both.

comment:6 Changed 8 years ago by jdemeyer

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