Ticket #8743 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

change_ring on a rational matrix may return self

Reported by: jason Owned by: jason, was
Priority: major Milestone: sage-4.4.4
Component: linear algebra Keywords:
Cc: was, rbeezer Work issues:
Report Upstream: N/A Reviewers: Joni Syri
Authors: Jason Grout Merged in: sage-4.4.4.alpha0
Dependencies: Stopgaps:

Description

change_ring on a rational matrix goes against the documentation for the generic change_ring function, which states that a copy is always returned. This patch fixes this and adds a TestSuite? test for it (the advantage of a testsuite test is that this will be run for *every* matrix class, not just the rational matrix class).

Attachments

trac-8743-change_ring.patch Download (1.7 KB) - added by jason 3 years ago.

Change History

comment:1 Changed 3 years ago by jason

  • Status changed from new to needs_review

Changed 3 years ago by jason

comment:2 Changed 3 years ago by jsyri

  • Status changed from needs_review to positive_review

Fixes bug, code seems to be OK, test is included, all tests pass. Positive review.

comment:3 Changed 3 years ago by mhansen

  • Status changed from positive_review to closed
  • Reviewers set to Joni Syri
  • Resolution set to fixed
  • Merged in set to sage-4.4.4.alpha0

comment:4 Changed 3 years ago by robertwb

I understand the ticket is closed, but is there any rational for the current behavior? Seems very inefficient, and returning self should be totally safe for immutable matrices at least.

comment:5 Changed 3 years ago by mhansen

The patch does return self for immutable matrices.

Note: See TracTickets for help on using tickets.