Opened 8 years ago

Closed 8 years ago

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

Reported by: Owned by: dfdeshom dfdeshom minor sage-3.0 linear algebra

### 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.

### comment:1 Changed 8 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

### comment:2 Changed 8 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 8 years ago by dfdeshom

patch against alpha2

### comment:3 Changed 8 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!