Ticket #2871 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

[with patch, positive review] matrix: M[range(2,-1,-1),:] returns junk

Reported by: dfdeshom Owned by: dfdeshom
Priority: minor Milestone: sage-3.0
Component: linear algebra Keywords:
Cc: Work issues:
Report Upstream: Reviewers:
Authors: Merged in:
Dependencies: Stopgaps:

Description

In the following example, A should be "upside down", but it's not

sage: A = random_matrix(ZZ,3); A

[ 1  3 -1]
[ 4 -3 -1]
[-1  0 -1]

sage: A[range(2,-1,-1),:]

[ 1  3 -1]
[ 4 -3 -1]
[-1  0 -1]

The problem is with set(), which doesn't preserve order.

Attachments

2871.patch Download (2.1 KB) - added by dfdeshom 5 years ago.
2871-alpha2.patch Download (2.0 KB) - added by dfdeshom 5 years ago.
patch against alpha2

Change History

comment:1 Changed 5 years ago by dfdeshom

  • Summary changed from matrix: M[range(2,-1,-1),:] returns junk to [with patch,needs review] matrix: M[range(2,-1,-1),:] returns junk

Changed 5 years ago by dfdeshom

comment:2 Changed 5 years ago by cwitty

  • Summary changed from [with patch,needs review] matrix: M[range(2,-1,-1),:] returns junk to [with patch, positive review pending rebase] matrix: M[range(2,-1,-1),:] returns junk

The code and doctests look good, and doctests pass in sage/matrix in Sage 2.11. Unfortunately, applying the patch to Sage 3.0 alpha 2 (the latest I have at the moment) gives a rejected hunk.

Changed 5 years ago by dfdeshom

patch against alpha2

comment:3 Changed 5 years ago by cwitty

  • Summary changed from [with patch, positive review pending rebase] matrix: M[range(2,-1,-1),:] returns junk to [with patch, positive review] matrix: M[range(2,-1,-1),:] returns junk

With the revised 2871-alpha2.patch, the patch applies and doctests pass in sage/matrix for sage 3.0 alpha2.

Didier, thanks for making the changes I requested on IRC!

Looks good, please apply.

comment:4 Changed 5 years ago by mabshoff

  • Status changed from new to closed
  • Resolution set to fixed

Merged 2871-alpha2.patch in Sage 3.0.alpha4

Note: See TracTickets for help on using tickets.